Page 1 of 1

PLEASE HELP

Posted: Mon Mar 31, 2008 5:13 pm
by gracie
I'm working on a auction site and added a search feature to it. I can get it to return a search result using the following statements -

Code: Select all

  $sqlString = "SELECT * FROM items WHERE name LIKE '%" . $search . "%' LIMIT $offset, $rowsPerPage";
   $sqlResult = mysql_query($sqlString);
   $searchnumrows = mysql_num_rows($sqlResult);
   
   $String = "SELECT * FROM items WHERE name LIKE '%" . $search . "%' ";
   $Result = mysql_query($String);
   $numrows = mysql_num_rows($Result);

I have a field in my 'items' table called dateends and i would like to return all the auction items that havent expired. I have tried the following statement and i get no result at all. i hope someone might be able to tell me i'm going wrong. Thanks.


Code: Select all

  $sqlString = "SELECT * FROM nam_items WHERE dateends > NOW() AND name LIKE '%" . $search . "%' LIMIT $offset, $rowsPerPage";
   $sqlResult = mysql_query($sqlString);
   $searchnumrows = mysql_num_rows($sqlResult);
   
   $String = "SELECT * FROM nam_items WHERE dateends > NOW() AND name LIKE '%" . $search . "%' ";
   $Result = mysql_query($String);
   $numrows = mysql_num_rows($Result);

Re: PLEASE HELP

Posted: Mon Mar 31, 2008 5:15 pm
by s.dot
Hi, to further help us help you, please edit your title to something descriptive, and put your code in BBCode [ CODE ] tags. I have edited your post to reflect how we would like it posted. :)

What type of field is dateends? Is it a timestamp or mysql datetime?