i used this solution but there is one problem!
mysql_result supported table prefixes in resultsets
SELECT a.timestamp, b.timestamp FROM table a, table b
with mysql_result, it was possible to access those results directly using
mysql_result($res,0,"a.timestamp");
while with the mysql_fetch assoc this is not possible, since the first timestamp will be overwritten by the second timestamp.
however, its possible to mimic this if you returning the results as numeric and than scan the fields of the result set like this:
function mysqli_result($result, $row, $field) {
$result->data_seek($row);
// for no table prefix just go ahead and fetch assoc
if ( strstr($field, ".") === false ) {
// Fetch result array
$data = $result->fetch_assoc();
return $data[$field];
}
// workaround for assoc use and overwriting fieldnames like "a.timestamp" and "b.timestamp"
list($tablename,$fieldname) = explode(".",$field);
$resultData = $result->fetch_array(MYSQLI_NUM);
foreach( $result->fetch_fields() as $index => $fieldData ) {
if ( $fieldData->table == $tablename && $fieldData->name == $fieldname ) {
return $resultData[$index];
}
}
return false;
}
now its possible to use this like before with mysqli_result($res,0,"a.timestamp");