Jump to content

need help with join tables


Mancent

Recommended Posts

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
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.