Retrieve images from mySql

Creating desktop or client-server database solutions?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
steve_nam
Posts: 60
Joined: Wed Jan 08, 2014 1:09 pm
Location: Windhoek, Namibia

Retrieve images from mySql

Post by steve_nam » Mon Sep 29, 2014 4:05 pm

I have spent a big chumk of my days reading this forum, stackoverflow and any LiveCode resource I could find, but I am still unable to solve my challenge (namely the fact that I am not quite up to standard with LiveCode, but I am definitely getting there).

The only solution is to ask the Gurus in the Forum.

Anyone willing to help me retrieving an image from a mySql database?

Here is my situation.
I can query the database successfully. My query displays all requested data exactly as I wanted.

set the ItemDel to tab
put item 1 of tRecord && item 2 of tRecord into field "surname"
put item 3 of tRecord into field "IDpassport"
put item 4 of tRecord into field "citizenship"

when I want to put item 5 of tRecord into field "photo" I get an error (no such object) near "photo"

Anyone interested to assist and teach me the correct and proper way.

Cheers
Steve

Klaus
Posts: 11313
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Retrieve images from mySql

Post by Klaus » Mon Sep 29, 2014 5:24 pm

Hi Steve,

I hardly dare to ask, but do you really have a FIELD named "photo" or is it maybe an IMAGE? 8)

Anyway, how are the image data in the database encoded, if at all?
This is what we need to know.


Best

Klaus

steve_nam
Posts: 60
Joined: Wed Jan 08, 2014 1:09 pm
Location: Windhoek, Namibia

Re: Retrieve images from mySql

Post by steve_nam » Mon Sep 29, 2014 6:29 pm

Klaus,
You are so kind and helpful in the Forum....always willing to assist. Thanks a million (from me and all other rookie LiveCoders).

Well you're right. It is an image. When I write "put item 5 of tRecord into image "photo""the error (no such object) near "photo" does not exits anymore. But still no photo makes its appearance.

Your next question: "how are the image data in the database encoded, if at all?" Tricky one to answer. How do I find out if the image data is encoded or not? The image is stored as a "blob" .

Regards,
Steve

Klaus
Posts: 11313
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Retrieve images from mySql

Post by Klaus » Mon Sep 29, 2014 9:31 pm

Hi Steve,

OK, try:
...
set the text of img "photo" to item 5 of tRecord
...

But since BLOB means BINARY, I'm not sure if this will work at all with the CR and TAB delimiter in your data!?
Binary stuff is still a mistery to me, but maybe this binary data are MULTILINE, then this will not work, know what I mean?


Best

Klaus

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 837
Joined: Fri Aug 15, 2008 7:15 am

Re: Retrieve images from mySql

Post by bangkok » Tue Sep 30, 2014 8:01 am


steve_nam
Posts: 60
Joined: Wed Jan 08, 2014 1:09 pm
Location: Windhoek, Namibia

Re: Retrieve images from mySql

Post by steve_nam » Tue Sep 30, 2014 8:09 am

Klaus
Thanks a million for your assistance. I will post the outcome of everything in the forum.

Bangkok, I will browse the links you posted.

Thanks you Gurus
Steve

steve_nam
Posts: 60
Joined: Wed Jan 08, 2014 1:09 pm
Location: Windhoek, Namibia

Re: Retrieve images from mySql

Post by steve_nam » Thu Oct 16, 2014 7:50 am

Hi, check out the Lesson created to sort this challenge out. http://lessons.runrev.com/m/4071/l/2633 ... a-database
It will certainly help a lot of LiveCoders.

Enjoy
Steve

Post Reply

Return to “Databases”