0

How can I handle the error message generated by a dreamweaver function, i need to handle the message if I am told a value that does not exist.

I made this simple test and the error message was displayed to me:

http://topdeia.com/city.ajax.php?ajax=true&search=&uf[]=27

The message is this:

PHP Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in

The function:

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
adventistapr
  • 113
  • 8
  • What isn't clear about this error message? – John Conde Apr 17 '17 at 16:57
  • 1
    ***Please [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php).*** [These extensions](http://php.net/manual/en/migration70.removed-exts-sapis.php) have been removed in PHP 7. Learn about [prepared](http://en.wikipedia.org/wiki/Prepared_statement) statements for [PDO](http://php.net/manual/en/pdo.prepared-statements.php) and [MySQLi](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php) and consider using PDO, [it's really pretty easy](http://jayblanchard.net/demystifying_php_pdo.html). – Jay Blanchard Apr 17 '17 at 16:58
  • Hello @John Conde, i need to prevent this message from appearing. – adventistapr Apr 17 '17 at 17:04
  • 1
    Then make sure what you're feeding the function is a string. Also, what @JayBlanchard said. – junkfoodjunkie Apr 17 '17 at 17:06

0 Answers0