Reputation: 61
I get no errors with this code but i can't insert this row on my project table. Is the problem in my date?
session_start();
$user = $_SESSION["username"];
if ( isset( $_POST["name"] )) {
$name = $_POST["name"];
}
if ( isset( $_POST["description"] ) ) {
$description = $_POST["description"];
}
if ( isset( $_POST["final"] ) ) {
$final = $_POST["final"];
}
if ( isset( $_POST["goal"] ) ) {
$goal = $_POST["goal"];
}
$sql = mysql_query("INSERT INTO project (name, description, final_date, funds, admin, goal) VALUES ('$name', '$description', '$final', '0', '$user', '$goal'");
Upvotes: 2
Views: 53
Reputation: 3328
You forgot to add a closing )
to your INSERT INTO
statement.
The correct statement looks like this:
$sql = mysql_query(
"INSERT INTO project (name, description, final_date, funds, admin, goal)
VALUES ('$name', '$description', '$final', '0', '$user', '$goal');");
BTW, you should not use mysql_*
anymore. Instead, the usage of mysqli_*
or PDO is recommended.
Upvotes: 2