"Mike Mapsnac" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
>
> >From: Marek Kilimajer <[EMAIL PROTECTED]>
> >
> >$fields = array('username', 'password', ...);
> >foreach($fields as $key) $$key = $_POST[$key];
> >
> Thanks.
>
> It looks much nicer :)

Along the same lines, I've found this helpful when inserting into mysql.

foreach($_POST as $key => $val)
  $$key = mysql_escape_string($val);

Or, to use Marek's trick of only using certain variables:

$fields = array('username', 'password', ...);
foreach($fields as $key)
  $$key = mysql_escape_string($_POST[$key]);

I like that a lot better.

  -- Rob

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to