Wrox Programmer Forums
|
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
 
Old May 2nd, 2005, 04:42 PM
Registered User
 
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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?


 
Old May 2nd, 2005, 08:57 PM
Registered User
 
Join Date: May 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Instead of using while ($row = mysql_fetch_array($results)) {,

I used while ($row = mysql_fetch_assoc($results)) { and it worked fine.

 
Old December 9th, 2005, 01:57 AM
Registered User
 
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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>";
   }
?>

 
Old December 12th, 2005, 04:33 PM
Authorized User
 
Join Date: May 2005
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thios will happen if no results are returned. Are you sure that you've inserted the data into the table?






Similar Threads
Thread Thread Starter Forum Replies Last Post
1>Sketcher - 284 error(s), 3 warning(s) shade cat BOOK: Ivor Horton's Beginning Visual C++ 2005 1 July 21st, 2008 08:50 PM
log4j warning. and error. sureshrgsl Apache Tomcat 0 April 16th, 2007 03:08 AM
rename warning error ss2003 Beginning PHP 2 January 10th, 2007 06:23 AM
Compile Warning... jch02140 C++ Programming 1 September 29th, 2006 07:48 AM
fixing the 'headers already sent' warning/error ire BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 August 21st, 2006 07:35 AM





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