 |
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
|
|
|
|

May 2nd, 2005, 04:42 PM
|
|
Registered User
|
|
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Warning error, please help!
I am completely new to programming and need to learn php and mysql. My problem is that in the book I am running into the following error while trying to do the lesson, which is keeping me from progressing further in the book can someone please help me out on this?
In chapter 3 in the select.php lesson, there is a part of the code that says: while ($row = mysql_fetch_array($results)) {
When I load this in the browser I get the following message:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in c:\wamp\www\test\select.php on line 17
Can someone please tell me what this means and how to fix it?
|
|

May 2nd, 2005, 08:57 PM
|
|
Registered User
|
|
Join Date: May 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Instead of using while ($row = mysql_fetch_array($results)) {,
I used while ($row = mysql_fetch_assoc($results)) { and it worked fine.
|
|

December 9th, 2005, 01:57 AM
|
|
Registered User
|
|
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Still does not work for me.
Quote:
|
quote:Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\Program Files\xampp\htdocs\sandbox\select.php on line 13
|
Using:
Code:
<?php
include "mysql_connect.php";
// make sure we're using the right database
mysql_select_db( "wiley" );
$query = "SELECT movie_name, movie_type
FROM movie
WHERE movie_year>1990
ORDER BY movie_type";
$results = mysql_query( $query ) || die( mysql_error() );
while ($rows = mysql_fetch_assoc( $results )) {
extract( $rows );
echo $movie_name;
echo " - ";
echo $movie_type;
echo "<br>";
}
?>
|
|

December 12th, 2005, 04:33 PM
|
|
Authorized User
|
|
Join Date: May 2005
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thios will happen if no results are returned. Are you sure that you've inserted the data into the table?
|
|
 |