This topic is locked

Help with Master Detail records

5/16/2007 2:18:24 AM
PHPRunner General questions
L
lambi author

Can someone please help!! I've been trying this out for 2 days but can't figure out what I've done wrong.
I have 2 tables Master account and account information. Master accounts has fields id, userid, password and account_no. Table account information has account_no, address, etc, etc. I setup phprunner to use databse login via Master account using fields userid and password. Login in OK. I know it might be easier to get users to login using account_no and password but it's not something I want ... for some other reason.
On login, I wanted to list the information on the user based on his account_no. I've set the Master Detail relationship as account_no in both tables. However, when select the account information menu, no records is shown.
Can someone help me and tell me what did I do wrong? Maybe on the list page, I should have something that tells php to extract all details where account_no is equal to account_no of the person with successful login. I don't know where I can do that in phprunner.
Please help. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=5246&image=1&table=forumtopics' class='bbc_emoticon' alt=':(' />
Lambi

J
Jane 5/16/2007

Hi,
if you want to proceed to the account information list directly after login you need to save account_no in the $_SESSION["MasterAccount_masterkey1"] variable.

Use AfterSuccessfulLogin event on the Events tab for this purpose:

function AfterSuccessfulLogin()

{

global $conn;

$str = "select account_no from MasterAccount where userid='".$_SESSION["UserID"]."'";

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);

$_SESSION["MasterAccount_masterkey1"] = $data["account_no"];

}



where MasterAccount is your actual table name.

L
lambi author 5/16/2007

Thanks for the reply but I've not made myself clear. What I meant was that nothing was returned (blank page, no data shown) when I click on the account information menu. Both the master and detail table shared a common field which is username. Any suggestion on what I'm doing wrong?

Sergey Kornilov admin 5/16/2007

Lambi,
post your application to Demo Account (last tab in PHPRunner) and send the URL of your application to support@xlinesoft.com.