SELECT NAME, COUNT(DeviceID) AS QTY FROM tb_name GROUP BY NAME
<?php require_once('Myconnection.php'); ?> <?php session_start(); if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_Myconnection, $Myconnection); $sqlobject = "UPDATE user SET Lastupdate = NOW() WHERE UserID = '".@$_SESSION["UserID"]."' "; $queryobject = mysql_query($sqlobject,$Myconnection); $num = 0; $strSQL = "SELECT * FROM `equipment`"; $equipmentQuery = mysql_query ($strSQL,$Myconnection) or die ("Error Query [".$strSQL."]"); if(@$_SESSION["username"]==""){ echo '<script language="javascript"> function fncAlert() { alert(" กรุณา Login เข้าสู่ระบบก่อน "); } fncAlert(); window.location="index.php"; </script>'; } session_write_close(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>TableEquipment</title> </head> <body> <table width="50%" align="center" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="10%"><div align="center">ลำดับ</font></div></td> <td width="60%"><div align="center">รายชื่ออุปกรณ์</font></div></td> <td width="10%"><div align="center">จำนวน</font></div></td> </tr> <?php while($equipmentResult = mysql_fetch_array($equipmentQuery)){?> <?php $num++;?> <tr> <td><div align="center"><?php echo $num;?></font></div></td> <td> <?php echo $equipmentResult["Name"];?></font></td> </tr> <?php } ?> </table> </body> <?php mysql_close($Myconnection); ?> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง