?
Solved

PHP , SQL Connection And Recordset

Posted on 2008-06-12
9
Medium Priority
?
711 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
7 Extremely Useful Linux Commands for Beginners

Just getting started with Linux? Here's a quick start guide that has 7 commands that we believe will come in handy.

 
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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
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 …
Suggested Courses

771 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