New Posts
Live Radio
Welcome guest, is this your first visit?
  • Login:
FocalClick.com Affiliate Program
+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 15 of 15
  1. #11
    Member
    My Status
     

    Add as a friend
    Join Date
    Oct 2009
    Location
    US
    Posts
    52
    Feedback Score
    1 (100%)

    Default

    Quote Originally Posted by CasinoMack View Post
    Its the $$name. Should be 1 $. I'm pretty sure.
    Yeah, I adjusted that when I copied it over.

    Mike, any ideas on the error?

  2. #12
    #!/usr/bin/mikebrad
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    USA
    Posts
    697
    Feedback Score
    8 (100%)

    Default

    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.

    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];
       

    What this does is create a bunch of variables with the poker rooms name. For instance:

    $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.

  3. #13
    #!/usr/bin/mikebrad
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    USA
    Posts
    697
    Feedback Score
    8 (100%)

    Default

    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:

    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]; 
        

    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:

    $pokerstars_name

    or whatever room it happens to be.

  4. #14
    Member
    My Status
     

    Add as a friend
    Join Date
    Oct 2009
    Location
    US
    Posts
    52
    Feedback Score
    1 (100%)

    Default

    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

  5. #15
    #!/usr/bin/mikebrad
    My Status
     

    Add as a friend
    Join Date
    Nov 2008
    Location
    USA
    Posts
    697
    Feedback Score
    8 (100%)

    Default

    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.


 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Powered by vBulletin® Version 4.1.5
Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.
SEO by vBSEO 3.6.0
Affiliate Program Consultant