Re: "Where" Error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You don't say which DBMS your using or what the specific error message (sometimes they are helpful - although sometimes useless) is but I think what your after is:

where status = 'i'

Notice that you must quote the values for string or characters. Try this on your DBMS's command line (no web or PHP) this might give you better error messages and it takes all of the other variables out of it. Then be careful when you build your query to use different quotes:

Like this:

$myQuery = "select * from foo where status = 'i' ";

Not this:

$myQuery = "select * from foo where status = "i"";

One last note - if you build your query in different strings be sure to leave white space between the strings:

Like this:
    $myQuery = "select * from foo ";
    $myQuery =  $myQuery =" where status = 'i'  ";
    $myQuery =  $myQuery =" order by ... ";

Good Luck,
Frank

On May 29, 2004, at 7:36 AM, php-db-digest-help@xxxxxxxxxxxxx wrote:

From: kc68@xxxxxxxxxxx
Date: May 29, 2004 7:35:40 AM PDT
To: "php-db@xxxxxxxxxxxxx" <php-db@xxxxxxxxxxxxx>
Subject: "Where" Error


This should be ultimately simple; it just doesn't work. I want to limit display to rows from a single table in which the status column contains i. Only options are i, c, o. After the select line I have "where status = i" (no quote marks). I get an error message to the "while" line that calls the table.


When I limit by another column "where netreceipts > 500" I get the desired result. When I change it to "where netreceipts = 500" (and there is a 500) I get the error message above.

What's the solution?

Ken


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux