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 Link to comment https://forums.phpfreaks.com/topic/111324-retrieving-information-from-mysql/ Share on other sites More sharing options...
LemonInflux Posted June 22, 2008 Share Posted June 22, 2008 UNION SELECT I believe. Link to comment https://forums.phpfreaks.com/topic/111324-retrieving-information-from-mysql/#findComment-571482 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") Link to comment https://forums.phpfreaks.com/topic/111324-retrieving-information-from-mysql/#findComment-571486 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!!!!!!! Link to comment https://forums.phpfreaks.com/topic/111324-retrieving-information-from-mysql/#findComment-571671 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.