Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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...

Reply With Quote
  #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' ]);


Reply With Quote
  #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...

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:40 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.