I got a table with columns but i'm trying to update the 'img' column to a specific image.
This is what I tried :
UPDATE employees
SET img="(LOAD_FILE('C:/Users/Test/Desktop/Test.png')"
WHERE wname='Foo';
Sadly enough the picture doesn't get converted to a real image.
You are using LOAD_FILE in wrong manner, Try this :
UPDATE employees
SET img=LOAD_FILE('C:/Users/Test/Desktop/Test.png')
WHERE wname='Foo';
See detail : http://dev.mysql.com/doc/refman/5.1/en/string-functions.html#function_load-file
In you query you are just setting the value of img as
"(LOAD_FILE('C:/Users/Test/Desktop/Test.png')" because of the double coats.
So instead of file being uploaded path location is being inserted
"(LOAD_FILE('C:/Users/Test/Desktop/Test.png')"
#Sagar Joon is absolutely right you have do the way he is saying.
Related
I'm using python-docx to edit an existing word file. I've created a simpler case where it also fails starting with a blank document. Adding a picture to a cell in a table works just as expected. But if I want to copy that table, there seems to be a problem when I add an image to the new table. I've looked elsewhere, but this problem seems to be unique to copied tables only.
from copy import deepcopy
from docx import Document
doc = Document()
table1 = doc.add_table(rows=2, cols=2)
table1.style = 'TableGrid'
table2 = deepcopy(table)
table2._tbl = deepcopy(table1._tbl)
p = doc.add_paragraph()
p._p.addnext(table2._tbl)
# Add image to table 1
cell = table1.rows[0].cells[0]
cell.paragraphs[0].add_run().add_picture("picture.png", width=Cm(10))
# Add image to table 2
cell = table2.rows[0].cells[0]
cell.paragraphs[0].add_run().add_picture("picture.png", width=Cm(10))
doc.save("t.docx")
Problem: If I add the same image to both, it will appear correct. If I add it to only table 1, it also works. But if I add it to the copy, then it fails and looks like this:
It seems to be something that is different in the second, copied table. I know it looks like a hack the way it was created. I did it this way because, in my original document, the table is quite complex and needs to be duplicated for each case.
(Edit: added missing deepcopyimport)
So the thing is that I have the following question:
Display the column Brand from the table clothing where length(Brand)=10.
So I used the query: select Brand from clothing where length(Brand)=10;
This gives me the out put as an empty set, so I checked my table to see if it was actually supposed to give an empty set and the answer was no.
So if anyone would be able to tell what's going wrong then that would be of great help
The images for the table and the input I tried are given below.
Table image and the input I gave
So there is a page that I want to perform some action on with puppeteer. The problem is that there is a text area in which I want to type in something however the id of it is :
id="pin-draft-title-13a10e18-5a1e-49b9-893c-c5e028dc63e1"
As you might have guess for some reason only pin-draft-title remains the same but the whole number part changes for every refresh so puppeteer can't find it. I tried deleting the id and copying the selector itself the whoe #_Root div>div etc but that seems to be changing after sometime as well. So the main question is is there any way i can just select it using the pin-draft-title part and no matter what numbers follow it still selects it ?
You can use [id^=pin-draft-title-]
In case of javascript, if you want to select all the elements whos ID starts with a specified string or pattern, in your case "pin-draft-title", then consider using the following syntax.
document.querySelectorAll('[id^="pin-draft-title"]');
so I'm creating a report that contains an image field which gets its value from the database. What I'm trying to achieve is to display simple text saying "No image found!" in place of the image if its field value is null or blank in the database. Following is the expression I've written :-
=iif(IsNothing(Fields!EmployeeImage.Value) Or Fields!EmployeeImage.Value = "","No image found!",Fields!EmployeeImage.Value)
Would really appreciate it if someone can help or guide me in the right direction.
When I have done htis in the past, I have stored an image called 'NoImage.png' for exmaple. The noimage image it the typical image you see, something like this.
Then you just need to point to this image if none is found. I usually do this in the database itself.
I have one table, and I need to remove a specific text from a specific field. This field contains a full URL of an image, I need to remove the URL and just keep the image filename.
So:
Current date: fieldname: www.example.com/photo.jpg
What I want to do is remove www.example.com/ from all of the entries for this field.
I know how to use the search and replace function, but I don't know how to leave part of the data intact.
This is what I've used but can't modify it to make it work the way I want:
UPDATE table SET oc_upload1 = REPLACE(oc_upload1,'newtext') WHERE oc_upload1 LIKE "oldtext"
Is this possible? If so, how? Thank you!
This should do:
UPDATE table
SET image = REPLACE(image, 'www.example.com/','')
but, it's possible that image contains 'www.example.com/' as part of image file name so to be extra safe and replace only the first occurence of www.example.com
UPDATE table
SET image = SUBSTRING(image, LENGTH('www.example.com/') + 1)
WHERE image LIKE 'www.example.com/%'
But if You really, really just want the file name and not path to the file You can also use:
UPDATE table
SET image = SUBSTRING_INDEX(image,'/',-1)
Note that above statement will change 'www.example.com/images/01/02/daisy.jpg' to 'daisy.jpg', not 'images/01/02/daisy.jpg'. It also wont change rows that does not contain '/' in image.