Mancent Posted October 5, 2010 Share Posted October 5, 2010 I need to get the friends password and insert it into the table so the friend can delete it later can some one help me do a table join <?php//include the connect scriptinclude "../../../../connect.php";//Post variables from flash$username = $_POST['username'];$password = $_POST['password'];$status = $_POST['status'];$friend = $_POST['friend'];$username = stripslashes($username);$password = stripslashes($password);$status = stripslashes($status);$friend = stripslashes($friend);$username = mysql_real_escape_string($username);$password = mysql_real_escape_string($password);$status = mysql_real_escape_string($status);$friend = mysql_real_escape_string($friend);$sql = mysql_query("SELECT * FROM user_declined_list WHERE username = '$username' and password = '$password' and friend = '$friend' and status ='$status'");$rows = mysql_num_rows($sql);$your_username=$rows['username'];if($rows > 0){echo "&msgTextFriendShipRejected= RESEND NEW FRIEND REQUEST SUCCESSFULLY!";// ok they are now our friend but we are not thier friend so lets insert the friendship in reverse and set the status to 1 on both ends// Problem i see is this if the user wishs to remove the friend later he will neen his password set to delete from this table.// so i need to do a join table again where friend password gets inserted here..$insertnewfriend = mysql_query("INSERT INTO user_friends_list (username,password,friend,status) VALUES ('$friend','$password','$username','0')") or die(mysql_error());//ok lets update the request and set the friend to be a friend becuase we said yes be my friend.$deleteuserfriend = mysql_query("DELETE FROM user_declined_list WHERE username = '$username' and password = '$password' and friend = '$friend' and status ='0'");return;}?> Link to comment https://forums.phpfreaks.com/topic/215192-need-help-with-join-tables/ Share on other sites More sharing options...
dreamwest Posted October 5, 2010 Share Posted October 5, 2010 Table join example: $res = mysql_query("SELECT * FROM `table1` as t, `table2` as t2 WHERE t.`id`=t2.'t_id' "); Link to comment https://forums.phpfreaks.com/topic/215192-need-help-with-join-tables/#findComment-1119206 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.