how can i get final table? I want to merge so that if it compares and there is an empty column in a record, it fills it up with the latter value. The rules are that storetype should appear only once for each user

This is probably the dirtiest piece of code I've ever done :)... and I won't even recommend it if you have more than few hundreds of records to process. Let me know as I wasn't able to check it on IDE.
<?php
$query = 'SELECT * FROM TABLE 1';
$result = mysql_query($query);
if ($result){
while ($result=mysql_fetch_array($result)){
$data[] = $row;
}
}
//
if (isset($data)){
$x=0;
$y=0;
$missingColumn = array();
while ($x < count($data)){
foreach ($data[$x] as $key=>$value){
if (empty($value)){
$missingColumn[$y][] = $key;
} else {
$output[$y][] = $value;
}
}
if ($missingColumn[$y]){
$rowComplete = FALSE;
$yetToBeCompleted = count($missingColumn[$y]);
while (!$rowComplete && $x<count($data)){
$x++;
foreach ($missingColumn as $value){
if ($data[$x][$value] <> ''){
$output[$y][$value] = $data[$x][$value];
$yetToBeCompleted--;
}
}
if (0 == $yetToBeCompleted){
$y++;
break;
//$rowComplete = TRUE;
}
}
$y++;
} else {
$y++;
$x++;
}
}
}
?>
Maybe I'm not that versatile in mysql but without any difficult data alteration techniques, I don't think that's possible.
It looks like you're grouping by username and storetype. Try running this:
select min(id), username, min(filename), min(date), min(desc), storetype,
min(password), min(email), min(ftp)
from table1
group by username, storetype
Note, of course, this will work in the case you really have the data as you displayed in your screenshot, i.e., only 1 non-null value per each username and storetype pair in each column but the id column. In that case, the id column, it looks like you chose the minimum, so the query will result in that too.