Re: [PHP-DB] Sybase Query- Problems with Pound Sign

2003-08-14 Thread John W. Holmes
Jeremy Peterson wrote:

I am having a problem with a query that has a pound sign in it.  The 
results are quite puzzling, it seems like the page doesn't load if the 
query is present.  I have tested this on other tables without the pound 
sign and they work beautifully, seems like the pound sign is the 
troublemaker to me.
[snip]
$sql = "select * from item where bib# = 300";
The # character is generally used to start comments, so everything after 
it is ignored in your query. I'm surprised you could even name a column 
like that...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals – www.phparch.com





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Sybase Query- Problems with Pound Sign

2003-08-14 Thread Jeremy Peterson
I am having a problem with a query that has a pound sign in it.  The 
results are quite puzzling, it seems like the page doesn't load if the 
query is present.  I have tested this on other tables without the pound 
sign and they work beautifully, seems like the pound sign is the 
troublemaker to me.

Printing $sql returns the proper sql statement, so what is the sybase_query 
function doing to the variable?

My code is at the bottom of this page.

Thanks,

Jeremy




$syb_connect = syb_connect($syb_server, $syb_user, $syb_pw);

$sql = "select * from item where bib# = 300";
print "sql=$sql";
$result = sybase_query($sql);
//print "someting";
while($row = Sybase_Fetch_Assoc($result)){
extract($row);
print "$tag $text";
}

?>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Sybase Query- Problems with Pound Sign

2003-08-14 Thread Tiberiu Ardeleanu
Try:
$sql = "select * from item where \"bib#\" = 300";



- Original Message - 
From: "Jeremy Peterson" <[EMAIL PROTECTED]>
To: "PHP DB" <[EMAIL PROTECTED]>
Sent: Wednesday, August 06, 2003 4:34 AM
Subject: [PHP-DB] Sybase Query- Problems with Pound Sign


> I am having a problem with a query that has a pound sign in it.  The
> results are quite puzzling, it seems like the page doesn't load if the
> query is present.  I have tested this on other tables without the pound
> sign and they work beautifully, seems like the pound sign is the
> troublemaker to me.
>
> Printing $sql returns the proper sql statement, so what is the
sybase_query
> function doing to the variable?
>
> My code is at the bottom of this page.
>
> Thanks,
>
> Jeremy
>
>
>
>  include "$DOCUMENT_ROOT/include/sybase.inc";
>
> $syb_connect = syb_connect($syb_server, $syb_user, $syb_pw);
>
> $sql = "select * from item where bib# = 300";
> print "sql=$sql";
> $result = sybase_query($sql);
>
> //print "someting";
> while($row = Sybase_Fetch_Assoc($result)){
> extract($row);
> print "$tag $text";
>
> }
>
>
> ?>
>
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Sybase Query- Problems with Pound Sign

2003-08-06 Thread Jeremy Peterson
Yep, I wish I could name the fields, but alas it is not my database 
application.  For some reason it works...  :)

When I use isql it works as expected, thus the problem.

At 10:41 PM 8/5/2003 -0400, John W. Holmes wrote:
Jeremy Peterson wrote:

I am having a problem with a query that has a pound sign in it.  The 
results are quite puzzling, it seems like the page doesn't load if the 
query is present.  I have tested this on other tables without the pound 
sign and they work beautifully, seems like the pound sign is the 
troublemaker to me.
[snip]
$sql = "select * from item where bib# = 300";
The # character is generally used to start comments, so everything after 
it is ignored in your query. I'm surprised you could even name a column 
like that...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

PHP|Architect: A magazine for PHP Professionals ­ www.phparch.com





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php