0

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

Edited by happygeek: fixed formatting

3
Contributors
7
Replies
8
Views
9 Years
Discussion Span
Last Post by nav33n
0

$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

0

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

2

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?

Votes + Comments
Is nav stalking you? Creeeeeeepie. ^_^
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
0

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.

2

Why do you need the stuff in red?

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

Votes + Comments
Boo is right, you take what she says toooo seriously. She was just being playful. Lighten up.
"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.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.