03.11.2010, 15:10
Someone here is expert with php? I made a script pawn and php when i register from the website "localhost" it only inserts the name.
format(string, sizeof(string), "INSERT INTO Users (Name,Password) VALUES ('%s','%s')", playerinfo[playerid][Name],playerinfo[playerid][Password]);
<html>
<body>
<form action="insert.php" method="post">
Name: <input type="text" name="Name" />
Password: <input type="text" password="Password" />
<input type="submit" />
</form>
</body>
</html>
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("testphp", $con);
$sql="INSERT INTO users (Name, Password)
VALUES
('$_POST[Name]','$_POST[Password]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
$sql="INSERT INTO users (Name, Password) VALUES ('".$_POST[Name]."','".$_POST[Password]."')";
Notice: Use of undefined constant Name - assumed 'Name' in C:\Program Files\wamp\www\insert.php on line 13 Notice: Use of undefined constant Password - assumed 'Password' in C:\Program Files\wamp\www\insert.php on line 13 Notice: Undefined index: Password in C:\Program Files\wamp\www\insert.php on line 13 |
$sql="INSERT INTO users (Name, Password) VALUES ('".$_POST['Name']."','".$_POST['Password']."')";
Notice: Undefined index: Password in C:\Program Files\wamp\www\insert.php on line 11 |