Page 1 of 1

Looking for some help

Posted: Sat Dec 18, 2021 7:34 pm
by Mark1954
Hi Everyone,
I am new to this forum. I am reading this book called Joy of PHP. I am stuck with an error and can't see where the problem is.
First the error that I am getting: Parse error: syntax error, unexpected token "echo" in C:\Apache24\htdocs\Joy\createdb.php on line 59

Now here is the area of the code that is the problem.

Code: Select all

52 $query = "INSERT NTO `Cars`.`inventory`
(`VIN`, `YEAR`, `Make`, Model`, `TRIM`, `EXT_COLOR`, `INT_COLOR`, `ASKING_PRICE`, `SALE_PRICE`, `PURCHASE_PRICE`, `MILEAGE`, `TRANSMISSION`, `PURCHASE_DATE`, `SALE_DATE`)
54 VALUES
55 (`5FNYF4H91CB054036`, `2012`, `Honda`, `Pilot`, `Touring`, `White Diamond Pearl`, `Leather`, `37807`, NULL, `34250`, `7076`, `Automatic`, `2012-11-08`, NULL)";

57	if($mysqli->query($query) === TRUE
58 {
59	echo "<p>Honda Pilot inserted</p>";
60 }
else
{
	echo "<p>Error inserting Honda Pilot:</p>".$mysqli->error;
	echo"<p>*********</p>";
	echo $query;
	echo "<p>**********</p>";
}
The numbers on the left are the numbers used by notepad++
Any help is appreciated.
Mark

Re: Looking for some help

Posted: Sat Dec 18, 2021 8:22 pm
by Benjamin
Line 57 should be:

Code: Select all

if ($mysqli->query($query) === TRUE)