Your code snipper it very brief. It might help if you posted the dbGet function, for example. Are you sure that myRecords is an array? You can check this with
if myRecords is an array then
It isn't clear which row and column delimiters you use, but I assume they are linefeed and tab. You might do the following:
dbcolumns "day,month"
put dbGet("giortes") into myRecords
if myRecords is not an array then split myRecords by return and tab
repeat for each key tKey in myRecords
put myRecords[tKey]["day"] &"/"& myRecords[tKey]["month"] & cr after myGiortes[1]
end repeat
Obviously, this only works if myRecords not being an array is the culprit. If there is a problem with your SQL syntax, myRecords could be empty or contain different keys.
If myRecords actually is an error and you just want to find the tkey's for which day=12 and month=8, you can adjust your repeat loop:
repeat for each key tKey in myRecords
if myRecords[tKey]["day"] is 12 and myRecords[tKey]["month"] is 8 then
put myRecords[tKey]["day"] &"/"& myRecords[tKey]["month"] & cr after myGiortes[1]
end if
end repeat
You might also do this directly using the correct SQL syntax on the database:
put "SELECT * FROM giortes WHERE day='12' AND month='8'" into mySQL
// I start variables with "my", it isn't a reference to MySQL
put revDataFromQuery(cr,tab,gDatabaseID,mySQL) into myGiortes
if myGiortes begins with "revdberr" then
beep
answer error myGiortes
else
split myData by cr and tab
end if
You also need to make a connection with revOpenDatabase. For this, you need to know the path to the SQLite file.
put revOpenDatabase("sqlite",mySQliteFilePath,,,) into gDatabaseID
After this line, you can run the previous code snipper. Declare gDatabaseID as a global variable at the top of the script.
Update 1
If you prefer to use Andre's database, you can use the dbWhere command:
set the itemDel to slash
put item 1 of the date into myMonth
put item 2 of the date into myDay
dbColumns "day,month,id" // I have added id
dbWhere "month",myMonth
dbWhere "day",myDay
put dbGet("giortes") into myGiortes
dbResetQuery
This should be sufficient to answer your question. You need no repeat loop any more. I just wonder why you would want this, because now you only get a list like:
1 12,8
2 12,8
3 12,8
etc
If you want to know the number of records, you might want to use SQLite's COUNT function instead.
Update 2
I have changed the code under "Update 1". If you are indeed just looking or the ID of a person who has his birthday today, then you can use dbColumns "id"
instead of dbColumnds "day,month,id"
. This would make much more sense, because the sample data in my previous example are useless. If you run the modified code, you should get data similar to
1 12,8,1
2 12,8,11
3 12,8,23
etc
i.e. the last column contains the ID numbers. You could also just retrieve the ID numbers. if you do that, you get
1 1
2 11
3 23
etc