Hey, sorry I missed this one before.
No, it's definitely supposed to be 2 $ but I forgot a few and I also forgot the curly braces, sorry about that. Here is the code that should work.
What this does is create a bunch of variables with the poker rooms name. For instance:PHP Code://Database Query
$query = db_query("SELECT * FROM site_info_s");
//Extract array
while($row = mysql_fetch_array($query)) {
//Create variables based upon name of poker room
$$name = $row[0];
${$name.'_rake'} = $row[1];
${$name.'_bonus'} = $row[2];
}
$pokerstars <--- Poker Star's name
$pokerstars_rake <--- Poker Star's Rake value
$pokerstars_bonus <--- Poker Star's Bonus amount
$fulltilt <--- Full Tilt's name
$fulltilt_rake <--- Full Tilt's Rake value
$fulltilt_bonus <--- Full Tilt's Bonus amount
Let me know if that works or not.
Oh, and if you have spaces or capital letters in your names (which I'm sure you do), then you will want to modify the code a little:
now the variables will automatically be lowercase and free from spaces and if you want to get the "nice" name of the room, just use:PHP Code://Database Query
$query = db_query("SELECT * FROM site_info_s");
//Extract array
while($row = mysql_fetch_array($query)) {
//Create variables based upon name of poker room
$name = strtolower($row[0]);
$name = str_replace(" ", "", $name);
${$name.'_name'} = $row[0];
${$name.'_rake'} = $row[1];
${$name.'_bonus'} = $row[2];
}
$pokerstars_name
or whatever room it happens to be.
Awesome, that makes sense. Thanks mike. I'll let you know if I have any further questions but I think this should do the trick and is much easier than what I had planned on doing before. Man, I love PHP![]()
Yeah, scripting is cool sometimes.
I did a similar thing with a site where I needed to get all of the variables and use then multiple times on the same page. At first, I just did mysql queries over and over again but this way is definitely increases page loading time.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks