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 May 2nd, 2005, 04:42 PM
Registered User
 
Join Date: May 2005
Location: , , .
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?


Reply With Quote
  #2 (permalink)  
Old May 2nd, 2005, 08:57 PM
Registered User
 
Join Date: May 2005
Location: , , .
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.

Reply With Quote
  #3 (permalink)  
Old December 9th, 2005, 01:57 AM
Registered User
 
Join Date: Dec 2005
Location: , , .
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>";
   }
?>

Reply With Quote
  #4 (permalink)  
Old December 12th, 2005, 04:33 PM
Authorized User
 
Join Date: May 2005
Location: , , .
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?

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



All times are GMT -4. The time now is 10:04 AM.


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