| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Member Join Date: Dec 2004
Posts: 30
![]() | Displaying a Catalog Hey guys, I'm a designer turned coder and it would seem PHP has finally warmed up to me. One thing I can't figure out is how to display a catalog with multiple columns. Obviously I would need a <tr></tr> every four <td>'s and I can't quite get it working. This is the basic method I've been using thus far. Code: <?
$db = mysql_connect("localhost", "un", "pw");
mysql_select_db("db",$db);
$result = mysql_query("SELECT * FROM catagories ORDER BY od asc",$db);
while($myrow = mysql_fetch_array($result))
{
echo "CODE";
}
?> $var = 0 before the while() portion and then $var = $var + 1 at the end, and then throw in the <tr></tr> when $var = multiple of 4 or something to that effect, but again I can't get it to work properly. ????: NamePros.com http://www.namepros.com/programming/124139-displaying-a-catalog.html Thanks for your time. |
| |
| | #2 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | PHP Code: |
| |
| | #4 (permalink) | ||||
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
PHP Code: | ||||
| |
| | #5 (permalink) |
| NamePros Regular Join Date: May 2005
Posts: 358
![]() ![]() | HTML Code: <?
$db = mysql_connect("localhost", "un", "pw");
mysql_select_db("db", $db);
$result = mysql_query("SELECT * FROM catagories ORDER BY od asc limit 8",$db);
echo '<table>';
while($myrow = mysql_fetch_array($result))
{
//THe below is what I typically do..
$variable = $myrow["column"];
$variable2 = $myrow["column2"];
$variable3 = $myrow["column3"];
$variable4 = $myrow["column4"];
echo "<tr><td>$variable</td><td>$variable2</td><td>$variable3</td><td>$variable4</td></tr>";
} //Something like that. Lol :p
echo '
</table>';
?> ????: NamePros.com http://www.namepros.com/showthread.php?t=124139 Hope it helps |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Catalog Website | Chanesaw | Website Development | 0 | 08-06-2005 09:14 AM |
| Displaying Content When A Checkbox Is Checked?? | TWM | Programming | 6 | 07-01-2005 08:58 AM |
| .cgi displaying as raw html in firefox | soloBRIAN | Programming | 0 | 05-18-2005 08:19 PM |
| Keeps displaying eye-related ads :| | Ringr | Google Adsense | 4 | 04-19-2005 03:47 PM |
| displaying colums | adam_uk | Programming | 4 | 07-16-2003 07:43 AM |