Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-24-2007, 04:15 AM   PM User | #1
ggp
New Coder

 
Join Date: Nov 2006
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
ggp is an unknown quantity at this point
MYSQL error

Hi.

I am getting this error. Could you help plzz? thanks

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\Online Services\Apache2\htdocs\searchexample1.php on line 49

line49: while ($row = mysql_fetch_array($result))


[HTML]
[/PHP]


<?php

$sql = ("SELECT * FROM ..... WHERE .....");

$conn = mysql_connect("","") OR DIE (mysql_error());
mysql_select_db("cartonlots", $conn) OR DIE (mysql_error());

$result = mysql_query ($sql, $conn);
echo "<TABLE BORDER=2>";

while ($row = mysql_fetch_array($result))
{
echo "<TR><TD>".$row["image_id"]."<TD>".$row["smdescription"]; }

echo "</TABLE>";
?>


[/PHP]
[/HTML]
ggp is offline   Reply With Quote
Old 01-24-2007, 05:10 AM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
Check your query to see if it failed and if it did print mysql_error().
__________________
Fumigator is offline   Reply With Quote
Old 01-24-2007, 06:03 AM   PM User | #3
ggp
New Coder

 
Join Date: Nov 2006
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
ggp is an unknown quantity at this point
Is not error there sorry it says warning.
ggp is offline   Reply With Quote
Old 01-24-2007, 06:27 AM   PM User | #4
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
Your query is failing but you didn't bother to check to see if it is failing, you're just going right in to trying to use the query's resource, which isn't a valid resource, because the query failed, so you are getting a warning about the resource not being valid, which is being caused by your query failing, which you are not checking on.
__________________
Fumigator is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:42 PM.


Advertisement
Log in to turn off these ads.