mob4u1
02-11-2008, 12:28 PM
Can anyone help? i have this code and it doesn't seem to work, i keep getting the error:
mysql_num_rows(): supplied argument is not a valid MySQL result resource
<?php
$failure='<li><strong><a href="#" target="_blank">ERROR...</a></strong></li>';
$query = 'SELECT users.username, date_format(pages.pubdate, "%d %b %Y") FROM users, pages where published=\'1\' ORDER BY pages.pubdate DESC LIMIT 0, 5';
@ $newest = mysql_query($query);
if( mysql_error() )
{ print($failure); }
$ile = mysql_num_rows($newest);
for($i=1; $i<=10 && $i<=$ile; $i++)
{
$wiersz=mysql_fetch_row($newest);
print('<li><span style="text-transform: capitalize;"><strong><a href="'.$URL.$wiersz[0].'" target="_blank">'.$wiersz[0].'</span><font size="1"> - ('.$wiersz[1].')</font></a></strong></li>');
}
?>
mysql_num_rows(): supplied argument is not a valid MySQL result resource
<?php
$failure='<li><strong><a href="#" target="_blank">ERROR...</a></strong></li>';
$query = 'SELECT users.username, date_format(pages.pubdate, "%d %b %Y") FROM users, pages where published=\'1\' ORDER BY pages.pubdate DESC LIMIT 0, 5';
@ $newest = mysql_query($query);
if( mysql_error() )
{ print($failure); }
$ile = mysql_num_rows($newest);
for($i=1; $i<=10 && $i<=$ile; $i++)
{
$wiersz=mysql_fetch_row($newest);
print('<li><span style="text-transform: capitalize;"><strong><a href="'.$URL.$wiersz[0].'" target="_blank">'.$wiersz[0].'</span><font size="1"> - ('.$wiersz[1].')</font></a></strong></li>');
}
?>