SQL Query Not Functioning - No Error Message
Posted
by gamerzfuse
on Stack Overflow
See other posts from Stack Overflow
or by gamerzfuse
Published on 2010-03-23T01:51:34Z
Indexed on
2010/03/23
2:01 UTC
Read the original article
Hit count: 448
// Write the data to the database
$query = "INSERT INTO staff (name, lastname, username, password, position,
department, birthmonth, birthday, birthyear,
location, phone, email, street, city, state, country,
zip, tags, photo)
VALUES ('$name', '$lastname', '$username', '$password', '$position',
'$department', '$birthmonth', '$birthday', '$birthyear', '$location',
'$phone', '$email', '$street', '$city', '$state', '$country',
'$zip', '$tags', '$photo')";
mysql_query($query);
var_dump($query);
echo '<p>' . $name . ' has been added to the Employee Directory.</p>';
if (!$query) {
die('Invalid query: ' . mysql_error());
}
Can someone tell me why the above code produced:
string(332) "INSERT INTO staff (name, lastname, username, password, position, department, birthmonth, birthday, birthyear, location, phone, email, street, city, state, country, zip, tags, photo) VALUES ('Craig', 'Hooghiem', 'sdf', 'sdf', 'sdf', 'sdf', '01', '01', 'sdf', 'sdf', '', 'sdf', 'sdf', 'sd', 'sdf', 'sdf', 'sd', 'sdg', 'leftround.gif')"
Craig has been added to the Employee Directory.
But does not actually add anything into the database table "staff" ?
I must be missing something obvious here.
© Stack Overflow or respective owner