[wp-hackers] mysql_real_connect instead of mysql_connect

Robert Deaton false.hopes at gmail.com
Mon Feb 26 06:42:12 GMT 2007

On 2/26/07, Jamie Talbot <wphackers at jamietalbot.com> wrote:
> Hash: SHA1
> Aaron Brazell wrote:
> > Perhaps I should have phrased the question "why would you use mysql_connect"... The wpdb class is a decent tool for doing sql without injection, etc.
> >
> > Heh... It was just a question on my part. Like I said, don't want to sound snarky. :)
> I don't think he wants to use mysql_connect() directly, I think he wants WP to use
> mysql_real_connect() instead of mysql_connect()  (Correct me if I'm wrong, Sai)
> And it didn't sound snarky, though my response probably did :)
> Back to the question though - does anyone know of a good reason *not* to use mysql_real_connect()?

Yeah, there's one very good reason, there is no PHP mysql_real_connect function.

PHP's mysql_connect will use the C wrapper mysql_real_connect if it is
available. What this guy wants is to be able to pass a flag to the C
mysql_real_connect through PHP's mysql_connect. The flag he wants to
set can in fact be used, it is in the notes section of the
documentation [1]. How he wants to have them placed in, I'm not sure,
wpdb is loaded long before our plugins so there really is no way for a
plugin to set that, and I am -1 on turning this on for everyone, for
BC reasons.

--Robert Deaton

More information about the wp-hackers mailing list