TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-21-2008, 07:04 AM   #1 (permalink)
The Visitor
Newcomer 
 
Join Date: Oct 2008
Posts: 1
Thanks: 0
hacku is on a distinguished road
Application Error Show database to HTML multy columm

Hi Pro

I have a database. I want to show it to HTML with multi columm.

It like a gallery with image.

Please show me method to make columm like this.

Thks
hacku is offline  
Reply With Quote
Old 10-21-2008, 09:28 PM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Like this layout?

html4strict Code:
<table>
    <tr>
        <td>Image 1</td>
        <td>Image 2</td>
        <td>Image 3</td>
    </tr>
    <tr>
        <td>Image 4</td>
        <td>Image 5</td>
        <td>Image 6</td>
    </tr>
</table>
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 10-21-2008, 11:16 PM   #3 (permalink)
The Contributor
 
Join Date: Oct 2008
Posts: 75
Thanks: 4
9three is on a distinguished road
Default

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.
9three is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 07:03 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design