Formatting MySQL Tables

They have: 5 posts

Joined: Feb 2001

Hi There,

I was wondering if it was possible to show individuals information in seperate tables like this:

Title1 content
Title2 content
Title3 cont...

Using php I can show information in a list ie:

Title 1 Title 2 Title 3 ....
content comtent comtent ....

I am reasonbly new toall so any help would be appriecated.

Thanks

Gman
Northern Ireland Motorsport
http://www.nimotorsport.co.uk

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

can you post the code you have?

They have: 5 posts

Joined: Feb 2001

Here you go. I have left the top section out:

$query_result = mysql_query ("select date, event, club, status, notes from autotest order by date", $connection);

$mandate = "00-00-0000";
list($month, $day, $year) = sscanf($mandate,"%s %d %d");

if (mysql_num_rows ($query_result) >0){

print "\n";
print "DateEvent
ClubStatusContact\n";

while ($row = mysql_fetch_array($query_result)) {

print "";
print "".$row["date"]."".$row["event"]."".$row["club"]."".$row["status"]."".$row["notes"]."";
print "\n";
}

print "\n";

}
?>

Its not very neat I'm afriad Smiling

Gman
Northern Ireland Motorsport
http://www.nimotorsport.co.uk

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

Gman,

Just add the headings to be beside the database values instead of on top:

print "";
print "Date: ".$row["date"]."\n";

Repeat as necessary.

They have: 5 posts

Joined: Feb 2001

Many Thanks.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.