Kaka
Kaka

Reputation: 37

How can i update if MYSQL [BLOB] is NULL

How can i update if Image field in MYSQL is empty or no image is uploaded?

I tried this but doesnt update anything.

     UPDATE `db`.`ts126` SET `Image` = LOAD_FILE('C:\Users\user\Desktop\aa\bb\cc\placeholder.png') WHERE Image="" 

Also i tried

    UPDATE `db`.`ts126`
   SET `Image` = 'C:\Users\user\Desktop\aa\bb\cc\placeholder.png'
 WHERE Image="" OR Image IS NULL

Which is without LOAD_FILE in this case it updates the images [BLOB - 64 B] but When i display the image using PHP code Nothing shows up

Upvotes: 0

Views: 1040

Answers (1)

Martin
Martin

Reputation: 6687

Try:

UPDATE `db`.`ts126`
  SET `Image` = LOAD_FILE('C:\Users\user\Desktop\aa\bb\cc\placeholder.png')
WHERE Image="" OR Image IS NULL

Upvotes: 1

Related Questions