[ciapug] PHP 5 and MySQLI

Carl Olsen carl-olsen at mchsi.com
Fri Feb 10 16:41:34 CST 2006


Hi Rick,

 

I generally do the free_result() and close() every time, just for good
practice.  As far as instantiating a class, I generally included the class
at the top of the page then instantiate it once.  I have instantiated a
class more than once before, but it's usually not necessary.  It doesn't
cause any harm to instantiate more than one instance of a class (it probably
causes more load, which may or may not be a significant factor).

 

I agree, mysqli is great.

 

Carl Olsen

 

  _____  

From: ciapug-bounces at cialug.org [mailto:ciapug-bounces at cialug.org] On Behalf
Of Wyatt, Rich
Sent: Friday, February 10, 2006 1:41 PM
To: ciapug at cialug.org
Subject: [ciapug] PHP 5 and MySQLI

 

Hello all. 

 

I recently built a new web server using PHP5 & MySQL 5.  For some reason or
another I couldn't get PHP to compile with both imagick and the standard
mysql library so I used the mysqli (MySQL Improved) config attribute and
have since read through the PHP manual about using this new class.  Very
cool.

 

However - I seem to be running into problems with page load.  Particularly
if, let's say, I go to the home page which has much MySQL.  If I hit refresh
- it bombs. Just sits and loads and loads and loads. 

 

Am I forgetting to $rslt->close(); a result somewhere or is this necessary
for every single result set?

 

I've created a mysqli instance in a file called begin.php.  $db = new
myslqi('host','uname','pword','dbname');  Can I use that $db->  everywhere
or do I need to keep re-instantiating the class every time in each new
script?

 

I'm just new to PHP 5 so if someone could give me some example code (other
than PHP.NET - while it is explanatory it only shows how to handle it for
one query. )

 

Any insights on anything that I might be missing or overlooking from the
perspective of one who is extremely familiar with the PHP4 "way of doing
things with mysql" vs how to do them now with PHP5 and the MySQLI way of
doing things.

 

 

Thanks,

 

Rich S. Wyatt

Webmaster / Deltek Vision Project Manager

Bloodgood Sharp Buster Architects and Planners, Inc.

Corporate-Des Moines

Office:  515.273.3020            Fax: 515.221.3272

 <http://www.bsbdesign.com/> www.bsbdesign.com 

National Experience, Regional Sensitivity

 

 

  _____  

NOTICE: This email (including attachments) is covered by the Electronic
Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be
legally privileged. If you are not the intended recipient, you are hereby
notified that any retention, dissemination, distribution, or copying of this
communication is strictly prohibited. Please reply to the sender that you
have received the message in error then delete it. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cialug.org/pipermail/ciapug/attachments/20060210/71669b64/attachment.html


More information about the ciapug mailing list