0
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mandarin/public_html/wyandotte/includes/flash_functions/events.php on line 7

I have no idea how to fix this. Here is the code I use

<?php
//calls on the database to display the results of my Events query.  This will show us what's happening lately
require(DIR_INCLUDES . 'app_top.php');

$qresult = mysql_query ("SELECT * FROM events ORDER BY event_id DESC");

$nrows = mysql_num_rows($qresult);
$rstring ="&n=".$nrows;


for ($i=0; $i< $nrows; $i++){
    $row = mysql_fetch_array($qresult);
    $rstring .="&id".$i."=".$row['event_id']."&"."&title".$i."=".$row['event_title']."&"."&date".$i."=".$row['event_date']."&"."&entry".$i."=".$row['event_post']."&";
}
echo $rstring."&";

?>

my app_top file is simple enough, it calls the config file for connection to the database. What am I doing wrong?

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by Gary King
0

You could use the COUNT function that exists in MySQL instead.

$count = mysql_query ("SELECT COUNT(*) AS count FROM events ORDER BY event_id DESC");

$count = $count['count'];

// $count now contains # of rows
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.