i am still deciding on the database schema, but i will have chats saved in a database table. the mysql db will constantly be updated. what would be the friendliest way to display the data from the database? should i just use php to do it? is there something easier? can soemone give me examples of code of how to display the data in a friendly, good-looking way
+1
A:
Assuming you're using PHP and MySQL and have a MySQLi connection in variable $mysqli; Database structure would look like this:
id int(7) - primary key with autoincrement , author varchar(255), timestamp timestamp (sql type), content text(0)
php code would be:
<?php
$q = $mysqli->query('SELECT id, author, UNIX_TIMESTAMP(timestamp) AS time, content FROM table';
while($row = $q->fetch_object())
echo date('l jS \of F Y h:i:s A', $row->time).'<b> <'.$row->author.'></b>: '.$row->content.'<br />;
?>
This example would output something like Sunday 2nd of January 2010 09:31:02 PM <Cypher>: Hello, dude!
cypher
2010-06-20 21:55:14
More info: http://www.php.net/manual/en/mysqli.query.phpBut yes, PHP/MySQL(i) is the easiest way to do this.As for good looking, you need to use CSS to apply styles. But PHP can set a solid layout for you simply my using html tags inside of your loop. See echo();
Jamie
2010-06-21 00:07:30