Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:00 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.