I can't insert data into my database
Posted
by
Ken
on Stack Overflow
See other posts from Stack Overflow
or by Ken
Published on 2011-01-08T20:44:16Z
Indexed on
2011/01/08
20:53 UTC
Read the original article
Hit count: 230
I don't know why, but my data doesn't go into my database 'users' with the table 'data'.
<html>
<body>
<?php
date_default_timezone_set("America/Los_Angeles");
include("mainmenu.php");
$con = mysql_connect("localhost", "root", "g00dfor@boy");
if(!$con){
die(mysql_error());
}
$usrname = $_POST['usrname'];
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$password = $_POST['password'];
$email = $_POST['email'];
mysql_select_db(`users`, $con) or die(mysql_error());
mysql_query(INSERT INTO `users`.`data` (`id`, `usrname`, `fname`, `lname`, `email`, `password`) VALUES (NULL, '$usrname', '$fname', '$lname', '$email', 'password')) or die(mysql_error());
mysql_close($con)
echo("Thank you for registering!");
?>
</body>
</html>
All i get is a blank page.
© Stack Overflow or respective owner