zero_ZX Posted March 29, 2009 Share Posted March 29, 2009 Hi all, I just read some toturials on those forms.. so i want to update something in the sql database, and i tried this, but im not sure if it's the correct thing to do.. Here's my form: <form action="admin_member.php" method="post"> Forum username : <input type="text" name="forumname" /> <input type="submit" /> </form> And here's the updater (or whatever the fancy word is ) <?php $con = mysql_connect("localhost","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("forumdb", $con); mysql_query("UPDATE some_table_here SET password = '7' WHERE name = '$_POST["forumname"];'"); mysql_close($con); ?> Now this is supposed to select the database, find the members "forumname" and update the password for that member to "7". My question is if this would work.. Sorry if it's a dumb question.. we all gotta start somewhere at some level right ? Link to comment https://forums.phpfreaks.com/topic/151600-forms-would-this-work/ Share on other sites More sharing options...
PGTibs Posted March 29, 2009 Share Posted March 29, 2009 It looks like it should work, i can't see any problems but then i'd normally run everything first to test it. Someone else might spot a problem but i can't see any.. Should work fine Link to comment https://forums.phpfreaks.com/topic/151600-forms-would-this-work/#findComment-796236 Share on other sites More sharing options...
zero_ZX Posted March 31, 2009 Author Share Posted March 31, 2009 Alright i got it tested, and it returns: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\xampp\htdocs\phpauditorder\skins\default\client_forum_complete.php on line 58 <?php $con = mysql_connect("localhost","root","****"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("forumdb", $con); mysql_query("UPDATE membergroup SET mgroup = '7' WHERE name = '$_POST["name"];'"); //This is line 58 mysql_close($con); ?> Link to comment https://forums.phpfreaks.com/topic/151600-forms-would-this-work/#findComment-797783 Share on other sites More sharing options...
lonewolf217 Posted March 31, 2009 Share Posted March 31, 2009 <?php $con = mysql_connect("localhost","root","****"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("forumdb", $con); mysql_query("UPDATE membergroup SET mgroup = '7' WHERE name = '{$_POST['name']}'"); //This is line 58 mysql_close($con); ?> Link to comment https://forums.phpfreaks.com/topic/151600-forms-would-this-work/#findComment-797788 Share on other sites More sharing options...
zero_ZX Posted March 31, 2009 Author Share Posted March 31, 2009 Wow thanks alot Link to comment https://forums.phpfreaks.com/topic/151600-forms-would-this-work/#findComment-797861 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.