Posted by Sjoerd on 06/20/06 17:07
toddism wrote:
> $clean = array();
> $mysql = array();
>
> $clean['last_name']="o'reilly";
> $mysql['last_name']=mysql_real_escape_string($clean['last_name']);
>
>
> why are we using an array ( $mysql['last_name'] ) instead of just a
> variable: $val?
It will work with just a variable. An array is probably used because
you want to insert more than only the last name:
$clean = array("last_name" => "o'reilly", "first_name" => "Bill", "And"
=> "so on");
$mysql = array();
foreach ($clean as $key -> $value) {
$myqsl[$key] = mysql_real_escape_string($value);
}
[Back to original message]
|