Quering Amember Table

Discussion in 'Customization & add-ons' started by fishnyc22, Apr 20, 2006.

  1. fishnyc22

    fishnyc22 New Member

    Joined:
    Mar 22, 2006
    Messages:
    29
    I need to call the amember "members" table to read a value.
    I noticed in the last page of the manual there is this line:

    Why is it not recommended? Is there a security risk?

    I added a row to the table called " up_sms_status" that I need to query for a specific user. I'm doing this in one of my protect folders outside of amember but i'd like to use the same method amember uses to connect.

    For example. (And I'm sure there is something wrong here). I included the amember config file with: include ('../subscribe/config.inc.php');

    function test($myid){
    global $db;
    $status = $db->query($sql = "SELECT up_sms_status
    FROM {$db->config[prefix]}members
    WHERE login = $myid");
    return $status;
    }
    $myStatus = test(7);
    echo ($myStatus);

    But I get an error that says "Resource id #64"
    Can someone explain what is wrong here and why this is not a good idea.

    Thanks

    Fish
    ><>
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    There is nothing regarding aMember, it is a code problem, have a look:

    PHP:
    function test($myid){
    global 
    $db;
    $q $db->query($sql "SELECT up_sms_status
    FROM 
    {$db->config[prefix]}members
    WHERE login = 
    $myid");
    list(
    $status) = mysql_fetch_row($q);
    return 
    $status;
    }
    $myStatus test(7);
    echo (
    $myStatus);
  3. fishnyc22

    fishnyc22 New Member

    Joined:
    Mar 22, 2006
    Messages:
    29
    Thanks Alex. Can I ask why it is "not recommended"
  4. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    With this field no problems at all, you may read and write it as you want.

Share This Page