homepage Welcome to WebmasterWorld Guest from 54.204.94.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
ActiveRecord for PHP5
httpwebwitch




msg:3940215
 1:41 pm on Jun 25, 2009 (gmt 0)

Hey
have any of you used "ActiveRecord" in PHP?

There are a few bloggerware ones out there, and I'm wondering which one I should try.

the example I was given is:

before - in PHP
$result = mysql_query("SELECT * FROM tablename WHERE id = 5");

after - in ActiveRecord
$result = $this->db->get_where('tablename', array('id' => 5))

To me this seems like a good thing, expecially if it has built-in parameterization to prevent SQL injection (which I do manually now, and it's a major PITA)

 

FourDegreez




msg:3940339
 4:07 pm on Jun 25, 2009 (gmt 0)

I haven't used that, but I have used other database access abstractions that separate you from the actual SQL. In my experience, you'll always find cases where you can't execute the query you'd like so you'll have to do a work-around. Have you considered using PDO?

nick279




msg:3940867
 12:09 pm on Jun 26, 2009 (gmt 0)

If you are reading then OK, but if you are writing make sure it supports a decent, easy to use write method

e.g. $this->db->update($_POST)

or something similar

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved