Wrox Programmer Forums
|
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143
This is the forum to discuss the Wrox book Beginning PHP 6, Apache, MySQL 6 Web Development by Timothy Boronczyk, Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz; ISBN: 9780470391143
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 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 June 12th, 2011, 12:09 PM
Registered User
 
Join Date: Aug 2010
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Default Ch3 p.92 Unknown column 'movie.name' in 'field list'

Can someone help me with a problem using select query.

When running the script to select information from the database the message I receive is:

Unknown column 'movie.name' in 'field list'

I have checked in mysql console on wamp server and the field is showing in the moviesite table so it does exist. Then I dropped the database, checked the syntax again and re-saved the script. Then I re-started wamp server again in case this was needed. I created again plus inserted the data all successfully. However the error message was still being returned so I am confused as to how the field is not being recognised?

Here is the code used but can't see any real problems with it:

<?php
//connect to MySQL


$db = mysql_connect ('localhost', 'root', '') or
die ('Unable to connect. Check your connection parameters.');


//make sure our recently created datbase is the active one
mysql_select_db('moviesite', $db) or die(mysql_error($db));

//select the movie titles and their genre after the year 1990

$query = 'SELECT
movie.name, movie_type
FROM
movie
WHERE
movie_year > 1990
ORDER BY
movie_type';
$result = mysql_query($query, $db) or die(mysql_error($db));

//show the results

while ($row = mysql_fetch_array($result)) {
extract($row);
echo $movie_name . ' - ' . $movie_type . '<br/>';
}
?>

Any pointers on this would be greatly appreciated.
 
Old June 12th, 2011, 12:45 PM
Registered User
 
Join Date: Aug 2010
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Silly me, just checked code again and spotted my own error. Should have typed movie_name and not movie.name. All works now.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting the Master page hoses site... Page 92... richv BOOK: Beginning SharePoint 2010 Development 19 December 30th, 2010 10:21 AM
multi-column list box values moved to 2nd list box sbmvr Access VBA 1 May 14th, 2007 01:58 PM
Previous field /column value in cross-tab mozilago SQL Server ASP 0 March 7th, 2007 02:58 AM
To get text of Button Field column in GridView nitinp ASP.NET 2.0 Basics 1 November 3rd, 2006 10:57 AM
List Tool Multi Column? Vendlus BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 April 28th, 2006 06:39 AM





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