i have been getting this problem n this is getting into my nerves..
it works fine on the web.. but i need to present it on the intranet tomorrow "sunday"
it gives this damn error. of mysql_fetch_array..
can u plz help me

CODE:

<div id="right_nav">


<div id="cga_events">
<div id="navtop" align="center">
<div id="navtop_left">
</div><div id="navtop_right">
</div>
<div id="navtop_text">CGA Events</div>
</div>
<div id="pageNav">
<div id="sectionLinks">';


include("connect1.php");
$table = events;
$query  = "SELECT  id, topic, event, date
FROM events ORDER BY 'id' DESC  LIMIT 5";


$result=mysql_query($query);
//LINE 140 while (list($id, $topic, $event, $date) =mysql_fetch_array($result))
{
echo"  <font color=\"#006600\">&nbsp;On ".substr($date,0,10)."</font>
<a href=\"$self?page=showevents&id=$id &topic=$topic \" class=\"elibtopic\">$topic</a>
";
}


echo'</div>
</div>';






warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\phpdev5\www\intranet cga\sept 25th 2007\myclub\index.php on line 140

Recommended Answers

All 7 Replies

$query = "SELECT id, topic, event, date
FROM events ORDER BY 'id' DESC LIMIT 5";

Should be

$query = "SELECT id, topic, event, date
FROM events ORDER BY id DESC LIMIT 5";

Cheers,
Naveen

it still shows the ame error..
?????

im really getting annoyed by this bug...
can anyone help

when i placed the mysql_error() then it showed

Parse error: parse error, unexpected T_WHILE, expecting ',' or ';' in c:\phpdev5\www\intranet cga\sept 25th 2007\myclub\index.php on line 140

include("connect1.php");
$table = events;
$query = "SELECT id, topic, event, dateFROM events ORDER BY id DESC LIMIT 5";

$result=mysql_query($query);
//LINE 140 while (list($id, $topic, $event, $date) =mysql_fetch_array($result))
{
echo" <font color=\"#006600\">&nbsp;On ".substr($date,0,10)."</font>
<a href=\"$self?page=showevents&id=$id &topic=$topic \" class=\"elibtopic\">$topic</a>
";
}

Why do you need the stuff in red?

commented: lol..mote?Why on earth do you think I am mota! mote hogi tu. mera khoon ke peeche kyu padi hai makki ke thara! bali ka bakra ? haha!chal natak matt kar.Mirror pe apna chehra dhek..bakra kaun kudh pata chal jayega!If you slap me again,I ll kill you!:P +3
commented: Is nav stalking you? Creeeeeeepie. ^_^ +13

when i placed the mysql_error() then it showed

No. mysql_error() shows mysql related error. Can you post your full code ? May be you have a misplaced } .
And instead of

while (list($id, $topic, $event, $date) =mysql_fetch_array($result))

try this

while($row=mysql_fetch_array($result)){ $id=$row['id']; 
$topic=$row['topic'];
$event=$row['event'];
$date=$row['date'];
...

I am not sure if this ll work. If it doesn't, then please post your code.

Why do you need the stuff in red?

In php, if we want to echo something, its done like this. echo "Welcome...";

commented: "You don't have to" ..... give me a rep back whenever i give you one :P mote me tera khoooooon bahaadungiiiii baliiii ke bakre. AND, Slapping is fun. +4
commented: Boo is right, you take what she says toooo seriously. She was just being playful. Lighten up. +13
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.