perezf Posted June 19, 2006 Share Posted June 19, 2006 Can someone please check whats wrong with my codei get an error message saying Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /hsphere/local/home/way2fr3s/2fr3sh.com/display/images.php on line 18[code]<html><head><title>Displaying MySQL Data</title></head><body><?php$db_host = "";$db_user = "*********";$db_pwd = "*******";$db_name = "atctrends";mysql_connect($db_host, $db_user, $db_pwd);mysql_select_db($db_name);?><table><?php$sql = "SELECT * FROM colors";$query = mysql_query($sql);while($row = mysql_fetch_array($query)) {echo "<tr>";echo "<td><img src=\"http://2fr3sh.com/display/images/\"".$row['source']."\"/></td>";echo "<td>".$row['toyinfo']."<br>".$row['toyprice']."</td>";echo "</tr>";}?></table></body></html>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12347-mysql-help/ Share on other sites More sharing options...
perezf Posted June 19, 2006 Author Share Posted June 19, 2006 if someone could help me i would greatly appreciate iti have to get this workin in 2 hours Quote Link to comment https://forums.phpfreaks.com/topic/12347-mysql-help/#findComment-47189 Share on other sites More sharing options...
.josh Posted June 19, 2006 Share Posted June 19, 2006 add the following red stuff to your script and post the error.[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<html><head><title>Displaying MySQL Data</title></head><body><?php$db_host = "";$db_user = "*********";$db_pwd = "*******";$db_name = "atctrends";mysql_connect($db_host, $db_user, $db_pwd)[!--coloro:red--][span style=\"color:red\"][!--/coloro--] or die(mysql_error());[!--colorc--][/span][!--/colorc--]mysql_select_db($db_name)[!--coloro:red--][span style=\"color:red\"][!--/coloro--] or die(mysql_error());[!--colorc--][/span][!--/colorc--]?><table><?php$sql = "SELECT * FROM colors";$query = mysql_query($sql)[!--coloro:red--][span style=\"color:red\"][!--/coloro--] or die(mysql_error());[!--colorc--][/span][!--/colorc--]while($row = mysql_fetch_array($query)) {echo "<tr>";echo "<td><img src=\"http://2fr3sh.com/display/images/\"".$row['source']."\"/></td>";echo "<td>".$row['toyinfo']."<br>".$row['toyprice']."</td>";echo "</tr>";}?></table></body></html>[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/12347-mysql-help/#findComment-47194 Share on other sites More sharing options...
wildteen88 Posted June 19, 2006 Share Posted June 19, 2006 Please read the FAQ forum as this has been answered many times before, or search the forum before posting.[a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=95376\" target=\"_blank\"]CLICKY[/a] Quote Link to comment https://forums.phpfreaks.com/topic/12347-mysql-help/#findComment-47233 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.