عرض مشاركة واحدة
عضو نشيط
تاريخ التسجيل: Feb 2008-
#4 (permalink)  

السلام عليكم ورحمة اللة وبركاتة

وهذا حل بعيد عن دالة mysql_num_rows واسرع ويظهر لك عدد النتائج التى فى المصفوفة فقط
كود PHP:
<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256"> 
<title>Add Employee</title>
<style type="text/css"/>
body {
font-family : tahoma;
}
</style>
</head>
<body>
<?php

include("config.php");

$tbl_name="test_mysql"// Table name



$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);

?>
<div align="center">
<div align="center">
    <table border="0" cellpadding="0" cellspacing="0" width="27%" height="20" id="table1">
        <tr>
            
<div align="center">
<div align="center">
    <table width="393" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<div align="center">
    <table width="393" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<div align="center">
    <table width="393" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<div align="center">
<table border="1" cellspacing="0" cellpadding="5" style="border-style: solid; border-width: 1px" bgcolor="#FFFFFF" width="468">
<tr>
<td align="center" width="227"  >
<font color="#000000"><strong>Name</strong></font></td>
<td align="center" width="78"    >
<font color="#000000"><strong>lastname</strong></font></td>
<td align="center" width="125"  >
<font color="#000000"><strong>Email</strong></font></td>
</tr>

<?php
while($rows=mysql_fetch_array($result)){
$num++;
?>
<tr>

<td width="227" align="center"  bordercolorlight="#FFFFFF" ><b><?php echo $rows['name']; ?></b></td>
<td width="78" align="center"  bordercolorlight="#FFFFFF" ><b><?php echo $rows['lastname']; ?></b></td>
<td width="125" align="center"  bordercolorlight="#FFFFFF" ><b><?php echo $rows['email']; ?></b></td>

</tr>
<?php
}
?>
</table>
<b>أجمالى المسجلين <?=$num;?></b>
</div>
</td>
</tr>

</table>
</div>


<?php
mysql_close
();
?>
</body>
</html>






tech غير متواجد حالياً   قديم 22-06-2008, 09:28 PM
رد مع اقتباس