Jump to content

Archived

This topic is now archived and is closed to further replies.

redarrow

join two querys together.

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]

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
[!--sizeo:5--][span style=\"font-size:18pt;line-height:100%\"][!--/sizeo--]solved[!--sizec--][/span][!--/sizec--]

Share this post


Link to post
Share on other sites

×

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.