Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

Reply

Join Date: Mar 2008
Posts: 31
Reputation: CzechRock3 is an unknown quantity at this point 
Solved Threads: 2
CzechRock3's Avatar
CzechRock3 CzechRock3 is offline Offline
Light Poster

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

 
0
  #1
Sep 3rd, 2008
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home2/fellowes/public_html/createaccount.php on line 108

  1. include("conf.inc.php");
  2. $tbl_name="tbl_courses";
  3.  
  4. $sql=mysql_query("SELECT * FROM $tbl_name WHERE crs_semister=1 AND crs_period='A'") or die(mysql_error());
  5. $result=mysql_num_rows($sql);

  1. <?php while($rows=mysql_fetch_array($result)) { ?>
  2. <option><?php echo $rows['crs_code']; ?>//Line 108</option>
  3. <?php } ?>
im a zombie killer
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 570
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resou

 
1
  #2
Sep 3rd, 2008
Replace the $result in this one:
Originally Posted by CzechRock3 View Post
  1. <?php while($rows=mysql_fetch_array($result)) { ?>
  2. <option><?php echo $rows['crs_code']; ?>//Line 108</option>
  3. <?php } ?>
to $sql because your $sql variable is what holds your query.
$result holds the mysql_num_rows value.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 31
Reputation: CzechRock3 is an unknown quantity at this point 
Solved Threads: 2
CzechRock3's Avatar
CzechRock3 CzechRock3 is offline Offline
Light Poster

Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

 
0
  #3
Sep 4th, 2008
When I change it nothing appears... And there are two fields in the table...
im a zombie killer
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 31
Reputation: CzechRock3 is an unknown quantity at this point 
Solved Threads: 2
CzechRock3's Avatar
CzechRock3 CzechRock3 is offline Offline
Light Poster

Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

 
0
  #4
Sep 4th, 2008
Sorry... I haven't slepped well for the past couple days... School just started so I have been making stupid mistakes I shouldn't be making... Your right... I just realized what I did wrong. Thanks again
im a zombie killer
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 570
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

 
0
  #5
Sep 4th, 2008
ok,just mark this thread solved, ayt? cheers!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 819 | Replies: 4
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC