Jump to content

[solved] MySQL UPDATE issue, please help !!


techiefreak05

Recommended Posts

this is getting frustrating.. i have this code to show what users have requested to be your friends. and to show their info and have a button to accept them..

[code]<center>
<b>Users that are requesting to be your friend.</b>
<?php
$query = mysql_query("SELECT * FROM friends WHERE `friend` = '$_SESSION[username]' AND `accepted` = ''");
while ($array = mysql_fetch_array($query)){
$friend=$array['username'];
echo "<br><center><b>" .$friend. "</b></center>";
echo "<a href='sendMessage.php?to=" .$friend. "'>-Message " .$friend. "-</a> |<a href='getInfo.php?user=" .$friend."'> -Get Info-</a> | <a href='http://zycoworld.com/" .$friend. "'>-View zPage-</a> | <form action=\"\" method=\"post\">
      <table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">
<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"add\" value=\"-Accept-\"></td></tr>
</table>
</form>";
}
$query = mysql_query("SELECT * FROM friends WHERE `friend` = '$_SESSION[username]' AND `accepted` = ''");
$array = mysql_fetch_array($query);
$friend=$array['username'];
if($_POST['add']){
mysql_query("UPDATE friends SET accepeted = yes WHERE username = $_SESSION[username], friend = $friend");
mysql_query("UPDATE friends SET accepeted = yes WHERE username = $friend, friend = $_SESSION[username]");
}
?>[/code]

the first half works! it shows the users requesting to be your friend.. BUT when i click the button to accept.. it doesnt update the table with "yes" in the accepted column... whats wrong. im going crazy here !!!!  ???  ???  ???
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.