Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 9th March 2011, 11:10
rodobrist rodobrist is offline
Member
 
Join Date: Sep 2010
Posts: 30
Thanks: 10
Thanked 2 Times in 2 Posts
 
Default is this news to anybody else? (Mysqli OOP is same as procedural)

Hi all,
I was experimenting with the differences between using a mysqli resource ie:

"procedural":
PHP Code:
$handle=mysqli_connect('localhost','usr','pass','DBNAME');
$result=mysqli_query($handle,SELECT FROM tablename); 
"OOP":
PHP Code:
$dbc= new MySQLi('localhost','usr','pass','DBNAME');
$result=$dbc->query($handle,SELECT FROM tablename); 
nothing fancy here, but what really surprised me was this:

"procedural":
PHP Code:
$handle=mysqli_connect('localhost','usr','pass','DBNAME');
$result=$handle->query($handle,SELECT FROM tablename); 
"OOP":
PHP Code:
$dbc= new MySQLi('localhost','usr','pass','DBNAME');
$result=$mysqli_query($dbc,SELECT FROM tablename); 
hopefully you can all see what i am getting at. Maybe you all knew this but I thought there was a distinct difference between a handle/resource (which i think are the same in php) and an Object and I'm pretty sure i read that mysqli_connect returns a resource.

I double checked the manual, and mysql_connect returns a resource, whereas mysqli_connect returns an object.

thought this was worth sharing

Last edited by rodobrist; 9th March 2011 at 11:13.
Reply With Quote
Sponsored Links
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Technology News Tab dipeshmehta Smalltalk 5 2nd August 2010 11:41


All times are GMT +2. The time now is 16:29.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.