/    Sign up×
Community /Pin to ProfileBookmark

dynamic table rows

I have the below code for getting results from my mysql database:

[code]
while ($row = mysql_fetch_assoc($result)) {
$id = $row[‘id’];
$name = $row[‘name’];
$description = $row[‘description’];
$price = $row[‘price’];
$image = $row[‘image’];
?>
<div class=”listings”>
<div class=”column1″>
<img src=”<?=$image;?>” width=”150px” height=”150px” alt=”<?=$name;?>” />
<br />
<h4><?=$name;?></h4>
<p>
<?=$description;?>
<br />
<strong>Price:</strong> $<?=$price;?>
</p>
<div style=”width:150px; “>
<div style=”float:left; width:75px;”>
<p>
<a href=”update_product.php?catg=<?=$catg;?>&amp;product_id=<?=$id;?>”>Edit</a>
</p>
</div>
<div style=”float:right; width:75px;”>
<p>
<a href=”delete_product.php?product_id=<?=$id;?>”>Delete</a>
</p>
</div>
</div>
</div>
</div>
<?
}
// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
mysql_close($connect);
?>
[/code]

This shows fine on some browsers, but on some, like IE7, and some IE6 browsers, it shows all in 1 column down the left side. I need it to show 3 columns wide, like a table would with a <tr><td>item1</td><td>item2</td><td>item3</td></tr>, etc. How would I go about doing this? If I should convert it to a table, ok, but how do I get it to have 3 columns, then start a new row with 3 columns, etc.?

Thanks

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@knowjNov 05.2007 — how come your using div's for tabular data?

I know people say tables are bad (including me) but they have there place and this is it.
Copy linkTweet thisAlerts:
@jrthor2authorNov 06.2007 — I don't have to, but thought I'd try. My site is SHTML Strict, and thought I'd try to do this using div's instead of tables, but if you could help with a table layout, that would be fine.
Copy linkTweet thisAlerts:
@jrthor2authorNov 07.2007 — Could someone please help me get my data displayed in a table with 3 colums? Tables are fine for this.

Thanks
×

Success!

Help @jrthor2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...