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
https://forums.phpfreaks.com/topic/19102-solved-mysql-update-issue-please-help/
Share on other sites

Archived

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

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