Looking for some help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mark1954
Forum Newbie
Posts: 7
Joined: Fri Dec 17, 2021 3:39 pm

Looking for some help

Post 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
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Looking for some help

Post by Benjamin »

Line 57 should be:

Code: Select all

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