Filtrating data from db in livecode
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Filtrating data from db in livecode
Hi im creating app with movie mysql database and i need somehow filtrate movies etc when someone choose Drama 90> with Morgan Freeman it will show that movies.I know how to connect to mysql with livecode retrive data and stuff but really dont know how to make it work
Thanks
Thanks
Re: Filtrating data from db in livecode
Trials and errors. Plus guidances on the web. That's the only way.
Basically you need to create a SELECT query, with the proper way -that is the SQL way- the "filters" you're talking about.
But it depends a lot of your columns structure.
-Genre : will it be a text column ? Or an integer that points to another table (join) ?
-Time : year only ? Or a precise date ?
-Actors : only the leading role ? A list ?
You have a gazillons of super web sites out there that teach SQL.
When you have a clearer view of how it works, and how you should organize your tables and your columns... then we can help you with some specific LiveCode question.
Basically you need to create a SELECT query, with the proper way -that is the SQL way- the "filters" you're talking about.
But it depends a lot of your columns structure.
-Genre : will it be a text column ? Or an integer that points to another table (join) ?
-Time : year only ? Or a precise date ?
-Actors : only the leading role ? A list ?
You have a gazillons of super web sites out there that teach SQL.
When you have a clearer view of how it works, and how you should organize your tables and your columns... then we can help you with some specific LiveCode question.
Re: Filtrating data from db in livecode
i created this http://bayimg.com/labNDaaFb which is working i just need somehow connect buttons to it that will print out movies you know ?
Re: Filtrating data from db in livecode
It is a bit difficult to understand exactly what you're trying to do. The screenshot of your app's interface is nice, but it doesn't help much.totalnoob wrote:i created this http://bayimg.com/labNDaaFb which is working i just need somehow connect buttons to it that will print out movies you know ?
From what I see, you have a list of movie TITLES that you present to the user. Underneath that list you have placed a Search field, with 2 buttons: Search by Actor, and Search by Genre. I'm guessing, that you want the user to type something, and press one of the buttons. Depending on the button pressed, you would then perform the proper search - ie, give the user a list of films based either on the genre or the actor name they entered. Is that correct?
If so, in order for us to tell you how to search your database, we have to know how your database is setup. Do you have different tables for 'Movies', 'Actors' and 'Genres'? What fields do you have in each of these tables? How are the records from one table related to the other? We cannot give you guidance without the required information...
Re: Filtrating data from db in livecode
i want make fuction called ,,movie picker"
there people will choose http://bayimg.com/JAbHCAAFc http://bayimg.com/jaBHFaAfC you know ? and it will show them movies by choosing parameters of the movie
http://bayimg.com/jabhGAaFC


Re: Filtrating data from db in livecode
Hi totalnoob (about time to leave this state!
),
I'm afraid you cannot avoid to learn some SQL for your project!
This one got me started with SQL: http://www.w3schools.com/sql/default.asp
Best
Klaus

I'm afraid you cannot avoid to learn some SQL for your project!
This one got me started with SQL: http://www.w3schools.com/sql/default.asp
Best
Klaus
Re: Filtrating data from db in livecode
i have idea
its there a way how to move data from datagrid to another datagrid on another card i have it grouped but its not working. there will be data grid on every card (invisible) and it will filtrate by movies by choosing categories and stuff and at the end it will show only that movies what you think ?
btw my code looks like
its there a way how to move data from datagrid to another datagrid on another card i have it grouped but its not working. there will be data grid on every card (invisible) and it will filtrate by movies by choosing categories and stuff and at the end it will show only that movies what you think ?
btw my code looks like
Code: Select all
on mouseUp
global gConnectionID
get revDataFromQuery(tab, return, gConnectionID, "SELECT * FROM movies WHERE Genre LIKE '%" & Drama & "%'")
set the dgText of group "datagrid 1" to it
go to next card
end mouseUp
Re: Filtrating data from db in livecode
I think that using (hidden) datagrids for this is an unneccessary and ineffective hack with too much overhead
No idea why you refuse to learn a BIT about SQL, waht you have in mind is a snap with SQL!

No idea why you refuse to learn a BIT about SQL, waht you have in mind is a snap with SQL!
