hello !

mysql_fetch_object() is like mysql_fetch_array() but it returns an 
object and not an array. so you can access field through this syntax :

$obj->fieldname (i.e $obj->amount)

you can provide a second parameter to this function :


if you use MYSQL_NUM or MYSQL_BOTH, you should be able to access fields 
through the column number... but how since in an PHP object a variable 
could not begin by a numerical character (i.e $obj->0, $obj->1... is 
forbidden) ?

if you use get_object_vars($obj) and print the object's properties, you 
could see this for example (MYSQL_BOTH used) :

0 = 'titi'
columnName1 = 'titi'
1 = 2
columnName2 = 2

so here $obj->columnName1 returns 'titi' and $obj->columnName2 returns 2 
but if i want to use numerical entries how to keep the object access 
behavior like $obj->... ? is it possible ? if not we should use a loop
with get_object_vars($obj) ? nothing more simple and beautiful ?

thanks for your feeebacks.



PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to