RE: [PHP] MS SQL Problem
http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MS SQL Problem
I am trying to get a script to work to retrieve data from a MS SQL database. I also tried using a ODBC connection, but that didn't work either. Here is the error I get; Warning: MS SQL: Unable to connect to server: LocalServer in C:\WEBS\CTTechCouncil\stocks\mssql.php on line 7 DATABASE FAILED TO RESPOND. Here is what I have: 0) : print "Data:\n"; while ($i < $number) : $name = mssql_result($result,$i,"CompanyName"); print $name; print " "; $i++; endwhile; endif; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MS SQL Problem
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi there, I remember reading of a config setting in php.ini which lowered the time PHP waits before clearing up/closing the socket out. If it's a linux system you might want to try running netstat to see the open net connections. If you see lots of open connections when you reload the page a few times to your sql server then you know you need to shorten the appropiate timeouts. If you dont see lots of open connections then it's something unrelated to the actual virtual circuits opened. HTH, Dw. - - Original Message - From: "Justin Felker" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: May 31 2002 11:21 PM Subject: Re: [PHP] MS SQL Problem > Thanks for the reply. Actually, I am using both mssql_free_query > and mssql_close along with mssql_pconnect. It still happens > however. I can post the code if you are unsure. Does it have a > history of threading issues as it only seems to happen when > several requests are sent all at once or at least in very fast > succession. > > Justin > > > At 06:56 PM 5/31/2002 -0700, you wrote: > >Hiya, > >were you using the appropriate free_query & close functions to > >free up the memory & more importantly the socket used to talk to > >the sql server? > > > >You might want to try using the _pconnect function if it's > >available instead of the usual _connect statement. > > > >I'd guess that PHP ran out of sockets to make outbound connections > >with. Also, I believe that MSSQL is setup to only have around 1000 > >max connections open unless you alter the value in the config. > > > >HTH, > >Dw > > > > > >Sqlcoders.com Dynamic data driven web solutions > >- Original Message - > >From: "Justin Felker" <[EMAIL PROTECTED]> > >To: <[EMAIL PROTECTED]> > >Sent: May 31 2002 08:46 AM > >Subject: [PHP] MS SQL Problem > > > > > > > Last night, I ran into a problem when using the MS SQL support > > > in PHP > >under > > > Apache/PHP module/MS SQL 2000. Everything worked well enough. > > > I was able to connect to the server, query data, and a number > > > of other things. However, I found that if I ran my test page > > > (it connects to, queries and displays 20 rows of data, then > > > disconnects) over and over very quickly (hold CTRL+R down > > > basically) PHP would eventually (after about 6 seconds) fail to > > > connect to the MS SQL server. In fact, the web server would > > > have to be completely restarted before it could connect again. > > > > > > Has anyone run into this? I mean, if there is no solution to > > > this and is the cause of basically shaky MS SQL support, then > > > the SQL server would be made useless for sites with even a > > > modest amount of traffic (several requests per second). Is > > > this a known problem? If so, could anyone help me out? > > > > > > Thanks! > > > > > > Justin > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -BEGIN PGP SIGNATURE- Version: PGP Personal Privacy 6.5.8 iQA/AwUBPPljiNf2pW/GxlpVEQLy9wCg3tHovxdcVNthQvHyGY0brheJOqsAn28o yFtm2vp4juq7zFZcQy8G9Qfp =2jJv -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MS SQL Problem
Thanks for the reply. Actually, I am using both mssql_free_query and mssql_close along with mssql_pconnect. It still happens however. I can post the code if you are unsure. Does it have a history of threading issues as it only seems to happen when several requests are sent all at once or at least in very fast succession. Justin At 06:56 PM 5/31/2002 -0700, you wrote: >Hiya, >were you using the appropriate free_query & close functions to free up the >memory & more importantly the socket used to talk to the sql server? > >You might want to try using the _pconnect function if it's available instead >of the usual _connect statement. > >I'd guess that PHP ran out of sockets to make outbound connections with. >Also, I believe that MSSQL is setup to only have around 1000 max connections >open unless you alter the value in the config. > >HTH, >Dw > > >Sqlcoders.com Dynamic data driven web solutions >- Original Message - >From: "Justin Felker" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: May 31 2002 08:46 AM >Subject: [PHP] MS SQL Problem > > > > Last night, I ran into a problem when using the MS SQL support in PHP >under > > Apache/PHP module/MS SQL 2000. Everything worked well enough. I was able > > to connect to the server, query data, and a number of other > > things. However, I found that if I ran my test page (it connects to, > > queries and displays 20 rows of data, then disconnects) over and over very > > quickly (hold CTRL+R down basically) PHP would eventually (after about 6 > > seconds) fail to connect to the MS SQL server. In fact, the web server > > would have to be completely restarted before it could connect again. > > > > Has anyone run into this? I mean, if there is no solution to this and is > > the cause of basically shaky MS SQL support, then the SQL server would be > > made useless for sites with even a modest amount of traffic (several > > requests per second). Is this a known problem? If so, could anyone help > > me out? > > > > Thanks! > > > > Justin > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MS SQL Problem
Hiya, were you using the appropriate free_query & close functions to free up the memory & more importantly the socket used to talk to the sql server? You might want to try using the _pconnect function if it's available instead of the usual _connect statement. I'd guess that PHP ran out of sockets to make outbound connections with. Also, I believe that MSSQL is setup to only have around 1000 max connections open unless you alter the value in the config. HTH, Dw Sqlcoders.com Dynamic data driven web solutions - Original Message - From: "Justin Felker" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: May 31 2002 08:46 AM Subject: [PHP] MS SQL Problem > Last night, I ran into a problem when using the MS SQL support in PHP under > Apache/PHP module/MS SQL 2000. Everything worked well enough. I was able > to connect to the server, query data, and a number of other > things. However, I found that if I ran my test page (it connects to, > queries and displays 20 rows of data, then disconnects) over and over very > quickly (hold CTRL+R down basically) PHP would eventually (after about 6 > seconds) fail to connect to the MS SQL server. In fact, the web server > would have to be completely restarted before it could connect again. > > Has anyone run into this? I mean, if there is no solution to this and is > the cause of basically shaky MS SQL support, then the SQL server would be > made useless for sites with even a modest amount of traffic (several > requests per second). Is this a known problem? If so, could anyone help > me out? > > Thanks! > > Justin > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MS SQL Problem
Last night, I ran into a problem when using the MS SQL support in PHP under Apache/PHP module/MS SQL 2000. Everything worked well enough. I was able to connect to the server, query data, and a number of other things. However, I found that if I ran my test page (it connects to, queries and displays 20 rows of data, then disconnects) over and over very quickly (hold CTRL+R down basically) PHP would eventually (after about 6 seconds) fail to connect to the MS SQL server. In fact, the web server would have to be completely restarted before it could connect again. Has anyone run into this? I mean, if there is no solution to this and is the cause of basically shaky MS SQL support, then the SQL server would be made useless for sites with even a modest amount of traffic (several requests per second). Is this a known problem? If so, could anyone help me out? Thanks! Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MS SQL problem
On 29 Apr 2002 at 14:14, Joshua E Minnie wrote: > if(user_exists($dbname,"users","user",$user) > 0) { echo the variables to make sure they are what they should be. > function user_exists($dbname, $table, $field, $value) { echo the variables to make sure they are what they should be. > $query = "SELECT $field FROM $table WHERE $field = '$value'"; echo your select to make sure it looks like it should. > $rows = mssql_num_rows($result); echo the result to make sure it looks like it should. Doing the above will probably find your problem for you. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MS SQL problem
I am relatively new to the SQL aspect of PHP. I have a small background in SQL programming, so I can get my way around that part. The problem I am having is that a query of mine is throwing back zero (0) rows of result. I am using some simple SQL syntax to check for the existance of a user in a db (i.e. SELECT $field FROM $table WHERE $field = '$value'). Now I am testing the script and I am trying to add a user twice, which should in theory throw an error and not allow the user to be added a second time. Here is the function that I created in which my errors are. It may just be a simple problem with my logic. I have checked the manual and a lot of other PHP and SQL resources. I am running PHP 4.1.2 binary on windows connecting to MS SQL Server 2000. 0) { echo "User name already taken, please choose another."; } else { $query = "INSERT INTO users VALUES ('$first','$last','$user','$pass','$perms')"; $result = mssql_query($query) or die("Unable to add user"); echo "User successfully added.\n"; } ... ?> -function- "); $rows = mssql_num_rows($result); echo "Query returned $rows row(s) of data.\n"; return $rows; } ?> Any help that anyone can provide would be a big help. Thanks in advance. -- Joshua E Minnie/CIO [EMAIL PROTECTED] Phone: 616.276.9690 Fax: 616.342.8750 Nextel: 616.862.2847 "Don't work for recognition, but always do work worthy of recognition." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php