show data of a added custom table in amember

Discussion in 'Customization & add-ons' started by primifortuna, Jun 3, 2009.

  1. primifortuna

    primifortuna New Member

    Joined:
    Jul 28, 2008
    Messages:
    6
    I need show some data of a 1 table in amember.

    How I show ?

    I already have created the new table with MySQL Manager, but I'm not php programer so I don't know how do well the sintax of smarty to show in screen the data modyfing the member.html

    I have tried but the sintaxis don't work.

    The table is called "custom_table", with 4 fields "id","name","date","amount" (these data are customs and don't related to amember script functionality).

    Some help ? :(

    Regards,

    JM.
  2. primifortuna

    primifortuna New Member

    Joined:
    Jul 28, 2008
    Messages:
    6
    How could compare with some smarty code if the "name" field of custom_table match exact with the "f_name" field of amember_user table ?

    I suppose some foreach loop in the field of custom_table to check one to one, while do a if sentece to compare if match with the other variable. But I don't know the right sintax of smarty code.

    Someone can help me with a example of piece of code ?
  3. miso

    miso aMember Pro Customer

    Joined:
    Aug 22, 2006
    Messages:
    543
    you gotta add a query for that table into the .php file itself, pass the necessary variables into the smarty templates and display them there...

    heck, you should do all your mysql logic in the php itself, all the comparisons and filtering, and then just pass the information you need to the template without doing any logic in there...
  4. primifortuna

    primifortuna New Member

    Joined:
    Jul 28, 2008
    Messages:
    6
    Hi miso,

    Thanks for your reply. :)

    Yes, that's what I try do, but I have difficulties to write the right sintax in php code in the member.php.

    This is what I have tried:

    $table_data = ("SELECT field1, field2, field3 FROM custom_table");

    $row_table_data = mysql_fetch_assoc($table_data);

    $field1 = $row_table_data['field1'];
    $field2 = $row_table_data['field2'];
    $field3 = $row_table_data['field3'];

    After, I try show some variable doing a foreach in html like {$field1}, but I don't get show anything. And it got a smarty error.

    That's because I don't have the knowledge of php sintax and programming needed. :confused:

    Could some put a piece of code like example to show in member.html all the records of a field of a added custom table in the database ? Thanks in advance.

Share This Page