Q:

How get all two array values using select query at once

I want to get Name and corresponding Score at the latest time. So I tried:
    $queryObj = mysql_query("SELECT `Name`,`Score` from `Table`.`Score` where `Date` = (    SELECT max(`Date`)    from `Table`.`Score`) and `Name`<>'' "); 

then get value from it by:
  while( $obj = mysql_fetch_object( $queryObj ) )  {
  $data = array();
  $data['Name'] = $obj->Name;
  $data['Score'] = $obj->Score;
  $searches[] = $data;
  }

But when I print :
    print_r(array_values($searches));

the first value is missing in the array, so that won't be the right way.
I also tried:
    $row = mysql_fetch_assoc($queryObj);
    for ($i = 0; $i <3; $i++)
    print( $row['Name'][$i]." Score: ".$row['Score'][$i]."<br />\n");

But it won't give me the right results also. How do I get the value from that query? (the query is correct, I tested it). Any body has suggestion ?
Edit: I add my sample data here:
Name   Score      Date
abc     3   2013-08-29 10:11:47
abc     2   2013-08-29 09:39:23
abc     1   2013-08-28 10:22:28
jane    2   2013-08-29 09:39:23
        2013-08-29 10:08:36
jane    1   2013-08-29 10:11:47
tarzan  1   2013-08-29 10:11:47

Note: Yes, there is some blank values.
My expected result would be:
abc score 3
jane score 1
tarzan score 1

A:

Ok, so after you have updated your question and provided what you expect, your query should look like this:
SELECT t1.Name, t1.Score 
FROM Table.Score t1
INNER JOIN
(
    SELECT max(Date) MaxDate, Name, Score
    FROM Table.Score
            WHERE Name <> ''
    GROUP BY Name
) t2
    ON t1.Name = t2.Name AND t1.Date = t2.MaxDate

This will give you pairs of Name and Score for each Name with Score based on his latest Date (1 row per Name).
So replace your original query with mine in this line:
$queryObj = mysql_query(" ... "); 

Then:
$rows = array();

while($row = mysql_fetch_assoc($queryObj)) {
    $rows[$row['Name']] = $row['Score'];
}

And you can nicely foreach it in the exact way you wanted in your last comment:
foreach($rows as $name => $score) {
    echo $name . ' - ' . $score . "\n";
} 

