SELECT tblstud.studid,
tblsched.ip
FROM tblstud
LEFT JOIN tblstudsched ON (tblstud.studid=tblstudsched.studid)
LEFT JOIN tblsched ON (tblstudsched.schedid=tblsched.schedid)
WHERE tblstud.rfidid='".$rfid."'
AND tblsched.ip='".$ip."'
AND EXISTS
(SELECT tblsched.schedid
FROM tblsched
INNER JOIN tblstudsched
WHERE tblstudsched.schedid=tblsched.schedid
AND NOW() BETWEEN tblsched.timein AND tblsched.timeout)
This is my code so far and it is designed to be done after Arduino microcontroller sends data to PHP. IT takes me about 8 seconds before another data is to be accepted. I haven't checked the Arduino side but I think it's fast enough when I did another different mysql query but that one is relatively shorter than the one above.
The tables are in Inno DB but I'll try MyISAM later since the latter is the best when there are more readings than adding data.
The data types are Varchar with ranges varying from 3-30 characters each.
I'm confident also with the speed of the laptop I'm using.