10-21-2008, 11:16 PM
|
#3 (permalink)
|
|
The Contributor
Join Date: Oct 2008
Posts: 75
Thanks: 4
|
You can use mysql_fetch_object function to show your information in specific columns. They will be displayed in an array(a list) format. Here is an example:
PHP Code:
<?php
//Initial MySQL connection $dbcnx = @mysql_connect('localhost', 'user', 'password'); if (!dbcnx){ exit('<p>Error: Unable to connect</p>'); }
//Connecting the proper database if (!@mysql_select_db('database_name')){ exit('<p>Error: Unable to connect to your data base</p>'); }
//Requesting our table $result = @mysql_query('SELECT from table_name'); if (!$result){ exit('<p>Error: Unable to query: ' .mysql_error(). ' </p>'); }
//Display table while ($row = mysql_fetch_object('$result')){ echo $row->info1; echo $row->info2; }
Now all you have to do is wherever you want to display a column use $row->info1 depending on the names you used in your database to display it in an array.
Last edited by 9three : 10-22-2008 at 03:32 AM.
|
|
|
|