skbanta Posted May 17, 2008 Share Posted May 17, 2008 I can't seem to get my code right tonight. My eyes must be a little off, but if anyone can help me find out what is wrong with my code, thanks in advance. <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table width="767" border="0"> <tr> <td height="73" colspan="2"> </td> </tr> <tr> <td width="119" height="201"> </td> <td width="638" align="left" valign="top"> <?php $con=mysql_connect("localhost","root",""); if (!$con) { die('Problem encountered'); } mysql_select_db("write", $con); $result = mysql_query("SELECT * FROM article"); echo "<table border=''> while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>Title</td>"; echo "<td>" . $row['title'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>Author</td>"; echo "<td>" . $row['author'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>" . $row['article'] . "</td>"; echo "</tr>"; } echo "</table>";mysql_close($con); ?> </td> </tr> </table> </body> </html> Quote Link to comment Share on other sites More sharing options...
unidox Posted May 17, 2008 Share Posted May 17, 2008 Try this: <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table width="767" border="0"> <tr> <td height="73" colspan="2"> </td> </tr> <tr> <td width="119" height="201"> </td> <td width="638" align="left" valign="top"> <?php $con=mysql_connect("localhost","root",""); if (!$con) { die('Problem encountered'); } mysql_select_db("write", $con); $result = mysql_query("SELECT * FROM article"); echo "<table border=''>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>Title</td>"; echo "<td>" . $row['title'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>Author</td>"; echo "<td>" . $row['author'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>" . $row['article'] . "</td>"; echo "</tr>"; } echo "</table>";mysql_close($con); ?> </td> </tr> </table> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.