Jump to content

Archived

This topic is now archived and is closed to further replies.

perezf

mysql help

Recommended Posts

Can someone please check whats wrong with my code
i 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]

Share this post


Link to post
Share on other sites
if someone could help me i would greatly appreciate it
i have to get this workin in 2 hours

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.