Thank you " jmcneese" for your reply. It seems that your code will work (by the way, what is that "results" parameter after the "action" word?).
But, if I am not wrong, everytime you enter in the code, you are searching the database from scratch. This is not what I really want, because, searching will take a long time. I am looking for a solution where I search the database only once, and use that $result from the mysql_query in the subsequent calls! Since I am very new in using PHP I really don't know whether this is possible or not.
Probably I have to use a "persistent connection" but, if the user response time is very long, then the OS may cancel the connection due to time-out (is this correct?)!
I don't know whether implementing this problem by using "session" facility is OK. I have never used this facility before, but I think to use $response parameter from the MySQL call as a global variable and pass this variable to subsequent calls.
$result = msql_query("SELECT * FROM table WHERE id=1", $link);
if $response along with the $link variables may be defined as session_global and the database is connected in a persistent manner, then the problem will be solved.
Hence, I really want to know, whether the above-mentioned way works or not!