Wrox Programmer Forums
|
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 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
 
Old January 9th, 2008, 02:39 PM
Registered User
 
Join Date: Jul 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6

I keep getting this error when attempting to add movies in chapter 6
Invalid query: Column count doesn't match value count at row 1
I think it is looking for a movie_id but i dont know, here is the commit page that sends it all to mysql for your viewing pleasure:

<?php
//COMMIT ADD
include "..\linkmov.php";
switch ($_GET['action']) {
    case "add":
        switch ($_GET['type']) {
            case "movie":
                $sql = "INSERT INTO movie
                            (movie_name,
                            movie_year,
                            movie_type,
                            movie_leadactor,
                            movie_director)
                        VALUES
                            ('" . $_POST['movie_name'] . "'
                            '" . $_POST['movie_year'] . "'
                            '" . $_POST['movie_type'] . "'
                            '" . $_POST['movie_leadactor'] . "'
                            '" . $_POST['movie_director'] . "')";
                break;
            }
        break;
}
if (isset($sql) && !empty($sql)) {
    echo "";
    $result = mysql_query($sql)
        or die("Invalid query: " . mysql_error());
?>
    <p align="center" style="color:#FF0000">
        Done. <a href="index.php">Index</a>
    </p>
<?php
}
?>

any help would be appreciated, Thanks

I'm getting kinda code
 
Old January 9th, 2008, 03:32 PM
Registered User
 
Join Date: Jul 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Never mind, i found out what I was doing wrong, i forgot to put a comma at the end of these lines-
Quote:
quote:VALUES
                            ('" . $_POST['movie_name'] . "'
                            '" . $_POST['movie_year'] . "'
                            '" . $_POST['movie_type'] . "'
                            '" . $_POST['movie_leadactor'] . "'
                            '" . $_POST['movie_director'] . "')";





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 2 - End of chapter exercises whizzkid1892 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 July 30th, 2008 12:02 PM
chapter 7 - chapter 11 pelopito BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 3 January 6th, 2008 11:40 AM
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM





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