Posts: 40
Name: Bob Davis
Location: Los Angeles, CA
|
Hey guys, I'm getting a Parse error on line 8, but I don't see a problem with my syntax. Any help is much appreciated.
<?php
// this is an actual connect
$dbc = mysqli_connect("whatever.net", "testing", "password", "names") or die("Error connecting to MySQL server."); // assigns a variable name to the connect
// this is the INSERT INTO
$firstName = $_POST["firstName"]; // assigns a variable to the info from form
$lastName = $_POST["lastName"]; // assigns a variable to the info from form
$query = INSERT INTO names (firstname, lastname) VALUES ($firstName, $lastName); // assigns a variable to the INSERT INTO
// this uses the above variables to to the actual connect and INSERT INTO
$result = mysqli_query($dbc, $query) or die("Error querying database."); // issues the INSERT query on the MySQL database
// this closes the connection to the database
mysqli_close($dbc);
?>
|