I guess I've been using fetch_array and fetch_assoc so much I kinda forgot how they worked exactly.
Here's how I normally access a table.
Hypothetical Table
table_id,name,type,status
So my "procedural" way of getting the data is like so:
PHP Code:
$results = mysql_query("SELECT * FROM table");
$count = mysql_num_rows($results);
for($i=0;$i<$count;<$i++) {
$rows = mysql_fetch_array($results);
$table_id = $rows['table_id'];
$name = $rows['name'];
$type = $rows['type'];
$status = $rows['status'];
echo "$table_id, $name, $type, $status <br />";
}
As you can see that's pretty straightforward. So I was hoping to accomplish the same thing the OO way....
$db->query("SELECT * FROM table");
$db->num_rows();
$db->fetch('row'); //pass 'row' as the parameter to access mysql_fetch_row function....
for($i=0;$i<$db->num_rows();<$i++) {
$rows = $db->fetch('row');
$table_id = $rows['table_id'];
$name = $rows['name'];
$type = $rows['type'];
$status = $rows['status'];
echo "$table_id, $name, $type, $status <br />";
DOESNT WORK-----^
}
So now how do I actually access the values in the returned rows like I did the procedural way?
Sorry, my transition from proc to OO is a little shaky...