Jump to content

Archived

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

techiefreak05

[solved] MySQL UPDATE issue, please help !!

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 !!!!  ???  ???  ???

Share this post


Link to post
Share on other sites
[code]
<?php
mysql_query("UPDATE friends SET accepeted = 'yes' WHERE username = '$friend' AND friend =
'{$_SESSION['username']}'");
?>
[/code]

also, are you sure the field "accepeted" is correctly spelled?

Share this post


Link to post
Share on other sites
and .. no accepted was not spelled rite.. i just noticed that a second ago, and changed the code to "accepted"

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.