Solved

PHP , SQL Connection And Recordset

Posted on 2008-06-12
9
706 Views
Last Modified: 2013-12-13
Hi Guys

im having some problems with my intranet system that im trying to develop. My Problem is that the Database part in PHP crashes my IIS somehow. I cant se anything in the IIS log when it happens. the php.log doesnt say anything worth mentioning. What happens is that when you've used the intranet a little while, you cant talk to the database anylonger until you restart IIS. then it works perfectly again. Anyone have an idear what could cause this? Im running PHP 4 on IIS to an MS SQL Server

I also have some other questions..

1)
how come when i want to $rs->Close a recordset that just executes an insert or update statement that it says the object is allready closed? is that because you only have to do a $rs->Close on SELECT querys?

2)
if i do a select from a database $rs = $conn->execute($select), and then i want to do another select for something else  afterwords.. do i have to $rs->Close the first one before doing a $rs = $conn->execute($select) ? could that have something to do with my crash problem if im not doing that?

3)
Is there a way to see how many connections i have to my database server?

Thanks
0
Comment
Question by:tim_carter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 1

Author Comment

by:tim_carter
ID: 21777170
No one that has an idea to this? thanks
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 21782987
when you run a INSERT/UPDATE/DELETE, you won't get a recordset back, and actually should not expect a recordset.
you will get a empty/closed recordset indeed, as the error message tells.

so, for anything that is not a SELECT:
$rs = $conn->execute($select);
should be replaced by
$conn->execute($select);

or, $rs ignored.
0
 
LVL 51

Expert Comment

by:Steve Bink
ID: 21784221
>>> 3) Is there a way to see how many connections i have to my database server?

On the server, use this command:

mysqladmin processlist
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:tim_carter
ID: 21784878
Angelll. ahh because im not getting anything back i dont have to put a recordset into a var.. of course.. But can it cause performance problems to do so? i mean could that be a cause to my problem?

routinet : im running MSSQL how do i do it there?
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 21784889
>But can it cause performance problems to do so?
no

>2)
>if i do a select from a database $rs = $conn->execute($select), and then i want to do another select for something else  afterwords.. do i >have to $rs->Close the first one before doing a $rs = $conn->execute($select) ? could that have something to do with my crash problem if >im not doing that?

you should close a recordset (ie any object) once you used it, to clean up the resources.

3) Is there a way to see how many connections i have to my database server?
in ms sql sever:
select * from master.dbo.sysprocesses
0
 
LVL 1

Author Closing Comment

by:tim_carter
ID: 31467183
Thanks Angellll your the best
0
 
LVL 1

Author Comment

by:tim_carter
ID: 21785341
Angelll

I connect with ADODB SQL. is that the best way ? or would it be better to use mssql_connect in php?

Thanks
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 21785357
both ADODB and mssql have a object tier to access the database, ie both are just fine.
the ADODB is more for people coming from the VB world, the mssql.xxxx functions is more for the people coming from the mysql.xxxx functions worlds...
0
 
LVL 1

Author Comment

by:tim_carter
ID: 21791193
Thank you Angellll. I will continue using adodb. I just hope that i can find my error. Its really irritating that it crashes my IIS sometimes
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question