Re: [PHP] Problem with mssql_query()
Richard Lynch wrote: PostgreSQL will simply throw an error, because '8' is not no way no how an INT. It's a string. Since when? test=# create table b(b int); CREATE TABLE test=# insert into b(b) values ('1'); INSERT 0 1 test=# SELECT * from b; b --- 1 (1 row) test=# select * from b where b='1'; b --- 1 (1 row) No idea about the OP's problem but that statement is just wrong :P -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with mssql_query()
I noticed the following in my logs: 22:04:42 [warning] [D:\PHP\pear\DB\mssql.php][439]: mssql_query(): Unable to set query 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][439]; function( mssql_query ); args( 1[value:select @@ERROR as ErrorCode] 2[value:Resource id #21] ) 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][489]; function( errornative ) 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][145]; function( mssqlraiseerror ) 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\common.php][1146]; function( simplequery ); args( 1[value:SELECT * FROM wording WHERE wording_id = '8' ] ) 22:04:42 [critical] Error in the following query:brbrSELECT * FROM wording WHERE wording_id = '8' brDB Error: unknown error 22:04:52 [warning] [D:\PHP\pear\DB\mssql.php][439]: mssql_query(): Unable to set query 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][439]; function( mssql_query ); args( 1[value:select @@ERROR as ErrorCode] 2[value:Resource id #21] ) 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][489]; function( errornative ) 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][145]; function( mssqlraiseerror ) 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\common.php][1146]; function( simplequery ); args( 1[value:SELECT * FROM wording WHERE wording_id = '8' ] ) 22:04:52 [critical] Error in the following query:brbrSELECT * FROM wording WHERE wording_id = '8' brDB Error: unknown error Why is mssql_query() saying that it's unable to set the query? I did some searching on Google and found that people were having this problem but that was back in 2001 using an earlier version of PHP. We are using version 4.3.11 and Microsoft SQL Server 2000 - 8.00.2039 (Intel X86). Has anyone had a similar problem? What was your solution? Why is this happening? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with mssql_query()
Post your block of code from your connection string (Leave out your username/password info please) to the end of the result set for your query so I can take a look at it. On 5/9/07, Chris Boget [EMAIL PROTECTED] wrote: I noticed the following in my logs: 22:04:42 [warning] [D:\PHP\pear\DB\mssql.php][439]: mssql_query(): Unable to set query 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][439]; function( mssql_query ); args( 1[value:select @@ERROR as ErrorCode] 2[value:Resource id #21] ) 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][489]; function( errornative ) 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][145]; function( mssqlraiseerror ) 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\common.php][1146]; function( simplequery ); args( 1[value:SELECT * FROM wording WHERE wording_id = '8' ] ) 22:04:42 [critical] Error in the following query:brbrSELECT * FROM wording WHERE wording_id = '8' brDB Error: unknown error 22:04:52 [warning] [D:\PHP\pear\DB\mssql.php][439]: mssql_query(): Unable to set query 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][439]; function( mssql_query ); args( 1[value:select @@ERROR as ErrorCode] 2[value:Resource id #21] ) 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][489]; function( errornative ) 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][145]; function( mssqlraiseerror ) 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\common.php][1146]; function( simplequery ); args( 1[value:SELECT * FROM wording WHERE wording_id = '8' ] ) 22:04:52 [critical] Error in the following query:brbrSELECT * FROM wording WHERE wording_id = '8' brDB Error: unknown error Why is mssql_query() saying that it's unable to set the query? I did some searching on Google and found that people were having this problem but that was back in 2001 using an earlier version of PHP. We are using version 4.3.11 and Microsoft SQL Server 2000 - 8.00.2039 (Intel X86). Has anyone had a similar problem? What was your solution? Why is this happening? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with mssql_query()
We use PEAR's DB class as our abstration layer. Here is the connection function from DB\mssql.php: function connect($dsninfo, $persistent = false) { if (!DB::assertExtension('mssql') !DB::assertExtension('sybase') !DB::assertExtension('sybase_ct')) { return $this-raiseError(DB_ERROR_EXTENSION_NOT_FOUND); } $this-dsn = $dsninfo; $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; $dbhost .= $dsninfo['port'] ? ',' . $dsninfo['port'] : ''; $connect_function = $persistent ? 'mssql_pconnect' : 'mssql_connect'; if ($dbhost $dsninfo['username'] $dsninfo['password']) { $conn = @$connect_function($dbhost, $dsninfo['username'], $dsninfo['password']); } elseif ($dbhost $dsninfo['username']) { $conn = @$connect_function($dbhost, $dsninfo['username']); } else { $conn = @$connect_function($dbhost); } if (!$conn) { return $this-raiseError(DB_ERROR_CONNECT_FAILED, null, null, null, @mssql_get_last_message()); } if ($dsninfo['database']) { if ([EMAIL PROTECTED]($dsninfo['database'], $conn)) { return $this-raiseError(DB_ERROR_NODBSELECTED, null, null, null, @mssql_get_last_message()); } $this-_db = $dsninfo['database']; } $this-connection = $conn; return DB_OK; } We use the DSN: mssql://UID:[EMAIL PROTECTED]/db_name. We are not using persistent connections. thnx, Chris From: Dan Shirah [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 09, 2007 11:07 AM To: Chris Boget Cc: PHP General Subject: Re: [PHP] Problem with mssql_query() Post your block of code from your connection string (Leave out your username/password info please) to the end of the result set for your query so I can take a look at it. On 5/9/07, Chris Boget [EMAIL PROTECTED] wrote: I noticed the following in my logs: 22:04:42 [warning] [D:\PHP\pear\DB\mssql.php][439]: mssql_query(): Unable to set query 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][439]; function( mssql_query ); args( 1[value:select @@ERROR as ErrorCode] 2[value:Resource id #21] ) 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][489]; function( errornative ) 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][145]; function( mssqlraiseerror ) 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\common.php][1146]; function( simplequery ); args( 1[value:SELECT * FROM wording WHERE wording_id = '8' ] ) 22:04:42 [critical] Error in the following query:brbrSELECT * FROM wording WHERE wording_id = '8' brDB Error: unknown error 22:04:52 [warning] [D:\PHP\pear\DB\mssql.php][439]: mssql_query(): Unable to set query 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][439]; function( mssql_query ); args( 1[value:select @@ERROR as ErrorCode] 2[value:Resource id #21] ) 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][489]; function( errornative ) 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][145]; function( mssqlraiseerror ) 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\common.php][1146]; function( simplequery ); args( 1[value:SELECT * FROM wording WHERE wording_id = '8' ] ) 22:04:52 [critical] Error in the following query:brbrSELECT * FROM wording WHERE wording_id = '8' brDB Error: unknown error Why is mssql_query() saying that it's unable to set the query? I did some searching on Google and found that people were having this problem but that was back in 2001 using an earlier version of PHP. We are using version 4.3.11 and Microsoft SQL Server 2000 - 8.00.2039 (Intel X86). Has anyone had a similar problem? What was your solution? Why is this happening? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with mssql_query()
I dunno 100% for sure about MSsql, but I know for sure that MySQL lets you do wording_id = '8' when wording_id is an INT and PostgreSQL will simply throw an error, because '8' is not no way no how an INT. It's a string. I suspect MS SQL may be doing the same, in its own unique bland non-desript way of just saying error... Try losing the '8' and use just 8 On Wed, May 9, 2007 8:57 am, Chris Boget wrote: I noticed the following in my logs: 22:04:42 [warning] [D:\PHP\pear\DB\mssql.php][439]: mssql_query(): Unable to set query 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][439]; function( mssql_query ); args( 1[value:select @@ERROR as ErrorCode] 2[value:Resource id #21] ) 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][489]; function( errornative ) 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][145]; function( mssqlraiseerror ) 22:04:42 [info] Backtrace: [D:\PHP\pear\DB\common.php][1146]; function( simplequery ); args( 1[value:SELECT * FROM wording WHERE wording_id = '8' ] ) 22:04:42 [critical] Error in the following query:brbrSELECT * FROM wording WHERE wording_id = '8' brDB Error: unknown error 22:04:52 [warning] [D:\PHP\pear\DB\mssql.php][439]: mssql_query(): Unable to set query 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][439]; function( mssql_query ); args( 1[value:select @@ERROR as ErrorCode] 2[value:Resource id #21] ) 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][489]; function( errornative ) 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\mssql.php][145]; function( mssqlraiseerror ) 22:04:52 [info] Backtrace: [D:\PHP\pear\DB\common.php][1146]; function( simplequery ); args( 1[value:SELECT * FROM wording WHERE wording_id = '8' ] ) 22:04:52 [critical] Error in the following query:brbrSELECT * FROM wording WHERE wording_id = '8' brDB Error: unknown error Why is mssql_query() saying that it's unable to set the query? I did some searching on Google and found that people were having this problem but that was back in 2001 using an earlier version of PHP. We are using version 4.3.11 and Microsoft SQL Server 2000 - 8.00.2039 (Intel X86). Has anyone had a similar problem? What was your solution? Why is this happening? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with mssql_query
On Tuesday 11 November 2003 23:07, bob pillford wrote: Hi all i have the following code which isnt working correctly and i cant work out why. Any help would be greatly appreciated as its sending me crazy! $query = select refno from campaign where appdate between 'nov 07 2003' and 'nov 08 2003' ; $result=mssql_query($query,$numero); $numrows=mssql_num_rows($result); $row=mssql_fetch_row($result); echo $numrows; print_r($row); Now this returns: 23 Array ( [0] = 1044998 ) which is 23 for number of rows the query returns but it only ever stores the 1st element of the returned array in $row.. Can someone tell me where i am going wrong as i need access to the other 22 rows that this query returns I have echoed the query and run the out put under freetds tsql and get the correct result (this is what i use to access the ms sql server 2000). mssql_fetch_row() only gets *one* row. To get the rest use something like a while-loop. For examples refer to the similar mysql_* functions. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* You will pay for your sins. If you have already paid, please disregard this message. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with mssql_query
Thanks! Cheers Bob --- Jason Wong [EMAIL PROTECTED] wrote: On Tuesday 11 November 2003 23:07, bob pillford wrote: Hi all i have the following code which isnt working correctly and i cant work out why. Any help would be greatly appreciated as its sending me crazy! $query = select refno from campaign where appdate between 'nov 07 2003' and 'nov 08 2003' ; $result=mssql_query($query,$numero); $numrows=mssql_num_rows($result); $row=mssql_fetch_row($result); echo $numrows; print_r($row); Now this returns: 23 Array ( [0] = 1044998 ) which is 23 for number of rows the query returns but it only ever stores the 1st element of the returned array in $row.. Can someone tell me where i am going wrong as i need access to the other 22 rows that this query returns I have echoed the query and run the out put under freetds tsql and get the correct result (this is what i use to access the ms sql server 2000). mssql_fetch_row() only gets *one* row. To get the rest use something like a while-loop. For examples refer to the similar mysql_* functions. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* You will pay for your sins. If you have already paid, please disregard this message. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://mail.messenger.yahoo.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with mssql_query
Hi all i have the following code which isnt working correctly and i cant work out why. Any help would be greatly appreciated as its sending me crazy! $query = select refno from campaign where appdate between 'nov 07 2003' and 'nov 08 2003' ; $result=mssql_query($query,$numero); $numrows=mssql_num_rows($result); $row=mssql_fetch_row($result); echo $numrows; print_r($row); Now this returns: 23 Array ( [0] = 1044998 ) which is 23 for number of rows the query returns but it only ever stores the 1st element of the returned array in $row.. Can someone tell me where i am going wrong as i need access to the other 22 rows that this query returns I have echoed the query and run the out put under freetds tsql and get the correct result (this is what i use to access the ms sql server 2000). Any help would be greatly appreciated.! Cheers Bob