The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> help With error
minidiapolis
post Oct 6 2011, 05:45 PM
Post #1


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



Why am I getting this error?
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource

<?php
require_once("functions.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
DatabaseConnection();

$query= "SELECT * FROM treats";
$result_set= mysql_query($query);

$output = "<table>";
while($row = mysql_fetch_array($result))
{
$productDetail1['product_id'];
$productDetail2['product_title'];
$productDetail3['product_Description'];
$productDetail4['price'];
$productDetail5['product_pic'];
$output .= ("
<tr>
<td>".$productDetail1['product_id'] ."</td>
</tr>
")
;}
$output .= "</table>";
echo $output;
?>
</body>
</html>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 6 2011, 07:17 PM
Post #2


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,571
Joined: 9-August 06
Member No.: 6



See if this helps.
http://forums.devarticles.com/mysql-develo...mysql-3251.html


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
minidiapolis
post Oct 6 2011, 07:32 PM
Post #3


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



that didn't help. I just want to put data from a database into a two column table. I changed the code. Any suggestions?

<?php
require_once("functions.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
DatabaseConnection();

$query= "SELECT * FROM treats";
$result_set= mysql_query($query) or die(mysql_error());
/*
$output = "<table>";
while($row = mysql_fetch_array($result))
{
$productDetail1['product_id'];
$productDetail2['product_title'];
$productDetail3['product_Description'];
$productDetail4['price'];
$productDetail5['product_pic'];
$output .= ("
<tr>
<td>".$productDetail1['product_id'] ."</td>
</tr>
")
;}
$output .= "</table>";
echo $output;*/
while($row = mysql_fetch_array($result))
{
echo "<table>";
echo "</td><td>";
echo $row['product_id'];
echo "</td><td>";
echo $row['product_title'];
echo "</td><td>";
echo "</rd></tr>";
}
echo "</table>";

?>
</body>
</html>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
minidiapolis
post Oct 6 2011, 10:41 PM
Post #4


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



problem resolved
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 7 2011, 05:00 AM
Post #5


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 15,571
Joined: 9-August 06
Member No.: 6



It would help others with the same problem if you told us how. Share a little sometimes, minidiapolis. It doesn't hurt. wink.gif


--------------------
"Never go to excess, but let moderation be your guide."
- Cicero

IPB Image
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 31st October 2014 - 04:06 AM