Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 27th, 2005, 08:40 AM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default chapter 7 commit.php

Hello, a need help with this php file, first i using try out 2 for the files movie.php and commit.php, the problem appears when i add a new movie i fill all fields and allways show me the error 'please enter a movie name', i don't know why i'm trying to solve but i can't and i think that the code is correct:

               $movie_name = trim($row[ 'movie_name' ]);
               if( empty($movie_name)){
                  $error .= "Please+enter+a+movie+name%21%0D%0A";
               }
i delete the trim($row[]) keeping the the next sentence

               $movie_name = 'movie_name' ;
               if( empty($movie_name)){
                  $error .= "Please+enter+a+movie+name%21%0D%0A";
               }

and works perfect for commit.php try out 1 but for commit.php try out 2 show me the next error:

Invalid query: Column count doesn't match value count at row 1

waiting for help thx...

  #2 (permalink)  
Old November 2nd, 2005, 08:57 AM
Registered User
 
Join Date: Nov 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It should have been $_POST in stead of $row
$movie_name = trim($_POST[ 'movie_name' ]);


  #3 (permalink)  
Old November 2nd, 2005, 09:24 AM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i did that before to solve the problem but show the next error:
Invalid query: Column count doesn't match value count at row 1

so i think the problem is in the moment of fill the database
 if ( empty($error) ){
                     $sql = "INSERT INTO
                              `movie`
                              ( `movie_name` ,
                                `movie_year` ,
                                `movie_release` ,
                                `movie_type` ,
                                `movie_leadactor` ,
                                `movie_director` ,
                                `movie_rating`)
                           VALUES
                              ( '".$_POST['movie_name']."' ,
                                '".$_POST['movie_year']."' ,
                                '$movie_release'
                                '".$_POST['movie_type']."' ,
                                '".$_POST['movie_leadactor']."' ,
                                '".$_POST['movie_director']."',
                                '$movie_rating' )
                           ";
and i don't why in $movie_release at the and dom't finish with a ','
i put it and all works perfect...

however thx for reply...



Similar Threads
Thread Thread Starter Forum Replies Last Post
Commit.PHP and Delete.PHP in WROX's book GiFos Beginning PHP 0 January 30th, 2007 10:51 PM
ch 6 commit.php problem updating movie table statusquo BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 May 2nd, 2005 10:02 PM
Error: movie.php & commit.php on p182-186, ch6 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 12th, 2004 02:48 PM
Chapter 6 commit.php czambran BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 4 October 3rd, 2004 10:20 PM
ch 7 page 208 commit.php pipdickenz BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 September 8th, 2004 12:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.