GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   php/mysql question (https://gfy.com/showthread.php?t=58907)

Direktor 05-01-2002 09:32 AM

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

Direktor 05-01-2002 09:55 AM

anyone ? please? I'll love you long time!

swedguy 05-01-2002 09:57 AM

Take a look at extract()

Direktor 05-01-2002 10:01 AM

im not quite getting that... hmm.

swedguy 05-01-2002 10:06 AM

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