Page 1 of 1

PHP mySQL display output in Tabular format

Posted: Sat Dec 20, 2003 8:03 am
by James Ecker
I would like to retrieve data from multiple tables and display them in tabular format. Any ideas?

Posted: Sat Dec 20, 2003 8:29 am
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>";

PHP mySQL display output in Tabular format

Posted: Sat Dec 20, 2003 8:47 am
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.

Posted: Sat Dec 20, 2003 10:11 am
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...

PHP mySQL display output in Tabular format

Posted: Sat Dec 20, 2003 12:10 pm
by James Ecker
Can you point me in the right direction as to where I might the information needed?

Posted: Sat Dec 20, 2003 12:19 pm
by d3ad1ysp0rk