Jump to content

Null recordset


Brent_GOT
Go to solution Solved by Brent_GOT,

Recommended Posts

Hi all,

I'm very new to php/javascript etc but have made some good headway. I have a php class "functions" which amongst many things has a public function that checks a table in a mysql database for any new "instruction" records. This is triggered from a javascript function every 2 seconds. The entire process is working perfectly. If I have a record in the instruction table it retrieves it perfectly and then deletes it and returns the instruction perfectly. The problem comes in in that it then triggers 2 seconds later and returns the exact same instruction (I do set the instruction variable to '' before retrieving the record and it echos as '' before being set by the retrieved record). It's as if the recordset is cached instead of being refreshed. The same happens if there are no instructions and then I create one in phpadmin, it returns '' (ie the new instruction is not retrieved). I do free the query after each poll etc. The connection is effectively permanent and I'm not getting any errors at all. Does anyone have any ideas on how to rectify this? Ps the deletion in the table is also working perfectly if an instruction is found. There aren't any records remaining either (my basic test process to ensure things are working correctly). 

Edited by Brent_GOT
Link to comment
Share on other sites

try adding a creation timestamp to the instruction records then query

select created_time, instruction ... where created_time > :last_time_retrieved

You then have a different query each time which may prevent the caching effect. It also means you won't have to delete records enabling you to maintain a history of instructions.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.