cs.punk Posted April 13, 2009 Share Posted April 13, 2009 Specifically on $_GET.... any ideas? Link to comment https://forums.phpfreaks.com/topic/153866-mysql_real_escape_string-on-array/ Share on other sites More sharing options...
Maq Posted April 13, 2009 Share Posted April 13, 2009 You could use a foeach or something like array_walk(). Link to comment https://forums.phpfreaks.com/topic/153866-mysql_real_escape_string-on-array/#findComment-808654 Share on other sites More sharing options...
rhodesa Posted April 13, 2009 Share Posted April 13, 2009 $escaped = array_map('mysql_real_escape_string',$_GET); Link to comment https://forums.phpfreaks.com/topic/153866-mysql_real_escape_string-on-array/#findComment-808655 Share on other sites More sharing options...
cs.punk Posted April 13, 2009 Author Share Posted April 13, 2009 Mysql-real-escape-string needs to parameters... Then connection link is the second... So it wont work with array map... I was thinking of using post but how could you pass it without using a form?... Sessions might be the answer but then say now someone changes his mind with something, everytime he comes to a page a session will show he already selected a catergory... Link to comment https://forums.phpfreaks.com/topic/153866-mysql_real_escape_string-on-array/#findComment-808930 Share on other sites More sharing options...
rhodesa Posted April 13, 2009 Share Posted April 13, 2009 with mysql_real_escape_string(), the second parameter is optional as it will use the most recent connection. do you have more then one mysql connection? if so, you can still use array_walk and define your own custom function Link to comment https://forums.phpfreaks.com/topic/153866-mysql_real_escape_string-on-array/#findComment-808931 Share on other sites More sharing options...
cs.punk Posted April 14, 2009 Author Share Posted April 14, 2009 So sorry guys, I am using mysqlI_real_escape_string... and not Mysql_real_escape_string... Will look into array walk. Thanks guys! Link to comment https://forums.phpfreaks.com/topic/153866-mysql_real_escape_string-on-array/#findComment-809341 Share on other sites More sharing options...
rhodesa Posted April 14, 2009 Share Posted April 14, 2009 if you are using MySQLi, you should be preparing/binding, in which case you don't need to escape it (mysqli will escape it for you). http://us.php.net/manual/en/mysqli-stmt.bind-param.php Link to comment https://forums.phpfreaks.com/topic/153866-mysql_real_escape_string-on-array/#findComment-809644 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.