|
 |
|
รบกวนขอสอบถามเรื่องการการใช้ while ในการ query หน่อยครับ |
|
 |
|
|
 |
 |
|
ศึกษารูปแบบการเขียน เพื่อความคล่องตัวในการใช้งานก่อนครับ
Code (PHP)
<?php
$nameSQL = "SELECT * FROM nc_object";
$namequery = mysql_query($nameSQL);
while ($FetchArray = mysql_fetch_array($namequery))
{
$DBObject_ID = $FetchArray['Object_ID'];
$DBObject_Type = $FetchArray['Object_Type'];
$DBValue = $FetchArray['Value'];
$DBDescription = $FetchArray['Description'];
?>
<tr class="textP">
<td align = "center"><a href="customer-information.php?customer_no=<?echo $DBcustomer_no;?>"> <? echo $DBcustomer_no; ?> </a></td>
<td><center><? echo $DBObject_Type ?></center></td>
<td><center><? echo $DBName_Eng ?></center></td>
<td><center><? ?></center></td>
</tr>
<?
}
?>
|
 |
 |
 |
 |
Date :
2013-04-24 14:19:28 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
$nameSQL = "SELECT * FROM nc_object";
$namequery = mysql_query($nameSQL);
$i=0;
while ($i<=mysql_num_rows($namequery))
{
$FetchArray = mysql_fetch_array($namequery);
mysql_fetch_array ($namequery);
//mysql_close();
$DBObject_ID = $FetchArray['Object_ID'];
$DBObject_Type = $FetchArray['Object_Type'];
$DBValue = $FetchArray['Value'];
$DBDescription = $FetchArray['Description'];
$i++;
?>
<tr class="textP">
<td align = "center"><a href="customer-information.php?customer_no=<?echo $DBcustomer_no;?>"> <? echo $DBcustomer_no; ?> </a></td>
<td><center><? echo $DBObject_Type ?></center></td>
<td><center><? echo $DBName_Eng ?></center></td>
<td><center><? ?></center></td>
</tr>
<?
}
?>
|
 |
 |
 |
 |
Date :
2013-04-25 11:52:51 |
By :
pklangkua |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|