Having a tough time with Data Grid Forms + MySQL
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Having a tough time with Data Grid Forms + MySQL
I'm having a tough time with Data Grid Forms + MySQL. It seems like I get close, but not close enough. Does anyone have a sample data grid forms + mysql link or have a demo on their server? I've viewed the tutorials I found on the LiveCode website, but surely somewhere there's on that combines data grid forms and mysql. Been trying this all day. lol.
Re: Having a tough time with Data Grid Forms + MySQL
Hi Shawn,
You have used this example:
http://lessons.runrev.com/m/4071/l/3051 ... e-database
Changing that over to mysql is not hard, just have to set it up right.
Simon
You have used this example:
http://lessons.runrev.com/m/4071/l/3051 ... e-database
Changing that over to mysql is not hard, just have to set it up right.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Having a tough time with Data Grid Forms + MySQL
I'll give that one another shot. I'm not having any problems connecting to the database though, in fact even once I was pulling data from the database, but it wasn't aligned according to the data grid form template. I'm close, but still not there.
Re: Having a tough time with Data Grid Forms + MySQL
I guess this one is more appropriate;
http://lessons.runrev.com/m/4071/l/7003 ... l-database
but the last time I did it (months ago) there was a problem with;
I think I fixed it by changing
put "runrev_example" into tDatabaseUser
to
put "runrev_test" into tDatabaseUser
Or maybe it was the line above to change to "..._example"
Simon
Edit: I think they fixed it because it was this lesson which used to be different in those names:
http://lessons.runrev.com/m/4071/l/1659 ... grid-array
Wait a sec! That is the lesson you want.
http://lessons.runrev.com/m/4071/l/7003 ... l-database
but the last time I did it (months ago) there was a problem with;
Code: Select all
put "runrev.com" into tDatabaseAddress
put "runrev_test" into tDatabaseName
put "runrev_example" into tDatabaseUser
put "example" into tDatabasePassword
put "runrev_example" into tDatabaseUser
to
put "runrev_test" into tDatabaseUser
Or maybe it was the line above to change to "..._example"
Simon
Edit: I think they fixed it because it was this lesson which used to be different in those names:
http://lessons.runrev.com/m/4071/l/1659 ... grid-array
Wait a sec! That is the lesson you want.
Last edited by Simon on Wed May 21, 2014 3:32 am, edited 1 time in total.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Having a tough time with Data Grid Forms + MySQL
Like I mentioned above I was pulling data, but it wasn't aligning right in the data grid form template. I edited it, and now I'm not pulling any data. Still have a good db connection.
I think this is where I'm making my errors.
I think this is where I'm making my errors.
Code: Select all
on FillInData pDataArray
-- This message is sent when the Data Grid needs to populate
-- this template with the data from a record. pDataArray is an
-- an array containing the records data.
-- You do not need to resize any of your template's controls in
-- this message. All resizing should be handled in resizeControl.
-- Example:
--set the text of field "Label" of me to pDataArray["label 1"]
set the text of fld "lblDate" of me to pDataArray["date"]
set the text of fld "lblTitle" of me to pDataArray["title"]
set the text of fld "lblMessage" of me to pDataArray["message"]
end FillInData
Code: Select all
on LayoutControl pControlRect
local theFieldRect
-- This message is sent when you should layout your template's controls.
-- This is where you resize the 'Background' graphic, resize fields and
-- position objects.
-- For fixed height data grid forms you can use items 1 through 4 of pControlRect as
-- boundaries for laying out your controls.
-- For variable height data grid forms you can use items 1 through 3 of pControlRect as
-- boundaries, expanding the height of your control as needed.
-- Example:
--put the rect of field "Label" of me into theFieldRect
put item 3 of pControlRect - 5 into item 3 of theFieldRect
--set the rect of field "Label" of me to theFieldRect
put the rect of fld "lblDate" of me into theFieldRect
put the rect of fld "lblTitle" of me into theFieldRect
put the rect of fld "lblMessage" of me into theFieldRect
set the rect of fld "lblDate" of me to theFieldRect
set the rect of fld "lblTitle" of me to theFieldRect
set the rect of fld "lblMessage" of me to theFieldRect
set the rect of graphic "Background" of me to pControlRect
end LayoutControl
Re: Having a tough time with Data Grid Forms + MySQL
ooops they should be interspersed
otherwise they all end in the same location
Simon
Code: Select all
put the rect of fld "lblDate" of me into theFieldRect
set the rect of fld "lblDate" of me to theFieldRect
put the rect of fld "lblTitle" of me into theFieldRect
set the rect of fld "lblTitle" of me to theFieldRect
put the rect of fld "lblMessage" of me into theFieldRect
set the rect of fld "lblMessage" of me to theFieldRect
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Having a tough time with Data Grid Forms + MySQL
Let me try that Simon. I'll update. Thank you.
Re: Having a tough time with Data Grid Forms + MySQL
Pulling data again Simon! You're the man! Now let me tweak my SQL statements and continue playing around with it. Thank you Simon! These data grids will give you headache!
Re: Having a tough time with Data Grid Forms + MySQL
Hi Shawn,
Yeah, DataGrids should come with a warning label!
Glad you got it working.
Simon
Yeah, DataGrids should come with a warning label!

Glad you got it working.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Having a tough time with Data Grid Forms + MySQL
Simon, quick question if you're still around. If I want to have replies to messages, I'd need another template or would I modify the current template? In the meantime I'll try it out.
Re: Having a tough time with Data Grid Forms + MySQL
hi Shawn,
I think you'd use another table because there may be many replies and "inner join;
http://www.w3schools.com/sql/sql_join_inner.asp
Bookmark that.
Simon
I think you'd use another table because there may be many replies and "inner join;
http://www.w3schools.com/sql/sql_join_inner.asp
Bookmark that.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!