hi everyone. I've programmed a lot in coldfusion, but i am pretty new to php. Can anyone look at the following code tell me what the heck i am doing wrong. <?php $FirstName = $_POST['FirstName']; $LastName = $_POST['LastName']; $Email = $_POST['Email']; mysql_connect ("johnxxx","ejohnxxx,"johnxxx") or die (mysql_error()) mysql_select_db("johnxxx"); $query="INSERT INTO AllUsers (FirstName, LastName, Email)VALUES ('".$FirstName."','".$LastName."','".$Email."')"; mysql_query($query) or die ('Error updating database'); echo "Database Updated With: " .$FirstName. " ".$LastName." ".$Email." ; ?> The database conection is correct - I know this 'cause i use the same line to create a table in that data base which i confirmed in the phpadmin panal
I added & repaired your code. As moads told, you're missing ; <?php $FirstName = mysql_real_escape_string($_POST['FirstName']); $LastName = mysql_real_escape_string($_POST['LastName']); $Email = mysql_real_escape_string($_POST['Email']); mysql_connect ("johnxxx","ejohnxxx,"johnxxx") or die (mysql_error()); mysql_select_db("johnxxx"); $query="INSERT INTO AllUsers (FirstName, LastName, Email)VALUES ('".$FirstName."','".$LastName."','".$Email."')"; mysql_query($query) or die ('Error updating database'); echo "Database Updated With: " .$FirstName. " ".$LastName." ".$Email." ; PHP: (?> on the end isn't neccesary)