I have a simple query that I'm using to insert a record based on a form submission, but it's not writing the record to the database. It's also not throwing an error. I used a var_dump and verified that the variables are posting correctly, so I think the issue is in the query syntax, but I've checked that too.
Any help or guidance is greatly appreciated. Here is the code:
if (isset($submit)){
$user_id = $_SESSION['user_id'];
$anthem1 = $_POST['anthem1'];
$cointoss2 = $_POST['cointoss2'];
$query = "INSERT INTO mypicks (";
$query .= " user_id, anthem1, cointoss2";
$query .= ") VALUES (";
$query .= " '{$user_id}', '{$anthem1}', '{$cointoss2}'";
$query .= ")";
$result = mysqli_query($connection, $query);
}
$submit
value? (var_dump( $submit );
)or die(mysql_error($connection))
to the end ofmysqli_query($connection, $query)
to get your error message, ie.$result = mysqli_query($connection, $query) or die(mysql_error($connection));