<?php
session_start();
if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; }
else { $_SESSION['count']++; }
?>
CREATE TABLE animals (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
);
INSERT INTO animals (name) VALUES
('dog'),('cat'),('penguin'),
('lax'),('whale'),('ostrich');
SELECT * FROM animals;
print "<table border = 1>\n";
print "<tr>\n";
while ($field = mysql_fetch_field($result)){
print " <th>$field ->name</th>\n";
}
print "</tr>\n\n";
while ($row = mysql_fetch_assoc($result)) {
foreach ($row as $col => $val){
print "<td>$val</td>\n";
}
print "</tr>\n\n";
}
print "</table>\n";
Object id #1 ->name Object id #2 ->name Object id #1 ->name Object id #2 ->name Object id #1 ->name