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> Link to comment https://forums.phpfreaks.com/topic/106018-posting-data-problem/ 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> Link to comment https://forums.phpfreaks.com/topic/106018-posting-data-problem/#findComment-543350 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.