Jump to content


Photo

mysql help


  • Please log in to reply
3 replies to this topic

#1 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 19 June 2006 - 03:08 AM

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


#2 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 19 June 2006 - 03:47 AM

if someone could help me i would greatly appreciate it
i have to get this workin in 2 hours

#3 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 19 June 2006 - 03:59 AM

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]
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 19 June 2006 - 08:46 AM

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]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users