Jump to content

Query problem - most likely simple


defroster

Recommended Posts

A bit troubled, any input would be much appreciated

 

This works fine:

$query = "SELECT COUNT(*) as num FROM $tbl_name WHERE videos.cat_id =" . $_GET['cat'] . " AND videos.status ='1'";

 

And this doesn't.. Any ideas why? What am I doing wrong.

$query = "SELECT COUNT(*) as num FROM $tbl_name WHERE videos.cat_id =" . $_GET['cat'] . " AND videos.status ='1' AND videos.dateposted <= now()";

Link to comment
https://forums.phpfreaks.com/topic/211832-query-problem-most-likely-simple/
Share on other sites

Thanks for quick reply. I get this error:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/cat.php on line 247

Line 247

$total_pages = mysql_fetch_array(mysql_query($query));

 

A bit of all the code:

$query = "SELECT COUNT(*) as num FROM $tbl_name WHERE videos.cat_id =" . $_GET['cat'] . " AND videos.status ='1' AND videos.dateposted <= now()";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];

You are absolutely correct PFMaBiSmAd.

 

I see your signature says the same:

Debugging step #1: To get past the garbage-out equals garbage-in stage in your code, you must check that the inputs to your code are what you expect.

 

Thanks and good night,

df

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.