Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
| Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 3rd, 2006, 05:30 AM
Authorized User
 
Join Date: Apr 2006
Location: bikaner, raj, India.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to chayanvinayak
Default 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




Similar Threads
Thread Thread Starter Forum Replies Last Post
Execution Plan of a Query asuni SQL Server 2005 0 August 6th, 2008 03:42 AM
QUERY EXECUTION based on IF condition drani C# 0 November 9th, 2007 04:14 PM
Select query execution rashi Access VBA 4 November 2nd, 2007 08:50 AM
Slow Query Execution prasanta2expert SQL Language 1 November 30th, 2006 07:35 AM
Slow Query Execution prasanta2expert SQL Server 2000 1 November 28th, 2006 09:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.