austin101
15 Jul 2010, 11:36 AM
I get Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING on line 14
<?php
session_start();
if(isset($_POST['firstname']))
{
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
//-----------------------------------------Line 14
require_once("/scripts/connect.php")
$mysqli = new $myConnection;
//-----------------------------------------Check Connection
if ($mysqli->mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "INSERT INTO (firstname,lastname,address,city,state,zip,phone)
VALUES ('.$firstname.','.$lastname.','.$address.','.$city.','.$state.','.$zip.','.$phone.')";
$mysqli_query($query);
printf ("New Record has id %d.\n", $mysqli_insert_id);
/* close connection */
$mysqli_close();
?>
connect.php
<?php
$db_host = "hidden";
$db_username = "hidden";
$db_pass = "hidden";
$db_name = "hidden";
// Run the connection here
$myConnection = mysqli_connect("$db_host","$db_username","$db_pass", "$db_name") or die ("could not connect to mysql");
?>
<?php
session_start();
if(isset($_POST['firstname']))
{
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$phone = $_POST['phone'];
//-----------------------------------------Line 14
require_once("/scripts/connect.php")
$mysqli = new $myConnection;
//-----------------------------------------Check Connection
if ($mysqli->mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "INSERT INTO (firstname,lastname,address,city,state,zip,phone)
VALUES ('.$firstname.','.$lastname.','.$address.','.$city.','.$state.','.$zip.','.$phone.')";
$mysqli_query($query);
printf ("New Record has id %d.\n", $mysqli_insert_id);
/* close connection */
$mysqli_close();
?>
connect.php
<?php
$db_host = "hidden";
$db_username = "hidden";
$db_pass = "hidden";
$db_name = "hidden";
// Run the connection here
$myConnection = mysqli_connect("$db_host","$db_username","$db_pass", "$db_name") or die ("could not connect to mysql");
?>