Jump to content

Customizing Dynamic Tables?


Solarpitch

Recommended Posts

Hey Guys,

I am developing an application that requires me to pull values from the database and show them up nice and pretty in a table! Ok . . that part is easy, but I want to customize the table.

To help explain what I'm on about, www.golftrader.co.uk has a perfect example. As you can see thier on the home page, each add is pulled out in a row and everything seems to be nicely positioned in each row . . ie

. . The rows stays a consistent size
. . Theres a nice tumbnail displayed with each add
. . The text seems to be consistent too

This is an exact example of the way I would like to implement it in my example! Would any of you guys be able to give me a few tips in being able to achieve this work of art?

It's probably easy to you lot!

Thanks,
Gerard. 
Link to comment
Share on other sites

It's all just html fun at the point you get the variables from the table...

You said you had no problem getting the values from the table so I can assume that you just need insight on how to style it? Just plug the variables into fancy html/css!

[code]
$result = mysql_query("SELECT * FROM table");
while ($row = mysql_fetch_array($result)) {
$imageurl = $row['imageurl'];
$title = $row['title'];
$author = $row['author'];
$date = $row['date'];
$description = $row['description'];

echo "
<div class='container'>
<div class='image'><img src='$imageurl' alt='image' /></div>
<div class='title'>$title</div>
<div class='author'>$author</div>
<div class='date'>$date</div>
<p class='description'>
$description
</p>
</div>";
}
[/code]

then you would just define the styles for the classes... you could use style tags instead of the classes in the above example... there really isn't much to it... an example of your css file could be like...

[code]
.container {
clear:both;
border-bottom:1px solid #000000;
}
.image {
float:left;
padding:3px;
border:1px solid #000000;
}
.title {
font-weight:bold;
}
[/code]
of course there would be more stylings... but your issue isn't near as much PHP as it is html/css tinkering.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.