#1

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.
Reply
#2

You might want to show us some code? Like the MySQL query and the PHP code.
Reply
#3

Alright give me a second i will post all
Reply
#4

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.
Reply
#5

Код:
$sql="INSERT INTO users (Name, Password)
VALUES
('".$_POST[Name]."','".$_POST[Password]."')";
One mistake. And this is not PHP support forum by the way.
Reply
#6

True but samp could open a php sub forum i guess. Anway thank you.
Reply
#7

http://www.w3schools.com/php/php_string.asp
http://www.gerd-riesselmann.net/php-...inside-strings
Reply
#8

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
Reply
#9

Код:
$sql="INSERT INTO users (Name, Password) VALUES ('".$_POST['Name']."','".$_POST['Password']."')";
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)