• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 729
  • Last Modified:

PHP , SQL Connection And Recordset

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
tim_carter
Asked:
tim_carter
  • 5
  • 3
1 Solution
 
tim_carterAuthor Commented:
No one that has an idea to this? thanks
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
Steve BinkCommented:
>>> 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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
tim_carterAuthor Commented:
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
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>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
 
tim_carterAuthor Commented:
Thanks Angellll your the best
0
 
tim_carterAuthor Commented:
Angelll

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

Thanks
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
tim_carterAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now