Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Your Custom Libraries
Old 08-11-2004, 01:04 PM Your Custom Libraries
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
What kind of library have you built yourself? Or even that others have created that you use often in your projects.

I use a couple of classes made by Chroder in almost all of my scripts. A mysql class and a template class.

Are any of yours worth sharing with the community?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-11-2004, 01:29 PM
webwoRRks's Avatar
Ultra Talker

Posts: 426
Location: I hope so
Trades: 0
very rarely use classes (tsk). Got some useful functions... Why would you need a MySQL class? just outta interest
__________________
Theres 10 types of people; those who understand binary, and those who don't.
webmaster and webdeveloper resources,
Please login or register to view this content. Registration is FREE
webwoRRks is offline
Reply With Quote
View Public Profile Visit webwoRRks's homepage!
 
Old 08-11-2004, 06:08 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
The way this class is setup it cuts my mysql coding in about half. Here is an example...
PHP Code:
$db = new Database('host','user','pass','db','persistent'); //persistent is normally a true or false value 1 or 0.
$db->query('SELECT * FROM mytable');
while(
$res $db->fetch()) {
  echo 
$res['sample']."<br />";

Each time I call $db->fetch() it will contain the results in an array from the last $db->query().
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 06:15 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
The ones I find most useful are the fetchAll and fetchAllKey. I love those babies
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 06:24 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
Cap is using one method, you can also use the other way and handle all your own resource IDs

Code:
$myquery = $db->query('sql');
while($res = $db->fetch($myquery))
...
Just makes it easier when the class handles everything on it's own.
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 06:33 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
I haven't found much use for fetchAllKey in my scripts yet.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 06:36 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
If you ever have a table that holds all your script options (say you have like 40 options for various things from Site Title to default skin etc), you can fetch them all in one go.

PHP Code:
$options $DB->fetchAllKey("SELECT value FROM options"'name');

// $options['site_title'], $options['default_skin'] etc 
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 07:00 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Thats nifty, I will remember that one.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 10:53 PM
JasonMichael's Avatar
Novice Talker

Posts: 13
Trades: 0
That MySQL class looks extremely familiar. There's a mysql class that uses almost exact code like that, at www.tapinternet.com, where they are using it in some code they call their own - their Data Business Objects (DBO). Check it out.

I use their MySQL class for my Content Management System. I should probalby try writing my own, eventually, but theirs is working great for me.

Jason
JasonMichael is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 11:38 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
It probably looks familiar because these methods are the most efficient aproach, IMHO at least.

One class that I absolutely love, and its generalized but I use it often, is Snoopy.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 08-11-2004, 11:45 PM
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
Snoopy -- that's what I was looking for the other day! I remembered you liked one of those types of scripts, but I forgot the name of it.

Quote:
That MySQL class looks extremely familiar. There's a mysql class that uses almost exact code like that, at www.tapinternet.com, where they are using it in some code they call their own - their Data Business Objects (DBO). Check it out.
Most DB classes have methods for query, fetch and fetchrow/fetchone. Other then that, they differ. As to DBO -- I can't find it, where do I download it?
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 08-12-2004, 07:45 AM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
I could not find it either.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 08-12-2004, 08:52 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
ADODB (database class) probably the best one out there, Xtemplate (templating), phpMailer. Plus 15 or so other classes that are home built.

As the site I work on at the moment is extensively OO I have numerous classes that are extended depending on all sorts of things.

Been years since I was function based, a bit less since i used to mix html and php in the same script (shudder the though of debugging that stuff now). In fact its that bad a memory I overlook posts that have code mixed with html.

The ones i cannot live without are not mine, they are AdoDB and Xtemplate.

Ibbo
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Old 08-12-2004, 09:05 AM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
I tend to skip over some of the longer posts with mixed php and html. I used to be so against templates, until I actually used them seriously. Now I could not do any project without templates.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Your Custom Libraries
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.43891 seconds with 12 queries