wpdb Outside of WordPress

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

wpdb Outside of WordPress

CloudPress Hosting
I have a non WordPress project where I do need to connect to a mysql
database. I am so used to the wpdb syntax and it is so much easier than
using just the native php functions I want to use it outside of WordPress.
I know it is based on ezSQL but sadly I don't see any prepare method in
that that wpdb has.

So I was just going to re-purpose wpdb for non WordPress use which would
include removing all the WordPress specific stuff from it and just thought
I'd see if someone already has done this.
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: wpdb Outside of WordPress

Brad Parbs
You could always check out B (http://backpress.org/)ackPress, adds a bunch of WordPress stuff as just PHP libraries.

On Friday, November 16, 2012 at 2:04 PM, CloudPress Hosting wrote:

> I have a non WordPress project where I do need to connect to a mysql
> database. I am so used to the wpdb syntax and it is so much easier than
> using just the native php functions I want to use it outside of WordPress.
> I know it is based on ezSQL but sadly I don't see any prepare method in
> that that wpdb has.
>
> So I was just going to re-purpose wpdb for non WordPress use which would
> include removing all the WordPress specific stuff from it and just thought
> I'd see if someone already has done this.
> _______________________________________________
> wp-hackers mailing list
> [hidden email] (mailto:[hidden email])
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>


_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: wpdb Outside of WordPress

Thomas Belknap
Ok, so does Backpress stay current with Wordpress? If I was looking, for
example, to load this as a vendor to a CakePHP project, would I be correct
in thinking I could pull WP data more or less in the same manner as the
current version of WP?
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: wpdb Outside of WordPress

Brad Parbs
Not sure at all, I haven't ever used it. I'd say pull it down via svn, play around with it.

--
Brad Parbs
http://BradParbs.com
@bradparbs


On Friday, November 16, 2012 at 2:16 PM, Thomas Belknap wrote:

> Ok, so does Backpress stay current with Wordpress? If I was looking, for
> example, to load this as a vendor to a CakePHP project, would I be correct
> in thinking I could pull WP data more or less in the same manner as the
> current version of WP?
> _______________________________________________
> wp-hackers mailing list
> [hidden email] (mailto:[hidden email])
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>


_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: wpdb Outside of WordPress

scribu-2
Note that there's an object-oriented MySQL abstraction built right into
PHP, called PDO.

Here's just one of many articles that describes the advantages of PDO:
http://net.tutsplus.com/tutorials/php/pdo-vs-mysqli-which-should-you-use/
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: wpdb Outside of WordPress

David F. Carr-2
I've often created standalone PHP scripts, for example to be used with cron
job, that simply include "/pathto/wp-config.php" and then make use of the
$wpdb object.

Standard disclaimers apply about security concerns / protecting your
database.

On Fri, Nov 16, 2012 at 4:54 PM, scribu <[hidden email]> wrote:

> Note that there's an object-oriented MySQL abstraction built right into
> PHP, called PDO.
>
> Here's just one of many articles that describes the advantages of PDO:
> http://net.tutsplus.com/tutorials/php/pdo-vs-mysqli-which-should-you-use/
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



--
David F. Carr
Writer, Editor, Web Consultant
[hidden email]
http://www.carrcommunications.com/

Editor, The BrainYard http://www.informationweek.com/thebrainyard
LinkedIn - http://www.linkedin.com/in/davidfcarr
Facebook - http://www.facebook.com/carrcomm
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: wpdb Outside of WordPress

CloudPress Hosting
I normally just use mysqli but for consistency since I am used to wpdb when
working with WordPress figured I could use it outside of WordPress as well.

On Fri, Nov 16, 2012 at 1:54 PM, scribu <[hidden email]> wrote:

> Note that there's an object-oriented MySQL abstraction built right into
> PHP, called PDO.
>
> Here's just one of many articles that describes the advantages of PDO:
> http://net.tutsplus.com/tutorials/php/pdo-vs-mysqli-which-should-you-use/
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
Seems like overkill to load up a whole instance of WordPress just to access
a database. Shouldn't take much modification to the wpdb class to remove
the WordPress specific stuff and you can use it directly. It should be
possible to use it as is I believe I would just clean it up a little by
removing the WordPress specific stuff.

On Fri, Nov 16, 2012 at 2:07 PM, David F. Carr <[hidden email]
> wrote:

> I've often created standalone PHP scripts, for example to be used with cron
> job, that simply include "/pathto/wp-config.php" and then make use of the
> $wpdb object.
>
> Standard disclaimers apply about security concerns / protecting your
> database.
>
> On Fri, Nov 16, 2012 at 4:54 PM, scribu <[hidden email]> wrote:
>
> > Note that there's an object-oriented MySQL abstraction built right into
> > PHP, called PDO.
> >
> > Here's just one of many articles that describes the advantages of PDO:
> >
> http://net.tutsplus.com/tutorials/php/pdo-vs-mysqli-which-should-you-use/
> > _______________________________________________
> > wp-hackers mailing list
> > [hidden email]
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
>
>
>
> --
> David F. Carr
> Writer, Editor, Web Consultant
> [hidden email]
> http://www.carrcommunications.com/
>
> Editor, The BrainYard http://www.informationweek.com/thebrainyard
> LinkedIn - http://www.linkedin.com/in/davidfcarr
> Facebook - http://www.facebook.com/carrcomm
> _______________________________________________
> wp-hackers mailing list
> [hidden email]
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers
Reply | Threaded
Open this post in threaded view
|

Re: wpdb Outside of WordPress

Scott Taylor
wpdb is based on: https://github.com/jv2222/ezSQL

Those who work on WP core want to make wpdb work well for WordPress, not make a one-size-fits-all solution for all PHP environments. But there's nothing stopping anyone else (you) from doing that, and others would probably appreciate it

--
scott taylor
musician / software engineer
160 west end ave #2H
new york, ny 10023
m 646.715.7347
twitter: wonderboymusic
web: scotty-t.com


On Friday, November 16, 2012 at 6:21 PM, CloudPress Hosting wrote:

> I normally just use mysqli but for consistency since I am used to wpdb when
> working with WordPress figured I could use it outside of WordPress as well.
>
> On Fri, Nov 16, 2012 at 1:54 PM, scribu <[hidden email] (mailto:[hidden email])> wrote:
>
> > Note that there's an object-oriented MySQL abstraction built right into
> > PHP, called PDO.
> >
> > Here's just one of many articles that describes the advantages of PDO:
> > http://net.tutsplus.com/tutorials/php/pdo-vs-mysqli-which-should-you-use/
> > _______________________________________________
> > wp-hackers mailing list
> > [hidden email] (mailto:[hidden email])
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
>
> Seems like overkill to load up a whole instance of WordPress just to access
> a database. Shouldn't take much modification to the wpdb class to remove
> the WordPress specific stuff and you can use it directly. It should be
> possible to use it as is I believe I would just clean it up a little by
> removing the WordPress specific stuff.
>
> On Fri, Nov 16, 2012 at 2:07 PM, David F. Carr <[hidden email] (mailto:[hidden email])
> > wrote:
>
>
> > I've often created standalone PHP scripts, for example to be used with cron
> > job, that simply include "/pathto/wp-config.php" and then make use of the
> > $wpdb object.
> >
> > Standard disclaimers apply about security concerns / protecting your
> > database.
> >
> > On Fri, Nov 16, 2012 at 4:54 PM, scribu <[hidden email] (mailto:[hidden email])> wrote:
> >
> > > Note that there's an object-oriented MySQL abstraction built right into
> > > PHP, called PDO.
> > >
> > > Here's just one of many articles that describes the advantages of PDO:
> > http://net.tutsplus.com/tutorials/php/pdo-vs-mysqli-which-should-you-use/
> > > _______________________________________________
> > > wp-hackers mailing list
> > > [hidden email] (mailto:[hidden email])
> > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > >
> >
> >
> >
> >
> > --
> > David F. Carr
> > Writer, Editor, Web Consultant
> > [hidden email] (mailto:[hidden email])
> > http://www.carrcommunications.com/
> >
> > Editor, The BrainYard http://www.informationweek.com/thebrainyard
> > LinkedIn - http://www.linkedin.com/in/davidfcarr
> > Facebook - http://www.facebook.com/carrcomm
> > _______________________________________________
> > wp-hackers mailing list
> > [hidden email] (mailto:[hidden email])
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
>
> _______________________________________________
> wp-hackers mailing list
> [hidden email] (mailto:[hidden email])
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>


_______________________________________________
wp-hackers mailing list
[hidden email]
http://lists.automattic.com/mailman/listinfo/wp-hackers