Re: Whats wrong with this?
I see a missing semi colon, missing single quote, and you have a period in your sql statement. So add in the semi colon, remove the period, and add the single quote :)
Code:
include("config.php");
$sql = "insert into muservers(Id_server, exp, drop, pagina, ip, puerto).VALUES('$Id_server','$exp','$drop','$ip','$puerto','$pagina')";
Put a or die on your mysql_query() also, it'll help you with mysql errors.
PHP Code:
$result = mysql_query($sql) or die(mysql_error());
Good luck
Re: Whats wrong with this?
Thanks man! Now I passed that error... but now I have this one...
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'drop, pagina, IP, Puerto)VALUES('','','','','','')' at line 1
I hope you can help me with this one...
Thanks!
Re: Whats wrong with this?
My bad, I missed it on first glance. Register globals is off by default, therefore, when you access form values, you can't just use the name of the form element. You access it through the $_POST superglobal. So, it would be:
PHP Code:
$_POST['Id_server'];
// instead of
$Id_server;
Good luck
Re: Whats wrong with this?
Thanks! But now it says
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /www/2gamers.com.ar/htdocs/servers/rec_datos.php on line 13
:cry: :cry:
Here is the code
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Datos Recividos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
include("config.php");
//process form
$sql = "INSERT INTO muservers(Id_server, exp, drop, pagina, IP, Puerto)"."VALUES ($_POST['Id_server'],$_POST['exp'],$_POST['drop'],$_POST['pagina'],$_POST['ip'],$_POST['puerto'])";
$result = mysql_query($sql) or die(mysql_error());
echo "Hemos recivido los datos de su servidor.\n";
?>
</body>
</html>
Thanks again!
Re: Whats wrong with this?
Try this for your query:
PHP Code:
$sql = 'insert into muservers(Id_server, exp, drop, pagina, ip, puerto) VALUES("' . $_POST['Id_server'] . '","' . $_POST['exp'] . '", "' . $_POST['drop'] . '", "' . $_POST['ip'] . '", "' . $_POST['puerto'] . '", "' . $_POST['pagina'] . '")';
You'll want to look at mysql_real_escape_string()
To help prevent sql injection attacks.
Good luck
EDIT: You seem to be missing a few form fields as well, I only see 4 here:
PHP Code:
Nombre:<input type="Text" name=Id_server"><br>
pagina:<input type="Text" name="pagina"><br>
IP:<input type="Text" name="ip"><br>
Puerto:<input type="Text" name="puerto"><br>
But you are inserting 6?
Re: Whats wrong with this?
Thanks man, but forget it, i have this error:
Parse error: parse error, unexpected T_VARIABLE in /www/2gamers.com.ar/htdocs/servers/rec_datos.php on line 14
Ill keep trying
Thanks again for your help!!
Re: Whats wrong with this?
We can't give up now! :D
Make sure you have all the form fields in your html form, then give it a shot.