budimir Posted August 5, 2008 Share Posted August 5, 2008 Hey guys, I have this peace of code and it works except one thing for which I can't figure out how to do, so I need your help: <?php $datum_od = date("Y-m-d",mktime(0,0,0,($_GET["timestamp"]))); //echo "Od - $datum_od<br>"; $datum_do = date("Y-m-d",mktime(0,0,0,($_GET["timestamp1"]))); //echo "Do - $datum_do"; if (isset($where)) unset($where); if ($HTTP_GET_VARS["korisnik"]) $where[] = " upisao='".$HTTP_GET_VARS["korisnik"]."' "; if ($HTTP_GET_VARS["datum_od"]) $where[] = " datum='".$datum_od."' "; if ($HTTP_GET_VARS["datum_do"]) $where[] = " datum='".$datum_do."' "; if (is_array($where)) $addToSql = " WHERE ".implode(" AND ", $where); $upit = "SELECT * FROM obilasci ".$addToSql." $limit"; $rezultat = mysql_query($upit); $broj = mysql_num_rows($rezultat); while ($row = mysql_fetch_array($rezultat)){ while(list($key,$val) = each($row)){ if (is_int($key)) continue; $GLOBALS[$key] = $val; } } ?> So, I want the query to search between $datum_od and $datum_do! How to do that?? Link to comment https://forums.phpfreaks.com/topic/118321-solved-search-between/ Share on other sites More sharing options...
Third_Degree Posted August 5, 2008 Share Posted August 5, 2008 http://www.w3schools.com/Sql/sql_between.asp Link to comment https://forums.phpfreaks.com/topic/118321-solved-search-between/#findComment-608893 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.