0

Hello guys ! i find this place really helpfull for developers (ow really ? lmao) ok here i made an mysql query that looks like this ;

$result = mysql_query("SELECT id,title,description,data,author,mini_img,view FROM data WHERE data>'$data_begin' AND data<'$data_end'",$db);

i checked for missplaing and nothing ... i have doubs about data(its the date) and data for the name of table .. i made some queries before that involved them both and no problem but here . the $data_begin and $data_end have ****-**-** form just like in the table . Please help )

4
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by dasatti
0

try this:

$result = mysql_query("SELECT id,title,description,data,author,mini_img,view FROM data WHERE data>'$data_begin' AND data<'$data_end'",$db) or die( 'Error: ' . mysql_error());

and tell us what is returned. you can solve many simple sql problems that way.

0

Have you tried:

$result = mysql_query("SELECT id,title,description,data,author,mini_img,view FROM data WHERE data BETWEEN '$data_begin' AND '$data_end'", $db);
0

What I understood is that `data` is the date field in your table. If it is so use following query

$result = mysql_query("SELECT id,title,description,data,author,mini_img,view FROM data WHERE DATEDIFF(data,'$data_begin')>0 AND DATEDIFF(data,'$data_end')<0",$db);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.