nooobie needs help - Techist - Tech Forum

Go Back   Techist - Tech Forum > Internet > Web Graphics and Design
Closed Thread
 
Thread Tools Display Modes
 
Old 10-16-2009, 08:55 AM   #1 (permalink)
Newb Techie
 
Join Date: Oct 2009
Posts: 1
Default nooobie needs help

I have been working on a website using PHP and MySQL and although I have knowledge in both these fields, my knowledge is quite limited and I have come across a problem I need help with.
I am creating a videos page and I would like the videos to be displayed (using PHP) in a format similar to what is found here:


hiphopdx.com/index/videos?nav

I would like the videos to display the date headline (the date being when the videos were posted) then the thumbnails of the videos to be displayed in 4 columns. I already have the videos page set up with the pagination, mysql connection and video details. I am currently displaying the videos in a single column as I dont know how to display PHP results in multiple columns.

So basically I am looking for the videos page to display the results like this (example):

Thursday, August 27, 2009
Video 1 | Video 2 | Video 3 | Video 4
Video 5 | Video 6 | Video 7 | Video 8

many thanks
__________________

ste2me is offline  
Old 10-16-2009, 09:32 AM   #2 (permalink)
It's all just 1s and 0s
 
office politics's Avatar
 
Join Date: Jan 2004
Location: in the lab
Posts: 6,555
Send a message via MSN to office politics
Default Re: nooobie needs help

i would create an html table to produce the requested output.

PHP Tables (table, tables) - PHP Classes

create a table with 4 columns and necessary amount of rows.
__________________

office politics is offline  
Old 11-11-2009, 03:43 AM   #3 (permalink)
Newb Techie
 
Join Date: Nov 2009
Posts: 1
Default Re: nooobie needs help

An hml table is the way to go, if you don't want to use any additional classes you can always echo the code for the table to be created, however the source code would be really messy
nathan_s is offline  
Old 11-13-2009, 03:52 PM   #4 (permalink)
Wizard Techie
 
CrazeD's Avatar
 
Join Date: Feb 2006
Location: Maine
Posts: 3,736
Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: nooobie needs help

Quote:
Originally Posted by office politics View Post
i would create an html table to produce the requested output.

PHP Tables (table, tables) - PHP Classes

create a table with 4 columns and necessary amount of rows.
That's just unnecessary. You don't need a whole class to do this, it's quite simple actually.

Code:
<?php

$sql = mysql_query ("SELECT * FROM videos");

$cols = 4; // set number of columns
$i = 0;    // counter

echo '<table border="0" cellspacing="1" cellpadding="3">';

while ($row = mysql_fetch_array ($sql)) {
	// start new row
	if ($i % $cols == 0) {
		echo '<tr>';
	}

	// run through the columns
	echo '<td>'.$row['video_name'].'</td>';
	
	// we have reached the end of the specified number of columns, so close it
	if ($i % $cols == $cols) {
		echo '</tr>';
	}

	$i++;
}

// in case there are not the exact amount of columns as we specified, add some blank ones to clean up
if ($i % $cols != 0) {
	while ($i++ % $cols != 0) {
		echo '<td>&nbsp;</td>';
	}
	echo '</tr>';
}

?>
__________________

Intel Q9400 | Gigabyte EP45-UD3P | G.Skill 2x2GB DDR2 1000 | XFX HD5870

Need website help? PM me!
CrazeD is offline  
Closed Thread

Thread Tools
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

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



Our Communities

Our communities encompass many different hobbies and interests, but each one is built on friendly, intelligent membership.

» More about our Communities

Automotive Communities

Our Automotive communities encompass many different makes and models. From U.S. domestics to European Saloons.

» More about our Automotive Communities

Marine Communities

Our Marine websites focus on Cruising and Sailing Vessels, including forums and the largest cruising Wiki project on the web today.

» More about our Marine Communities


Copyright 2002-2015 Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 03:10 AM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2015, vBulletin Solutions, Inc.