PHP - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: PHP (
/showthread.php?tid=187576)
PHP -
Sub Z3rO - 03.11.2010
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.
Re: PHP -
Marcel - 03.11.2010
You might want to show us some code? Like the MySQL query and the PHP code.
Re: PHP -
Sub Z3rO - 03.11.2010
Alright give me a second i will post all
Re: PHP -
Sub Z3rO - 03.11.2010
pawn Код:
format(string, sizeof(string), "INSERT INTO Users (Name,Password) VALUES ('%s','%s')", playerinfo[playerid][Name],playerinfo[playerid][Password]);
thats the pawn query
PHP код:
<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>
thats my register html form
PHP код:
<?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)
?>
and that is my "insert.php"
Also im using a index html what is wrong with my code? ps:in pawno its add the name and passoword.
Re: PHP -
Sergei - 03.11.2010
Код:
$sql="INSERT INTO users (Name, Password)
VALUES
('".$_POST[Name]."','".$_POST[Password]."')";
One mistake. And this is not PHP support forum by the way.
Re: PHP -
Sub Z3rO - 03.11.2010
True but samp could open a php sub forum i guess. Anway thank you.
Re: PHP -
Marcel - 03.11.2010
http://www.w3schools.com/php/php_string.asp
http://www.gerd-riesselmann.net/php-...inside-strings
Re: PHP -
Sub Z3rO - 03.11.2010
Quote:
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
|
your code is wrong i guess
Re: PHP -
Marcel - 03.11.2010
Код:
$sql="INSERT INTO users (Name, Password) VALUES ('".$_POST['Name']."','".$_POST['Password']."')";
Re: PHP -
Sub Z3rO - 03.11.2010
Thanks marcel i tryed it but i get this error
Quote:
Notice: Undefined index: Password in C:\Program Files\wamp\www\insert.php on line 11
|
the name its working but something is wrong with the password