Jump to content

Just a quick one .....


burnside

Recommended Posts

Im trying to make a form where if you click edit it lets you change a username, it kinda works it lets you pick a name but when it sends the name to the data base it just leaves it blank  :-\ code is below

echo " 	<Tr><Td>Username <td>:<td>$info[username] <a href=cont.php?edit=username>Edit</a></td> ";
if($_GET[edit] == "username") { echo " <tr><Td> <input type =text name=name value='$info[username]'> <td> : <td> <a href=cont.php?edit=saveusername>Save</a> </td> "; }
if($_GET[edit] == "saveusername" ) {  $username = str_replace(">", ">", $username);


 $username = str_replace("<", "<", $username);





 $check1 = mysql_query("SELECT username FROM users WHERE username='$_GET[name]'");


 if ((mysql_num_rows($check1) != 0)) {


                 
 echo 'Sorry, name already in use<br>';


 }


 else {


 $updateuserdb = mysql_query("update users set username='$_GET[name]'  where id=$info[id]");


 echo "You have changed your username.<br>";


 }


} 

Link to comment
Share on other sites

$check1 = mysql_query("SELECT username FROM users WHERE username='$_GET[name]'");

 

the line above and all your queries for that matter, you don't have single quotes within your GET variables, should be $_GET['name'].  All your queries are like that.

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.