You are not getting the value of the object, you are just grabibng the object itself. To access the actual value of the object, you have to use the column names within each row.
$ i = 0;
while ($obj = mysql_fetch_object($result)) {
$values[$i][] = $obj->column_1;
$values[$i][] = $obj->column_2;
$values[$i][] = $obj->column_1;
}
The result would be a 2 d array, with the second demension being associative arrays.
I would use mysql_fetch-array(), essentially the same, but less confusing to use IMHO.
while ($row = mysql_fetch_object($result)) {
$values[] = $row;
}
The result would be an array that can be accessed as both a numerical array, and an associative array.
You get the values with
<?php echo $values[0]['column_name']; ?>
or, using the numerical indexes
<?php echo $values[0][0]; ?>
<?php echo $values[0][1]; ?>
ect,ect.
If you want just an associative array without the numerical indexes, then you would use
while ($row = mysql_fetch_object($result,MYSQL_ASSOC)) {
$values[] = $row;
}
$values will be a 2d array, demension 2 is associaticve. This is what you are actually trying to do in your code. You would then extract the values like
<?php echo $values[0]['column_name']; ?>
Personally, I prefer the last method, as I prefer Associative Arrays. I extract the values form within the script, then build the Input components from a class, load them all into a $FormElements array, then simply echo the $FormElements indexes to the HTML. In this way, all of my HTML takes a FormElements array. I just need to place the proper components in the FormElements Array.