Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.