Try to better organize your code that will avoid simple bugs like this. Note below how it is easier to read and troubleshoot the code. ;
missing when finalizing multiple lines.
Make sure you also interpret the error messages and look in the documentation about them. In programming mistakes happen to the hills. If there is a question you have to ask someone to get slow and tiring.
Often the error appears in one place but is in another. The compiler / interpreter can not understand intent. If it lacks a semicolon that terminates the command, then the error will only appear on the next line when it finds something strange in what it still considers the middle of the command (although you programmer intended it to be a new command). >
Mounting SQL expressions thus can be reckless in terms of security depending on where these variables come from.
In the comment it was mentioned that it would be to concatenate strings . Even if the question posed was the same, it would still have to change a lot. Not only would you have to concatenate the variable $sql
instead of using echo
, but you also need to review the organization of the text as this would not produce a correct query. I also find it strange how to determine what to concatenate.