Jump to content

[SOLVED] while() command, I need help with pulling data out of the MySQL in a table


samoi

Recommended Posts

<html>
<head>
<title> My task </title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
</head>
<body>
<?php
error_reporting(E_ALL & E_NOTICE);

require_once('config.php');


$sql = "SELECT * FROM samoi ORDER BY id DESC"; 
$result = mysql_query($sql) or die(mysql_error());

echo '<table height="20%" width="100%" border="1">
  <tr>
  <th> EVENT </th>
  <th> DATE </th>
  </tr>';
echo "<tr>";
   	echo "<td>";
while ($samoi = mysql_fetch_assoc($result)) {

   echo $samoi['event'];   
   echo "</td>";
   echo "<td>";
   echo $samoi['date'];
   echo "</td>";
   echo	"</tr>";
  echo "</table>";

}
?>
<br />
<div align="center">
click here to <a href="insert.php"> ADD an EVENT </a>.
</div>
</body>
</html>

 

I just created this code, and when I run it it gives me this output:

 

   EVENT  DATE

ظ…طµظ„ط­ ظ…طµظ„ط­

 

 

[look at this guys !! ]------>MEMEmemomemosamoisamoinawaf11/22/3333ENG 102, delever12/05/2008

click here to ADD an EVENT .

 

 

 

{{It doesn't come as a table !!}}

Study your code carefully, you're not outputting a table.  You're outputting the top of a table, and then several table bottoms.

 

Ok,  ;D

 

I've studied it carefully. but it seems to be ok, I don't know if there is any other missing code. :(

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.