Reputation: 1011
I realise this is probably an absolutely horrible way to do a query, and of course its not working. The point of it is to select users based on a date range and a keyword.
$query = mysql_query("SELECT * FROM my_users WHERE my_regdate BETWEEN '$ftimestamp' AND '$ttimestamp' AND my_username LIKE '%$trimmed%' OR my_realname LIKE '%$trimmed%' OR my_email LIKE '%$trimmed%' ORDER BY my_id");
Upvotes: 0
Views: 146
Reputation: 745
Use mysql_error() to print the error.
$query ="SELECT * FROM my_users WHERE my_regdate BETWEEN '$ftimestamp' AND '$ttimestamp' AND my_username LIKE '%$trimmed%' OR my_realname LIKE '%$trimmed%' OR my_email LIKE '%$trimmed%' ORDER BY my_id";
$res= mysql_query($query) or die(mysql_error());
Upvotes: 0
Reputation: 26749
You are missing the brackets in the query
$query = mysql_query("SELECT * FROM my_users WHERE my_regdate BETWEEN '$ftimestamp' AND '$ttimestamp' AND (my_username LIKE '%$trimmed%' OR my_realname LIKE '%$trimmed%' OR my_email LIKE '%$trimmed%') ORDER BY my_id");
Upvotes: 1