Jump to content

suranyu

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Posts posted by suranyu

  1. Wow, am I glad I found this forum!  :D I spent the past few hours trying to modify a PHP/mySQL script in order to test it. What this script does is basically look up a mySQL database (based on ip2nation) to find out what country and currency the IP address belongs to. This is the code sample:

     

    $sql = 'SELECT  c.country, c.curr_code FROM  ip2nationcountries c, ip2nation i WHERE  i.ip < INET_ATON("24.24.24.24") AND c.code = i.country ORDER BY  i.ip DESC LIMIT 0,1';
    
            $countryName = $db->get_sql_row($sql);
    

     

    I tested the code in PHPmyAdmin and it returns 2 rows:

     

    country ------- curr_code (row names)

    United States ------- USD (actual values)

     

    So basically 2 variables, United States and USD. Now comes the problem, in order to test the script for several countries, I need to be able to "override" the result in the PHP script

     

    I tried to do that by commenting out the part that returns the result from the mySQL query and modifying it with the following style, but I think I'm doing something wrong:

     

    ### $countryName = $db->get_sql_row($sql); ###
    
    $countryName = "United States USD";
    

     

    Is there any way that I can temporarily override the result returned by mySQL and "fake it" so to say? I understand the mySQL query returns 2 rows, so how would I go about overriding 2 rows?

     

    I hope this makes sense ...you're all my last hope.

     

    :shrug::rtfm::wtf:

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.