Jump to content

posting data problem


skbanta

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.