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

Recommended Answers

All 4 Replies

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.

commented: Made me realize a stupid mistake +1

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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.