tags:

views:

97

answers:

3

I am running this mysql query:

$result = mysql_query("SELECT * FROM  userdetails WHERE  userid= '$userid'");
$row = mysql_fetch_array($result);

The result is a row of 100 variables with different names such as $row['name'], and $row['email'], etc...

How can I convert all of these to just $name and $email, etc... in php?

It would save so much time to write this program....

+3  A: 

http://au2.php.net/extract

phidah
+3  A: 

You probably don't ultimately want to do that, but the extract() function does this.

http://us3.php.net/manual/en/function.extract.php

Justin
+4  A: 

Short anwser: extract

long anwser : don't. It may seem like a good anwser now but if you use it much it will become a problem keeping track of stuff.

Matt