Jump to content

join two querys together.


redarrow

Recommended Posts

advance thank you.

how to join them together cheers.


How to join

[code]

$db=mysql_connect("localhost" ,"xxx","xxx");
mysql_select_db("promotor",$db);
$query="SELECT member_info.name,member_info.password,member_info.level from member_info WHERE name='$name' AND
password='$password'and level='promoting_member'";
$result=mysql_query($query);

[/code]

To this one

[code]

$query="SELECT booking_member.name,booking_member.password,booking_member.level from booking_member WHERE name='$name' and

password='$password' and level='booking_member'";
$result=mysql_query($query);

[/code]
Link to comment
Share on other sites

This is the full code i can not get the second select statement to work so i ask for a join but i dont think that will help.

Have any idears cheers.

If a user has an account as booking member they go to there page.

and if a user has a account promoting_member they goto there page.

The code works when the code is seprated, but i need to use it with one login form any iders please cheers.

[code]
<? session_start();

if($name && $password) {


$db=mysql_connect("localhost" ,"xxx","xxx");
mysql_select_db("promotor",$db);

$query="SELECT booking_member.name,booking_member.password,booking_member.level from booking_member WHERE name='$name' and

password='$password' and level='booking_member'";
$result=mysql_query($query);



if(mysql_num_rows($result) == 1){

$name=$name;


session_register('name');



header("location: booking_main_page.php");
exit;

}

}else if ($name || password) {

echo "sorry please use all the form and correct password";
exit;
}

if (mysql_num_rows($result) <= 0) {

echo "sorry no account with this members/booking username and password please register";
exit;
}

if($name && $password) {


$query="SELECT member_info.name,member_info.password,member_info.level from member_info WHERE name='$name' AND
password='$password'and level='promoting_member'";
$result=mysql_query($query);



if(mysql_num_rows($result) == 1){

$name=$name;


session_register('name');



header("location: members_main_page.php");
exit;

}

}else if ($name || password) {

echo "sorry please use all the form and correct password";
exit;
}

if (mysql_num_rows($result) <= 0) {

echo "sorry no account with this members/booking username and password please register";
exit;
}
?>
[/code]
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.