result_details
res_det_id (pk, auto_inc)
question_id
numbers
marks
character_matching
Numbers matching 5 characters are:
matching character numbers
.....
and below is the code i am using to display. It is working fine, but is it possible to make the whole thing in one query. Instead of writing a query to get max number and then looping every time, as it will take more resource and time.
But it is possible to use less queries.. and avoid those nasty queries inside the loop. What you do is do a query to get the information you need. Loop through the result set and store it in an array. Then you reference this array inside the main loop.
$results = mysql_query("SELECT `id` FROM `users` WHERE `username` LIKE '%a'") or die(mysql_error());
$ids = array();
while($array = mysql_fetch_assoc($results))
{
$ids[] = $array['id'];
}
$ids = implode(',', $ids);
$results = mysql_query("SELECT `somethingelse` FROM `table` WHERE `id` IN($ids)") or die(mysql_error());
In that example (which isn't relevant to your problem, but the coding is), we grabbed all of the `id`s in one query. That way, instead of querying for a single id each time you go through the loop, we can query for all of the `id`s in one query, and not do it inside of the loop.
Things can get much more complicated than this. But arrays are good usage in this problem.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.