How do i add data to a database, am trying to test
<?
require_once('includes/inc_auth2.php');
require_once('开发者_运维问答includes/config.php');
authRegister($Tawanda, $Mukoko, $dob, $gender, $email, $password);
//requesting from database
/*require_once('includes/db.php');
function authRegister($forename, $surname, $dob, $gender, $email, $password){
$addUser = "INSERT INTO user (forename, surname, dob, gender, email) VALUES ('$forename', '$surname', '$dob', '$gender','$email)";
//Execute the mysql query and store it in a variable called '$result'
$result = mysql_query($addUser);
}*/
?>
What Oli said: we need a bit more info.
However, some first steps to try are to get a sample query (add an echo $addUser;
and copy it when you run the php) and paste it into your db input (phpMyAdmin, command line, or other similar tool for directly managing the database) and see if you are getting any errors there (sometimes PHP fails silently if the query is generating an error with the db, especially if you aren't accessing the $result
at all).
The most likely issue is that your SQL is malformed (again, hard to tell without knowing your schema)
use the php date() function
精彩评论