This script won't work:
while ( $row = mysql_fetch_array($result) ) { echo("<div align="left">"); echo("<table border="0" width="48%" align="left">"); echo("<tr>"); echo("<td>" . $row["navn"] . "</td>"); echo("</tr>"); echo("<tr>"); echo("<td>" . $row["info"] . "</td>"); echo("</tr>"); echo("<tr>"); echo("<td><a href=" . $row["url"] . ">Mer Info</a></td>"); echo("</tr>"); echo("</table>"); echo("</div>"); }
Do anyone see what's wrong? I'm getting an parse error... 🙁
Let me start off by saying these things..
Why so many echo's an why to the echo's use ( and ) Try this
while ($row = mysql_fetch_array($result)) { echo"<div align=\"left\"> <table border=\"0\" width=\"48%\" align=\"left\"> <tr> <td>" . $row["navn"] . "</td> </tr> <tr> <td>" . $row["info"] . "</td> </tr> <tr> <td><a href=" . $row["url"] . ">Mer Info</a></td> </tr> </table> </div>"; }
Now that should work.
take the second line
echo("<div align="left">");
You need to protect the " inside the string, so it becomes
echo("<div align=\"left\">"); OR echo('<div align="left">');
Do this for all your lines
Thanx to both of you... Now it works. But there is one thing:
The tables are not in the order I would like to have them. E.G: If this is a table; [T], then the page is genereted like this:
[T] [T] [T]
But I want it like this:
I want the tables below each others, not next to each others... How do I do that?
You mean the table cells.
Well from looking at your html there is should be
T T T
I found out what I had to do...
Thanx for all the help... 🙂