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 )

Recommended Answers

All 3 Replies

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.

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);

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);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.