Jump to content

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


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. :(

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.