Hi Guys,
I wondered if you might be able to give me a hand with this. I'm feeling a bit foolish at the moment, because it seems like the solution should be simple but the answer is eluding me.
I often use arrays when outputting mysql queries and it works fine if I am doing this on the fly using the following code
while ($about_key2 = mysql_fetch_array($about_key)) {
print " " . $about_key2['about'] . ",";}
and this works perfectly fine. But more recently I have developed the need to work on these arrays before I output them, in order to remove duplicate records, escape characters and generally alter them.
I have tried using the following code, but I can only get it to output the first record from the array and then nothing else.
function mysql_real_escape_array($t){
return array_map("mysql_real_escape_string",$t);
}
$con_key = @mysql_query("select name from customers ORDER BY name");
$con_array = mysql_fetch_assoc($con_key);
$con_escape = mysql_real_escape_array($con_array);
foreach($con_escape as $test)
{echo $test;}
It seems right to me, but I just can't get it to work the way I want it to. I would be humbly indebted to anyone who could point me in the right direction.
Thanks,