nitation Posted June 22, 2008 Share Posted June 22, 2008 Hello guys, I have a user's panel that requires authentication to gain access. I am making use of session here. What i want to ask is; How do i retrieve data from two tables in a mysql database. In this situation, am not looking at joining the tables. Below is a sample code <?php if (isset($afso_userid)) { $sqluser=mysql_query("select * from register_account where id='$afso_userid' ") ; if (!empty($sqluser)){ $numuser=mysql_num_rows($sqluser); while($rowuser=mysql_fetch_array($sqluser)){ $id=$rowuser["id"]; $placehold=$rowuser["placehold"]; $date=$rowuser["adddate"]; $typeoftxn=$rowuser["typeoftxn"]; $account_number=$rowuser["account_number"]; } ?> Thanks in advance Quote Link to comment Share on other sites More sharing options...
LemonInflux Posted June 22, 2008 Share Posted June 22, 2008 UNION SELECT I believe. Quote Link to comment Share on other sites More sharing options...
nitation Posted June 22, 2008 Author Share Posted June 22, 2008 so how do i union these tables; ("select * from register_account where id='$afso_userid' ") and ("select * from activity_table") Quote Link to comment Share on other sites More sharing options...
fenway Posted June 22, 2008 Share Posted June 22, 2008 select <column-list> from register_account where id='$afso_userid' union select <column-list> from activity_table But it's very dangerous to do this without explicitly listing the column names in both!!!!!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.