Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP , SQL Connection And Recordset

Posted on 2008-06-12
9
Medium Priority
?
720 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 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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

598 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