Try to better organize your code that will avoid simple errors like this. Note below how easy it is to read and find problems in the code. Missing ;
in the completion of several lines.
Get used to also interpreting error messages and searching in the documentation about them. In programming errors happen by the piles. If every time one shows up you have to ask someone to slow down and tiring program.
Often the error appears in one place but is in another. The compiler/interpreter cannot understand intent. If a semicolon is missing that closes 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 like this can be foolhardy in terms of security depending on where these variables come from.
In the commentary it was mentioned that it would concatenate strings. Even if the problem posed in the question was this, it would still have to change a lot. Not only would I have to concatenate the variable $sql
instead of using echo
, but also needs to review the organization of the text since this would not produce a correct consultation. I also find it strange how to determine what to concatenate.
But I would like to concatenate echo s together with SELECT strings so I could not put ; after Where
– Felipe Duarte
The
;
It has nothing to do with concatenation, that’s another problem. If you want to concatenate, then concatenate, but be sure to close the command. It seems a confusing way to concatenate. Mainly usingecho
. If you are going to concatenate you have to use the variable, do not print the text.– Maniero
exactly that, thank you!
– Felipe Duarte