0
use work;
update applicants
set photo = (load_file("C:\Users\CEO\Pictures\MY PHOTOS\OT.jpg"))
where ID = 2001;

When I execute the query in MySQL workbench, it runs successfully, displaying 0 row(s) affected Rows matched: 1 Changed: 0 Warning

But when I decide to view my table records, the value under the photo column in ID 2001 row is NULL

I think my file name is supposed to show in my photo column instead of null.

I have made several researches to see and even changed my code to set photo = OT.jpg, using only the file name but it's still not working.

My photo datatype is BLOB, the size of my photo is 997kb

Please kindly assist me with the right STEPS if you can. I want the procedure STEP BY STEP to resolve this please.

I expect my records to show the values and my photo value to be my file name, it shouldn't be showing NULL again on the displayed table record in mysql workbench and command line

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
CCCC
  • 241
  • 2
  • 10
  • Try `set photo = (load_file("C:/Users/CEO/Pictures/MY PHOTOS/OT.jpg"))` – RiggsFolly Feb 01 '19 at 14:00
  • @RiggsFolly thanks for your contribution. I just tried your suggestion by using the forward slash, still when I tried to see my record, the photo column is still showing NULL. – CCCC Feb 01 '19 at 14:27
  • Possible duplicate of [How to use LOAD\_FILE to load a file into a MySQL blob?](https://stackoverflow.com/questions/8229951/how-to-use-load-file-to-load-a-file-into-a-mysql-blob) – Matthew Page Feb 01 '19 at 14:44
  • Is the column a BLOB or a LONGBLOB? BLOB only allows up to 65k – RiggsFolly Feb 01 '19 at 14:51
  • @RiggsFolly the datatype is a BLOB .... I also tried using another photo with a png extension with memory size of 59kb, it still showed NULL in the photo comment when I tried to view my records. – CCCC Feb 01 '19 at 14:56
  • I have resolved it... The query for the photo isn't supposed to have load_file, that was what was causing the issue. With the datatype being varchar(255) or BLOB, the query is just supposed to be (update applicants ....set photo = ('c:\users\photo\Tj.jpg').... Plz I'm replying via mobile phone thus can't really give the right spacing. Kindly pardon me – CCCC Feb 05 '19 at 19:02
  • I have resolved it... The query for the photo isn't supposed to have load_file, that was what was causing the issue. With the datatype being varchar(255) or BLOB, the query is just supposed to be (update applicants ....set photo = ('c:\users\photo\Tj.jpg').... Plz I'm replying via mobile phone thus can't really give the right spacing. Kindly pardon me – CCCC Feb 05 '19 at 19:07

0 Answers0