Styling and Positiong Data from Access Database in PHP

Soldato
Joined
30 Nov 2005
Posts
3,084
Location
London
Apologies for the very long title, couldn't think of a shorter one :p

I have successfully connected to my Access (mdb) database through PHP and have got it to print the data on screen.

However, what I need to do now is position and style the data.

How would I do this? I believe you can't put HTML tags inside a PHP script?

So really just so I can put the data in tables and style/position them.

Thanks

James
 
Do what you have to do in php and hide it away in the head tags, then echo the bits themselves in the html.

You can put html in the php if you want. If it's a loop, you can echo the relelvant html in the loop.
 
Right ok.

Well what I have done is insert the necesary code direct into the PHP page so the data from the database appears.

Do you have any examples that could assist me?
 
Well I'm away from my PC right now but.

It's the HTML, Head, Body, Content - Links etc, PHP Script, /Body, /HTML.

So the PHP code needed to display my data from the database is all included in the Body.

Is that of any help?
 
What I need to know is how to split the data so I can put them each in a table.

So each piece of data can be shown in its own table.

If that makes sense.
 
All the info's there really.
Quick example:

Code:
$result = mysql_query("SELECT x, y from tbl");

echo("<table>");
echo("<tr><td>x</td><td>y</td></tr>");
while ($row = mysql_fetch_row($result)) {
	echo("<tr>");
	echo("<td>$row[0]</td><td>$row[1]</td>");
	echo("</tr>");
}
echo("</table>");
 
Back
Top Bottom