954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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

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

include("conf.inc.php");
	$tbl_name="tbl_courses";
	
	$sql=mysql_query("SELECT * FROM $tbl_name WHERE crs_semister=1 AND crs_period='A'") or die(mysql_error());
	$result=mysql_num_rows($sql);
<?php while($rows=mysql_fetch_array($result)) { ?>
                        <option><?php echo $rows['crs_code']; ?>//Line 108</option>
                    <?php } ?>
CzechRock3
Light Poster
37 posts since Mar 2008
Reputation Points: 10
Solved Threads: 2
 

Replace the $result in this one:

<?php while($rows=mysql_fetch_array($result)) { ?>
                        <option><?php echo $rows['crs_code']; ?>//Line 108</option>
                    <?php } ?>

to $sql because your $sql variable is what holds your query.
$result holds the mysql_num_rows value.

ryan_vietnow
Posting Pro
578 posts since Aug 2007
Reputation Points: 28
Solved Threads: 71
 

When I change it nothing appears... And there are two fields in the table...

CzechRock3
Light Poster
37 posts since Mar 2008
Reputation Points: 10
Solved Threads: 2
 

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

CzechRock3
Light Poster
37 posts since Mar 2008
Reputation Points: 10
Solved Threads: 2
 

ok,just mark this thread solved, ayt? cheers!

ryan_vietnow
Posting Pro
578 posts since Aug 2007
Reputation Points: 28
Solved Threads: 71
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You