vendredi 24 juin 2016
php array_walk_recursive not working on mysql result set array with stripslashes
I have a mysql result array and I'm trying to stripslashes on the array using array_walk. It's not stripping slashes from mysql. It is working on the array I manually added ($dataArr['xxx']) though.
Here is my code:
$sql = ' select * from `ads` where id = 3 ';
$res = mysql_query($sql, $conn) or die(mysql_error());
$row = MYSQL_FETCH_ASSOC($res);
$dataArr = $row;
$dataArr['xxx'] = '<script type='text/javascript'><!--//<![CDATA[
var m3_u = (location.protocol=='https:'?'https://ads.test.com/www/delivery/ajs.php':'http://ads.test.com/www/delivery/ajs.php');
var m3_r = Math.floor(Math.random()*99999999999);
if (!document.MAX_used) document.MAX_used = ',' etc.... etc....;
';
array_walk_recursive($dataArr, 'stripslashes');
print '<pre>'; print_r($dataArr); print '</pre>';
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire