PHP mySQL display output in Tabular format

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
James Ecker
Forum Newbie
Posts: 3
Joined: Sat Dec 20, 2003 8:03 am

PHP mySQL display output in Tabular format

Post by James Ecker »

I would like to retrieve data from multiple tables and display them in tabular format. Any ideas?
User avatar
aquila125
Forum Commoner
Posts: 96
Joined: Tue Dec 09, 2003 10:39 am
Location: Belgium

Post by aquila125 »

Do you have any PHP - SQL experience at all?


This gives a table with all of the results from the query...

Code: Select all

$result=mysql_query($query);
echo "<table width='90%' border='0'><tr>";
	
	for ($i=0;$i<mysql_num_fields($result);$i++){
			echo "<td><b>".mysql_field_name($result,$i)."</b></td>";
	}
	echo "</tr>";
	while ($row=mysql_fetch_array($result)){
		echo "<tr>";
		for ($i=0;$i<count($row);$i++){
			echo "<td>".stripslashes($row[$i])."</td>";
			
		}
		echo "</tr>";
	
	}
	echo "</table>";
James Ecker
Forum Newbie
Posts: 3
Joined: Sat Dec 20, 2003 8:03 am

PHP mySQL display output in Tabular format

Post by James Ecker »

I am looking for the output to look like this:

Make/Model Honda Ford Chevy
LX $12,000 $13,000 $12,500
DX $11,500 $12,000 $11,000
EX $13,000 $12,500 $13,500

Where the make, model, and dollar amounts are dynamic from user input.
User avatar
aquila125
Forum Commoner
Posts: 96
Joined: Tue Dec 09, 2003 10:39 am
Location: Belgium

Post by aquila125 »

So a full script request? Sorry.. I'm not going to write your code... read some tutorials and if you have problems I'm more then willing to help you out with them...
James Ecker
Forum Newbie
Posts: 3
Joined: Sat Dec 20, 2003 8:03 am

PHP mySQL display output in Tabular format

Post by James Ecker »

Can you point me in the right direction as to where I might the information needed?
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

Post Reply