Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001062

Re: [PHP-DB] Variable Variables in PHP From: Jason Stechschulte (jpstech <email protected>)
Date: 06/27/01

On Wed, Jun 27, 2001 at 12:03:42PM +1000, Morgan Tocker wrote:
> ## THIS SHOULD SUBMIT SOMETHING LIKE THIS >>>>
>
> test.php?name1=avalue&email1=avalueagain&name2=secondname&email2=secondemail
>
> THE PROBLEM:
> From PHP with variable variables, how do I change $name1 and $email1 into -
>
> ## for all $name.$x values do this......
> $sql = "UPDATE name_and_email SET name = '$name1', email = '$email1' WHERE
> id = '$id'";

Put it inside of a loop.

for($i = 1; $i < 3; $i++) {
   echo ${"name$i"};
}

This will print out both names. Hopefully you can figure out how to
modify this to create the sql code you want.

-- 
Jason Stechschulte
jpstech <email protected>
--
It's the Magic that counts.
             -- Larry Wall on Perl's apparent ugliness

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>