5
I had this question recently, how to check if there is an open connection with mysql?
Everyone knows that to use the mysql_real_escape_string
need to have a connection right, so I wanted to check if there is one, if yes ai use mysql_real_escape_string
.
A little strange question, because, by your code you can know if you have connection or not, a thing also and a tip stop using mysql_connect, this code is deprecated in the new versions of your PHP, so use PDO (http://us1.php.net/manual/en/class.pdo.php) or Mysqli (http://us1.php.net/manual/en/class.mysqli.php) At this link you can get the error simply by mysql_error (http://us1.php.net/manual/en/function.mysql-error.php), the first example can help you !!!
– user6026
pq not using mysql functions_*
– rray