same sql different result (sybase)
| From: | Ryan Betts | Date: | Wed, 25 Aug 1999 19:43:22 +0000 |
| Subject: | same sql different result (sybase) | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-3729@lists.php.net to get a copy of this message | ||
I am new to both php and to this list. If this is the incorrect forum
- please let me now -- and my apologies!
Using PHP-4 b2. linked with apache on a sun..
$db_auto = sybase_connect("MYDB", "sa", "superbase"
sybase_select_db("automation",$db_auto);
// the following two lines produce different output
// Entry_Date is a column name.
$sql_a = "select * from Status where datepart(month,Entry_Date)=8 and
User_ID=$sitgroup_row[user_id]";
$sql_b = "select * from Status where User_ID=$sitgroup_row[user_id] and
datepart(month,Entry_Date)=8";
$qry = sybase_query($sql_a,$db_auto);
while ($status_row = sybase_fetch_array($qry)) { ... } etc.
$sql_a works correctly -- it returns records where the 'and' is true.
$sql_b returns all records matching $sitgroup_row[user_id] but ignores
the datepart(month,Entry_Date) condition. Attempting to use parentheses
around the $sitgroup_row[user_id] clause seems to cause php to create /
caste to a float, which then creates a sql error.
My questions then:
Were one to assign blame, would it fall on me, php or sybase?
Is there a list of established php4 bugs? I suppose the answer to this
question exists in a faq somewhere.. but I have not succesfully found
it..
Thank you!
*--Ryan.
rbetts@casc.com