Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

MYSQL Syntax Error - Help!

Featured Replies

I have been trying to make a user control panel and I have no idea why I keep getting MySQL Syntax errors. Here is the error: 29a81b957a91f5efa93d8b874136d3fb.png

Here is my database structure:

4fe9329df090dab7425781a046a3307d.png

And here is my code for private.php: http://pastebin.com/GL2eW6Jp

I'm trying to set scrim to 1 or 0.

Thanks in advance,

Advisor

 

Edited by Advisor

Looking at the error the syntax is wrong on the "ID =" as the first symbol after the equals sign is a single quote then the one after the number is a double quote.

 

This suggests that the code you are using is applying two different symbols rather than the same one causing the error

Looking at the error the syntax is wrong on the "ID =" as the first symbol after the equals sign is a single quote then the one after the number is a double quote.

 

This suggests that the code you are using is applying two different symbols rather than the same one causing the error

No he is using single quotes correctly (PDO is inserting these) what looks like a double quote is actult two single quotes

 

'WHERE id = '6''

 

mysql throws the error within single quotes (and is rather annoying)

 

What the OP can do is put the column names within single quotes or backticks (`) as sometimes the colum names can break a query

Edited by D4Y0

  • Author

@@D4Y0 I hope this is what you wanted:

 

UPDATE lfs
SET
email = :email ,
scrim = :scrim ,
password = :password ,
salt = :salt ,
WHERE
id = :user_id ;

Possibly an extra comma that's not needed, after salt. Edit, yeah just remove the comma after salt = :salt, as the query is expecting another value.

 

if($password !== null)
        {
            $query .= "
               password = :password ,
                salt = :salt
           ";
        }

 

Also, why not use a BOOLEAN data type for SCRIM in the DB rather than INT, if it's only ever going to be a 1 or a 0?

Edited by Lyndsey

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.