Query problem(plz help)

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
cty007
Forum Newbie
Posts: 9
Joined: Thu Dec 14, 2006 11:15 pm

Query problem(plz help)

Post by cty007 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Error message:

Code: Select all

Query failed:You have an error in your SQL syntax.
 Check the manual that corresponds to your MySQL 
server version for the right syntax to use near ')' at line 1
Can any one able to edit it in correct form?(*I using PHP5)

Code: Select all

$query="select count(*) from cart where cookieId ='GetCartId()'
and bookid = '$bookid'";

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:3. Do not make multiple, identical posts. This is viewed as spam and will be deleted.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:1. Select the correct board for your query. Take some time to read the guidelines in the sticky topic.
Ignoring our request to not use aolspeak is not a good way to get started on this board. Trying to rack up the warnings early aren't you? :|


I don't see a syntax error in your query. Logical error, maybe, but no syntax errors.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Code: Select all

$query="select count(*) from cart where cookieId ='" . GetCartId() . "' and bookid = '$bookid'";
perhaps?
Post Reply