Array in combination with join statement (PHP + MYsql)
Posted: Sat Feb 16, 2008 4:08 am
Hi everyone,
I have a problem that I can't sort out. I have several tables, two of them I joined together
(see below example)
the fields login and level are derived from the first table (tbl_login). The second table (tbl_settings) contains settings for refresh rates, display of columns etc. I however don't know on how to retrieve the info. Apparently $row['refresh'] doesn't pick up the value from the query. I thought the info could be retrieved by doing $refresh=$row['settings.refresh'] but that doesn't seem to work. In short, I'd like to know how the info can be accessed when I run a query based on joined tables.
It seems to me as if this would be a common practise ??
Can someone shed some light on this problem?
Tks for the assistance.
I have a problem that I can't sort out. I have several tables, two of them I joined together
(see below example)
Code: Select all
$query="select * from tbl_login login, tbl_settings settings WHERE login.login = '$loginUsername'";
$result=mysql_query($query) or die("Fout: ". mysql_error());
while($row = mysql_fetch_array($result))
{
$gebruiker=$row['login'];
$toegang=$row['level'];
$refresh=$row['refresh'];
}
$_SESSION['level'] = $toegang;
$_SESSION['refresh']= $refresh;It seems to me as if this would be a common practise ??
Can someone shed some light on this problem?
Tks for the assistance.