Forum Moderators: coopster
// Insert data into database
$sql = "INSERT INTO " . USERS_TABLE . "
(user_id, username, user_email, user_password, user_pob, user_location, user_reg_date)
VALUES ('$user_id', '$username', '$email', md5('$password'), '$pob', '$pob', '$time')";$db->query($sql) or exit('An error occured while saving data.<br/><strong>Line:</strong>'. __LINE__ .'<br/><strong>File:</strong>'. __FILE__ .'<br/><strong>Cause:</strong>'.$db->error().'');
Has any one else ever had this problem? or has any one got a solution to the problem?
Thanks tunnelvision
$sql = mysql_query("INSERT INTO TABLE_NAME (Field_1, Field_2,.............etc) VALUES ('Field1_value', 'Field2_value',...........etc)") or die ("Error!");
Is worth a try. Hope it helps.
IamStang
PS.
directrix has a good point with his last comment too!
Either this should be:
$sql = "INSERT INTO " . $USERS_TABLE . "
or
$sql = "INSERT INTO USERS_TABLE
As long as you are inserting to all the fields in the table you could shorten the query to:
$sql = "INSERT INTO USERS_TABLE VALUES ('$user_id', '$username', '$email', md5('$password'), '$pob', '$pob', '$time')";