Query execution error
i have used following code, i am passing $comparision as after,at,before. according to which query will be executed.
if $comparision is after query will be : select....where date <..
if $comparision is at query will be : select....where date =..
if $comparision is before query will be : select....where date >..
but it is not executing query.it is giving problem at highlighted code.
<?php
mysql_connect("localhost","xxx","xxx") or die ("can not connect :".mysql_error());
mysql_select_db("game_accounts") or die ("can not connect to database :".mysql_error());
...
.
.
$userid = $_GET['userid'];
$activity = $_GET['activity'];
$y = $_GET['y'];
$m = $_GET['m'];
$d = $_GET['d'];
$date = date("Y-m-d", mktime(0, 0, 0, date($m) , date($d), date($y) ) ) ;
if($_GET['comparision']=='after')
$comparision = ">";
if($_GET['comparision']=='at')
$comparision = "=";
if($_GET['comparision']=='before')
$comparision = "<";
$result = mysql_query("SELECT * FROM userlogs WHERE userid = '$userid' AND date'$comparision' '$date'AND activity ='$activity' ") or die("can not execute query:".mysql_error());
....
...
..
?>
chayan vinayak goswami
__________________
chayan vinayak goswami
|