مشکل در While و echo کردن نتایج جدول

farsadf

کاربر عضو
با سلام من در حال نوشتن یک اسکریپت دفترچه تلفن هستم که از طریق دیتابیس اطلاعات رو میگیره و نمایش میده

من از طریق کد زیر اسکریپت رو ایجاد کردم


کد:
<!DOCTYPE HTML>


<html>


<head>
<title></title>
<link rel="stylesheet" href="/style/style.min.css">
</head>


<body>
<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("mycontact") or die(mysql_error());
$data = mysql_query("SELECT * FROM pnum") or die(mysql_error());
$info = mysql_fetch_array( $data );
Print '<table class="pure-table"><thead>';
while ($info = mysql_fetch_array($data)) {
Print "<tr><th>Name:</th> <th>".$info['name'] . "</th>";
Print "<th>Phone Number:</th> <th>".$info['phone'] . "</th></tr>";
}
Print " </thead> </table>";
?>
</body>


</html>​

نمیدونم چرا اما فقط اولین نتیجه ی جدول رو نشون میده (تو نت هم گشتم اما به چیز قابل درکی نرسیدم ، همه همین کار رو کرده بودند)

 
آخرین ویرایش توسط مدیر:

freeupweb

کاربر عضو
کد:
<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("mycontact") or die(mysql_error());
$data = mysql_query("SELECT * FROM pnum") or die(mysql_error());
Print '<table class="pure-table"><thead>';
while ($info = mysql_fetch_array($data)) {
Print "<tr><th>Name:</th> <th>".$info['name'] . "</th>";
Print "<th>Phone Number:</th> <th>".$info['phone'] . "</th></tr>";
}
Print " </thead> </table>";
?>
شما از این کد استفاده کنید ببنیم مشکلتون حل میشه

مطمئنید جدولتون بشتر از 1 اطلاعات داره؟

 
بالا