Php sqlite query error next to syntax error

Hi, I am new to sqlite. I am trying to query sqlite database with php but ** next to syntax error **

here is the request:

"
  INSERT  INTO selectedObject ( museum , atwork , beaconCode , qrCode)
  VALUES ('".$museo."','" .$opera."','".$codiceBeacon."', '".$codice_qr_random."')
  WHERE NOT EXISTS(
                    SELECT museum , atwork
                    FROM selectedObject
                    WHERE museum = '".$museo."' AND atwork = '".$opera."'

                  )";

what happened?

+4
source share
1 answer

Sqlite supports composite primary keys, so I will show this in the Guide from this link :

The CREATE TABLE command indicates the following attributes of the new table:

...

Optional, PRIMARY KEY for the table. Both columns and compound (multiple columns).

, , , sqlite OR IGNORE duplicate clash, .

, :

INSERT OR IGNORE INTO selectedObject ( museum , atwork , beaconCode , qrCode)
  VALUES ('".$museo."','" .$opera."','".$codiceBeacon."', '".$codice_qr_random."');

(), update .

? , INSERT - , . , 3 4. , , .

, , .

duplicate clash , , ( ).

+1

Source: https://habr.com/ru/post/1606824/


All Articles