PHP View-Cart

i can’t find the error please tell me if someone know this error:sob::sob:

looks like an error in your sql statement

1 Like

Line Error 35 but I cant find the error plz tell me the error
I am struglling with this error for a week

Your query is failing due to an error. You ALWASY need error handling for statements that can fail. For database statements, the easiest way of adding error handling is to use exceptions for errors and in most cases let php catch and handle the exception. To use exceptions for errors for the mysqli extension, add the following line of code before the point where you make the database connection -

1 Like

I can’t really find the error

Is this worng?

No. That particular line of code is okay.

There are 2-3 ways the sql query could think there is column named $id -

  1. The double-quotes around the sql query statement aren’t actually straight ascii quotes and php is not replacing the contents of the variable with its value. If this is the case, which is usually caused by copy/pasting things, you would need to delete and retype the double-quotes.
  2. There’s something wrong with the $ character and it isn’t being seen by php as the start of a variable name. Again, this type of error is usually caused by copy/pasting things, and you would need to delete and retype the $.
  3. The $id variable literally contains the characters $, i, and d, rather than an id value. This would most likely be caused by a problem in the ‘add to cart’ form or form processing code, where some single-quotes were used around the php variable ‘$id’, making it a string consisting of the characters $, i, and d.

Also, please don’t post pictures of your code/errors. It makes it impossible to quote parts of them in a reply. Post the actual code/errors in the forum, adding bbocde [code][/code] tags around them.

1 Like

Thanks for your advice

Sponsor our Newsletter | Privacy Policy | Terms of Service