![]() |
php/mysql question
I know this is not a fucking builder board or anything but most people are using php/mysql, so here is my question:
how do I simplify this piece of code, hence than one day there could be up to 100 buttons. while ($row = mysql_fetch_array($result)) { $button1 = $row['button1']; $button2 = $row['button2']; $button3 = $row['button3']; $button4 = $row['button4']; $button5 = $row['button5']; $button6 = $row['button6']; $button7 = $row['button7']; $button8 = $row['button8']; $button9 = $row['button9']; $button10 = $row['button10']; $button11 = $row['button11']; $button12 = $row['button12']; $button13 = $row['button13']; $button14 = $row['button14']; } Thank yOU>Q><W |
anyone ? please? I'll love you long time!
|
Take a look at extract()
|
im not quite getting that... hmm.
|
It will extract the array you have to $button1, $button2.....
while ($row = mysql_fetch_array($result)) { extract($row); // After this line you can use // $button1, $button2, ...... } Take a look at the manual page for it, and play around with it. |
All times are GMT -7. The time now is 03:27 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123