im new to php and mysql and im trying to get some info between two dates im using the following code which isnt working very well for me.
<?php
require_once('db_connect.php');
// connect to db
$conn = db_connect();
$sql='SELECT * FROM user_data' WHERE user_date BETWEEN '2007-10-10' AND '2007-11-11';
$result = mysqli_query($conn,$sql);
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
echo $row['user_anchor'].' : '.$row['user_client']."<br>";
}
?>
I have this script working for me with another query so all I changed in the above is this line
$sql='SELECT * FROM user_data' WHERE user_date BETWEEN '2007-10-10' AND '2007-11-11';
to try and get results in between two dates. have i done it totally wrong?
could any suggest how I could get a row/list of all there information from todays date(meaning on any day someone looks at my webpage) they can select a back date, say 1,2,3 ,4 weeks ago (or an exact date) and they would get a list of information from whatever date back they choose from. I would need the form advice on this also.
I think that
thanks in advance for any replies