MySQL row['values'] to variables?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anebg
Forum Newbie
Posts: 2
Joined: Wed Oct 15, 2008 7:01 pm
Location: USK

MySQL row['values'] to variables?

Post by anebg »

I have this huge database and i was wondering if there was a way that I could make all the values "in the fetched array" as real variables without having to declare every single one.
$title=$row['title'];
$name=$row['name'];
Is there a way php can do it for me? using foreach? maybe for?
This is a pain
:banghead:
but cheers fellow programmers :drunk:
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: MySQL row['values'] to variables?

Post by requinix »

extract($row)
Make sure you specify the fields in your query, no wildcards.
Last edited by requinix on Wed Oct 15, 2008 7:52 pm, edited 1 time in total.
User avatar
anebg
Forum Newbie
Posts: 2
Joined: Wed Oct 15, 2008 7:01 pm
Location: USK

Re: MySQL row['values'] to variables?

Post by anebg »

Sweet. Thank You for your adequate and prompt response!
:drunk:
Post Reply