Jump to content

[SOLVED] Query NOT working


zed420

Recommended Posts

Hi All

Can someone please tell me what am I doing wrong in this query??? Its not giving me anything? total blank, there is diffinatley data in this table on different dates.

Many thanks

Zed

$query = "SELECT * FROM booking WHERE request_date = '$request_date'";

Full code

$day = $_GET['day'];
$cMonth = $_GET['cMonth'];
$cYear = $_GET['cYear'];
$today = time();
$request_date = mktime(0,0,0,$cMonth,$day+1,$cYear)-1; //add 1 day subtract 1 second 
if($today > $request_date)
{
echo "<font color=red>Error, Post date for Booking any lessons.
Please choose the avialable date from tomorrow.  </font>"; // post date
}else{

.....(I took some code out from here)
$query = "SELECT * FROM booking WHERE request_date = '$request_date'";
$result = mysql_query($query)or die(mysql_error());
    while ($row = mysql_fetch_array($result))  {
    extract($row);
    echo " 
	".$row['request_date']."
	".$row['s_time']."
	".$row['e_time']."
";
   }

Link to comment
https://forums.phpfreaks.com/topic/171453-solved-query-not-working/
Share on other sites

So it looks like your variable $request_date has a value of 1251586799.

 

The query is working. I normally store my dates in the 0000-00-00 format and don't know alot about other formats for storing them, but that is a strange looking value to me. There may be an issue with how your variable is created here:

$request_date = mktime(0,0,0,$cMonth,$day+1,$cYear)-1; //add 1 day subtract 1 second 

 

I am not expert on date/time, but that is where I would look.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.