A little SQL Error ... And I fail to identify it!

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

MasterchiefJB
Posts: 76
Joined: Sat Nov 07, 2009 7:43 pm

Re: A little SQL Error ... And I fail to identify it!

Post by MasterchiefJB » Tue Dec 28, 2010 6:58 pm

Thanks bangkok!

This script comes very close to my idea.

I added some code to it so you might understand my idea a littlebit better if you are interested.

The code works very well but rather than answering the result I would like to list the result in a list field.
And the search field should display every available mod entry instead of Mod1,Mod2, Mod3 (I am currently trying to figure out how to do this... no idea yet... :? ).
Attachments
AB.zip
Changed Query
(1.51 KiB) Downloaded 328 times

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

Re: A little SQL Error ... And I fail to identify it!

Post by bangkok » Wed Dec 29, 2010 7:13 am

MasterchiefJB wrote: The code works very well but rather than answering the result I would like to list the result in a list field.
And the search field should display every available mod entry instead of Mod1,Mod2, Mod3 (I am currently trying to figure out how to do this... no idea yet... :? ).

by default, a revselect returns columns separated by tab and record separated by return.

so, in your case, put this script into a button :

on mouseup
global gConnectionID
-- will return all the records from the table mods
put "SELECT ModName,UploadDate from mods" into tSQL
put revDataFromQuery(, , gConnectionID, tSQL) into theResult

-- tells LiveCode to separate items by "tab"
set itemdelimiter to tab

-- this is the list field
put empty into fld "search"


--the loop to put first item of each line of the SQL query into our list field

repeat with i = 1 to the number of lines of theResult
put item 1 of line i of theResult & CR after fld "search"
end repeat

end mouseup

To display one record, it's exactly the same idea. create several fields
make a revselect to read the record you want and then use "item" like :

put item 1 of theResult into field "modname"
put item 2 of theResult into field "updateDate"

MasterchiefJB
Posts: 76
Joined: Sat Nov 07, 2009 7:43 pm

Re: A little SQL Error ... And I fail to identify it!

Post by MasterchiefJB » Sun Jan 09, 2011 3:21 pm

Thanks bangkok!

Your code simply works great!

I am currently trying to embend Pictures into my Database, so i can import an image into my application and add it as a record to the database.
Later I would like to read the record and display the picture in a predefined field.

To be honest I don´t have a clue how to do this and I am still searching for good sources about this topic.
Any help is appreciated!

Cheers!

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

Re: A little SQL Error ... And I fail to identify it!

Post by bangkok » Sun Jan 09, 2011 3:54 pm

MasterchiefJB wrote: I am currently trying to embend Pictures into my Database, so i can import an image into my application and add it as a record to the database.
Later I would like to read the record and display the picture in a predefined field.
Any help is appreciated!
easy : blob (to store binary data in MySQL) and base64Encode and base64decode functions.

Steps here :
http://www.mail-archive.com/use-revolut ... 27732.html

And other details there :
http://forums.runrev.com/phpBB2/viewtopic.php?t=3501

MasterchiefJB
Posts: 76
Joined: Sat Nov 07, 2009 7:43 pm

Re: A little SQL Error ... And I fail to identify it!

Post by MasterchiefJB » Sat Jan 22, 2011 2:44 pm

Thanks again bangkok!

Your help is really appreciated and by now I got almost every feature working!

The last thing I have to deal with requieres further database knowledge and it seems I need help again.

This time I would like to enable the User to register to the database (Add Record Username, Password), and after that to ask the User on every app startup for the Username and the Password
and if they match to the ones in the database the app will execute as normal otherwise it will shutdown.

Post Reply