Jump to content

MySQL Query


craigory83

Recommended Posts

Hello!  First post.  I am trying to code out a news website (kinda)  I can't seem to fetch the news articles out of SQL.  What am I doing wrong?

 

(start is fetched by $_REQUEST.  Assume it is 1)

$end=$start+5;

$stories = mysql_query("SELECT * FROM 'stories' DESC ORDER BY id LIMIT $start, $end");

$num = mysql_num_rows($stories);

print $num;

Link to comment
https://forums.phpfreaks.com/topic/231243-mysql-query/
Share on other sites

$end=$start+5;
$stories = mysql_query("SELECT * FROM stories ORDER BY id DESC LIMIT $start, $end") or die(mysql_error());
$num = mysql_num_rows($stories);
print $num;

 

hint* Use or die mysql_error() to print any errors that are within your query.

Give that a go and let me know if it works

Link to comment
https://forums.phpfreaks.com/topic/231243-mysql-query/#findComment-1190166
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.