943,704 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1317
  • PHP RSS
Sep 3rd, 2008
0

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

Expand Post »
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home2/fellowes/public_html/createaccount.php on line 108

PHP Syntax (Toggle Plain Text)
  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);

PHP Syntax (Toggle Plain Text)
  1. <?php while($rows=mysql_fetch_array($result)) { ?>
  2. <option><?php echo $rows['crs_code']; ?>//Line 108</option>
  3. <?php } ?>
Reputation Points: 10
Solved Threads: 2
Light Poster
CzechRock3 is offline Offline
33 posts
since Mar 2008
Sep 3rd, 2008
1

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

Replace the $result in this one:
Click to Expand / Collapse  Quote originally posted by CzechRock3 ...
PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 28
Solved Threads: 71
Posting Pro
ryan_vietnow is offline Offline
578 posts
since Aug 2007
Sep 4th, 2008
0

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

When I change it nothing appears... And there are two fields in the table...
Reputation Points: 10
Solved Threads: 2
Light Poster
CzechRock3 is offline Offline
33 posts
since Mar 2008
Sep 4th, 2008
0

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

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
Reputation Points: 10
Solved Threads: 2
Light Poster
CzechRock3 is offline Offline
33 posts
since Mar 2008
Sep 4th, 2008
0

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

ok,just mark this thread solved, ayt? cheers!
Reputation Points: 28
Solved Threads: 71
Posting Pro
ryan_vietnow is offline Offline
578 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Fatal error: Call to undefined function form()
Next Thread in PHP Forum Timeline: Images in PHP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC