contra10 Posted January 3, 2009 Share Posted January 3, 2009 im trying to input some variables and only afew are entering and i can't seem to update a value <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); if(is_numeric($_GET['request'])){ $id = $_GET['request']; $friend= "SELECT * FROM users WHERE id = '$id'"; $friendget = mysql_query($friend) or die(mysql_error()); while ($friendrequest = mysql_fetch_assoc($friendget)) { $usernamef = "{$friendrequest['username']}"; $usernamefid = "{$friendrequest['userid']}"; $usersex = "{$friendrequest['sex']}"; $usercity = "{$friendrequest['city']}"; $usercountry = "{$friendrequest['country']}"; $userfrid = "{$friendrequest['frid']}"; echo "<table border ='1' align='center'>"; echo "<tr>"; echo "<td width='400' height='300'>$usernamef</td>"; echo "</tr>"; echo "<tr>"; echo "<td>$usersex, $usercity, $usercountry</td>"; echo "</tr>"; } echo "</table>"; } if (isset($_POST['add'])) { $query = "SELECT * FROM users WHERE username = '$username'"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $userid = "{$row['id']}"; $friendaccept= 2; $query2= "UPDATE friend_request SET value = '$friendaccept' WHERE username = '$usernamef' AND requestname = '$username'"; $result2 = mysql_query($query2) or die(mysql_error()); $insert = "INSERT INTO friends (userid, username, friendid, friendname) VALUES ('$userid', '$username', '$usernamefid', '$usernamef')"; $add_group = mysql_query($insert) or die(mysql_error()); ?> i can't update the value to 2 and for some reason only part of variables are entering the table, userid and username are entering while usernamefid and usernamef won't enter Link to comment https://forums.phpfreaks.com/topic/139289-solved-cant-seem-to-input-variables-and-update-table/ Share on other sites More sharing options...
contra10 Posted January 3, 2009 Author Share Posted January 3, 2009 is there something wrong with the syntax? Link to comment https://forums.phpfreaks.com/topic/139289-solved-cant-seem-to-input-variables-and-update-table/#findComment-728544 Share on other sites More sharing options...
contra10 Posted January 3, 2009 Author Share Posted January 3, 2009 i can echo all the variable im guessing i should do a hidden value for the other stuff but wat about the updating Link to comment https://forums.phpfreaks.com/topic/139289-solved-cant-seem-to-input-variables-and-update-table/#findComment-728551 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.