Welcome Guest, Not a member yet? Register   Sign In
mysql_real_escape_string() expects parameter 1 to be string, array given
#2

(This post was last modified: 04-23-2016, 12:59 AM by Wouter60.)

Keep in mind the every element of the result_array() is an array itself. Usually it contains the fields you requested from your database.
I guess that one of your fields is named 'description'.
If that is the case, modify the foreach loop like this:
PHP Code:
foreach($q->result_array() as $row) {        
    $descs
[] = mysql_real_escape_string($row['description']);

I question if you really need the mysql_real_escape_string with CodeIgniter. I never use it, and I never encountered problems with strings that have quotes or special characters.
Reply


Messages In This Thread
RE: mysql_real_escape_string() expects parameter 1 to be string, array given - by Wouter60 - 04-23-2016, 12:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB