Mysql fetch object

Ceviz Viki, özgür ansiklopedi

Git ve: kullan, ara
mysql_fetch_object

Sorgudan dönen sonuç satırını nesne olarak alır.

Kullanımı;

object mysql_fetch_object ( resource $result [, string $class_name [, array $params ]] )

Örnek:

<?php
mysql_connect("hostname", "user", "password");
mysql_select_db("mydb");
$result = mysql_query("select * from mytable");
while ($row = mysql_fetch_object($result)) {
echo $row->user_id;
echo $row->fullname;
}
mysql_free_result($result);
?>

Örnek 2:

<?php
 
$row = mysql_fetch_object($result);
 
/* this is valid */
echo $row->field;
/* this is invalid */
// echo $row->0;
 
?>