Jump to content

Forms - would this work?


zero_ZX

Recommended Posts

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 :D)

 

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

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);
?>

          <?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);
?>

Archived

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

×
×
  • 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.