I'm looking for less of an answer and more of an understanding..
I'm simply taking a row from a table and running some of the results through a function that prepares the data for editing.. I usually use below but am doing a ton of different columns, and I'm doing this repeatedly throughout the site,
$id = mysql_real_escape_string($_GET['id']);
$query = mysql_query("SELECT * FROM table WHERE id = '{$id}'");
$row = mysql_fetch_array($query);
$row['descript'] = prepcode($row['descript']);
$row['title'] = prepcode($row['title']);
//...etc
so I tried making a foreach loop,
$id = mysql_real_escape_string($_GET['id']);
$query = mysql_query("SELECT * FROM table WHERE id = '{$id}'");
$row = mysql_fetch_array($query);
$result = array(
"descript",
"title"
//....etc
);
foreach($result as $v){
$row['{$v}'] = prepcode($row['{$v}']);
}
& its not working out and I don't understand why!