Re: Sanitizing potential MySQL strings with no database connection
| From: | Dotan Cohen | Date: | Sun, 18 Oct 2009 19:21:04 +0000 |
| Subject: | Re: Sanitizing potential MySQL strings with no database connection | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-299034@lists.php.net to get a copy of this message | ||
> test if you have a db connection in the function, if not, skip MRES and
> other mysql_ functions?
>
I thought that one could not test if a database connection is
established or not, this is the most relevant thing that I found while
googling that:
http://bugs.php.net/bug.php?id=29645
> In my opinion it's bad code to use a mysql_* function on a Oracle db (and
> vice versa) or on a string for that matter. It lies in the naming of the
> function what it's designed to do and work on. If you want a general
> function to sanitize an input, make your own function sanitize_input() based
> on ereg_* and/or str_replace and the likes.
>
All the connections are to MySQL databases, but to _different_ MySQL
databases on the same host.
--
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il