foreach ($_REQUEST as $key =>$value) {
$$key = addslashes(trim($value));
}
Display database table record with foreach loop :
$link = mysql_connect ("localhost","root","") or die (" Could not connect to localhost");
$conn= mysql_select_db("connect0844", $link) or die (" Could not connect to database connect0844") ;
$sql = "SELECT * FROM address where id='1'";
$result = mysql_query($sql) or trigger_error("SQL", E_USER_ERROR);
$list = mysql_fetch_assoc($result);
foreach ($list as $key => $value) {
$$key = addslashes(trim($value));
}
echo "$name\n" ;
echo "$email\n" ;
echo "$address" ;
No comments:
Post a Comment