View Single Post
Need help with PHP/MYSQL
Old
  (#1 (permalink))
Akadios
Junior Member
 
Status: Offline
Posts: 2
Join Date: Aug 2004
Need help with PHP/MYSQL - 08-17-2004, 05:07 PM

I am having a problem getting php to change mysql database values. It can query the database fine but it won't change the database. What am I doing wrong?

I have tried many different methods of sql= UPDATE ****** none of which work including the sql = "UPDATE nuke_users SET user_sig = 2 WHERE username= '/Akadios/'";

That MySQL administrator Welcome to phpMyAdmin 2.5.3 told me to put in simply to change usersig to 2 (note that the script UPDATE nuke_users SET user_sig='2' WHERE username = 'Akadios' directly put into MySQL functions correctly and when asked to make php code phpMyAdmin makes the code I tried which doesn't Anyways I have included all the SQL related code and left out other parts.


Code:
<?php ?>
<html>
<head><title>PHPBB Signature Generator by vanurangers.com</title></head>
<body>
<center>
<h3>PHPBB Signature Generator</h3>
</center><left>


vanurangers.com &copy; 2004




<?php
//var name parsing

$username = $_GET['username'];
$password = $_GET['password'];

$new_pass = md5($password);
$host = "localhost";
$dbusername = "********";
$dbpassword = "********";
$database = "vanurangers_com_-_phpnuke";
$server = mysql_connect($host, $dbusername, $dbpassword) or die(mysql_error());
$connection = mysql_select_db($database, $server);

$sql = "SELECT user_password FROM nuke_users WHERE username = '$username'";
          $result = (mysql_query($sql));

$storedpass= (mysql_result($result, 0));
        if ( $storedpass != $new_pass)
                 {
                          echo "incorrect password";
                          exit;
                  }            else

//rest of code here that fills $signature which is what I
// eventually when it works to go into the signature. (replacing all the old
//data in the user_sig.

<?
sql = "UPDATE nuke_users SET user_sig = 2 WHERE username= '/Akadios/'";

 mysql_close($server);
?>
</html>
   
Reply With Quote