Paws Posted August 2, 2009 Share Posted August 2, 2009 <form method="post" action="adminprocess.php"> <label>Board Name <input type="text" name="forumname" value="<?php echo $info_r['forum_name']; ?>"> </label> <p> <label>Board Description <input type="text" name="forumdescription" value="<?php echo $info_r['forum_description']; ?>"> </label> </p> <p> <input type="submit" name="Submit" value="Submit"> </p> </form> $forumname = $_GET['forumname']; $forumdescription = $_GET['forumdescription']; $query = "UPDATE `info` SET `forum_name` = '$forumname' AND `info`.`forum_description` = '$forumdescription'"; mysql_query($query); I'm using that code to update my database but it isn't working :/ Can anyone help? Quote Link to comment Share on other sites More sharing options...
Bricktop Posted August 2, 2009 Share Posted August 2, 2009 Try: $forumname = $_POST['forumname']; $forumdescription = $_POST['forumdescription']; $query = "UPDATE `info` SET `forum_name` = '$forumname' AND `info`.`forum_description` = '$forumdescription'"; mysql_query($query); Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 2, 2009 Share Posted August 2, 2009 ^^ EXPLAIN TO HIM WHAT HE DID WRONG! <form method="post" Your form method is post, thus you must get the HTTP POST VARS using $_POST....instead you were using $_GET Quote Link to comment Share on other sites More sharing options...
Paws Posted August 2, 2009 Author Share Posted August 2, 2009 ^^ EXPLAIN TO HIM WHAT HE DID WRONG! <form method="post" Your form method is post, thus you must get the HTTP POST VARS using $_POST....instead you were using $_GET Thanks, god I feel like an idiot now -.- Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 2, 2009 Share Posted August 2, 2009 ^^ EXPLAIN TO HIM WHAT HE DID WRONG! <form method="post" Your form method is post, thus you must get the HTTP POST VARS using $_POST....instead you were using $_GET Thanks, god I feel like an idiot now -.- Don't worry lol, we all make mistakes, and thank Bricktop for fixing it for ya. Quote Link to comment Share on other sites More sharing options...
Paws Posted August 2, 2009 Author Share Posted August 2, 2009 Ok, i've got a different problem now, when ever the user submits the forum it always puts the value as 0 in the database? :/ Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 2, 2009 Share Posted August 2, 2009 Ok, i've got a different problem now, when ever the user submits the forum it always puts the value as 0 in the database? :/ whats the column data type? Quote Link to comment Share on other sites More sharing options...
Paws Posted August 2, 2009 Author Share Posted August 2, 2009 Text Quote Link to comment Share on other sites More sharing options...
Paws Posted August 2, 2009 Author Share Posted August 2, 2009 Bump Quote Link to comment Share on other sites More sharing options...
Paws Posted August 3, 2009 Author Share Posted August 3, 2009 Bump Quote Link to comment Share on other sites More sharing options...
gevans Posted August 3, 2009 Share Posted August 3, 2009 Before you do the mysq_query() output the query variable to see if it's what you expect it to be; $forumname = $_POST['forumname']; $forumdescription = $_POST['forumdescription']; $query = "UPDATE `info` SET `forum_name` = '$forumname' AND `info`.`forum_description` = '$forumdescription'"; echo $query; mysql_query($query); Quote Link to comment Share on other sites More sharing options...
Paws Posted August 3, 2009 Author Share Posted August 3, 2009 Yeah, its what it should be Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 3, 2009 Share Posted August 3, 2009 Yeah, its what it should be mysql_query($query); that should be in a variable. You are echoing the mysql query, it has to be printed out using mysql_fetch_array, or mysql_fetch_assoc or mysql_fetch_object....or...etc Quote Link to comment Share on other sites More sharing options...
gevans Posted August 3, 2009 Share Posted August 3, 2009 Yeah, its what it should be Can you post it, it's hard to help when you don't show what you're getting. Quote Link to comment Share on other sites More sharing options...
Paws Posted August 3, 2009 Author Share Posted August 3, 2009 UPDATE `info` SET `forum_name` = 'forum' AND `info`.`forum_description` = 'description' Quote Link to comment Share on other sites More sharing options...
gevans Posted August 3, 2009 Share Posted August 3, 2009 If you're doing an update you need a WHERE clause so you know what one you're updating. Otherwise it will try and update the whole table. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.