Hi Jan,i got it work finally.And sorry before,i didn't try your codes yet..I got this code from
PHP and MySQL coding tips - Page 8 - SitePoint Forums
This is the code what i got
$mysqli = new mysqli($dbHost, $dbUsername, $dbPassword, $dbDatabase);
$stmt = $mysqli->prepare('select * from foobar');
$stmt->execute();
$stmt->store_result();
// this returns info about the query, script uses the
// $meta->name to create an array with the key's as
// the column names
$meta = $stmt->result_metadata();
// this needs to be $bindVarArray[] = &$results[$column->name];
// rather than $results[$column->name] = NULL, when using
// call_user_func_array it needs the &, I'm not sure why
while ($column = $meta->fetch_field()) {
$bindVarArray[] = &$results[$column->name];
}
call_user_func_array(array($stmt, 'bind_result'), $bindVarArray);
$stmt->fetch();
echo var_dump($results);
// outputs:
//
// array(3) {
// ["id"]=>
// &int(1)
// ["foo"]=>
// &string(11) "This is Foo"
// ["bar"]=>
// &string(11) "This is Bar"
// }
i modified it this way because i'm using a function
function get_member()
{
$handle=db_connect();
//$sql="Select email,nama,alamat,kota,propinsi from users where email='yonghan79@gmail.com'";
$sql="Select id,email,nama,alamat,kota,propinsi from users where email=?";
//$hasil=$handle->query($sql);
//$result=$hasil->fetch_array();
$stmt=$handle->prepare($sql);
$mail='yonghan79@gmail.com';
$stmt->bind_param("s",$mail);
$stmt->execute();
$stmt->store_result();
// this returns info about the query, script uses the
// $meta->name to create an array with the key's as
// the column names
$meta = $stmt->result_metadata();
// this needs to be $bindVarArray[] = &$results[$column->name];
// rather than $results[$column->name] = NULL, when using
// call_user_func_array it needs the &, I'm not sure why
while ($column = $meta->fetch_field()) {
$bindVarArray[] = &$results[$column->name];
}
call_user_func_array(array($stmt, 'bind_result'), $bindVarArray);
$stmt->fetch();
return $results;
}
As for the tes.php,i did'nt modify..Thanks a lot jan. :)