
December 9th, 2012, 02:28 PM
|
|
Registered User
|
|
Join Date: Dec 2012
Posts: 16
Time spent in forums: 13 h 13 m 6 sec
Reputation Power: 0
|
|
|
PHP MYSQL update
Hello, how I could use this code
PHP Code:
$user_data = login_user( $_POST['username'] , $_POST['password'] );
$result = mysql_query("UPDATE users SET username = '$user WHERE password = '$password'" or die(mysql_error());
in my php code , so the user will be able to udpate his data from a form.
PHP Code:
<html>
<head>
<body>
<html>
<head>
<title> Login Page </title>
<style type="text/css">
body {
background-color:#3b5999;
color:#999;
font-family:Arial;
font-size:9pt;
}
#holder {
width:80%;
background-color:#CCC;
color:#F00;
font-family:Arial;
border:1px solid #003;
padding:12px;
text-align:right;
}
#userInfo {
color:#000;
font-family:Arial;
border:1px solid #CCC;
text-aling:right;
padding:2px;
}
</style>
</head>
<body>
<center>
<?php
// Replace the variable values
$host = "127.0.0.1";
$root = "root";
$pass = "";
$database = "test";
//Connects to Mysql or displays error
$con = mysql_connect($host,$root,$pass) or die(mysql_error());
//"my_db" is the name of the database.
$db = mysql_select_db($database ,$con);
?>
<div id="container">
<h1>Login</h1>
<p>
<form method="post" action="" id="form">
<label>Username:</label> <input type="username" name="username" value="" /><br />
<label>Password:</label> <input type="password" name="password" value="" /><br /><br />
<input type="submit" value="Submit" />
<?php echo $error;
?>
</form></table>
</body>
</html>
|