Jump to content

Retrieving information from MYSQL


nitation

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.