<html> <head> <title>ThaiCreate.Com Tutorial</title> </head> <body> <script language="JavaScript"> function fncShow(ctrl) { document.getElementById(ctrl).style.display = ''; } function fncHide(ctrl) { document.getElementById(ctrl).style.display = 'none'; } </script> <form name="frmMain" action="" method="post" OnSubmit="return onDelete();"> <table width="600" border="1"> <tr> <th width="91"> <div align="center">CustomerID </div></th> <th width="98"> <div align="center">Name </div></th> <th width="198"> <div align="center">Email </div></th> <th width="97"> <div align="center">CountryCode </div></th> <th width="59"> <div align="center">Budget </div></th> <th width="71"> <div align="center">Used </div></th> </tr> <tr> <td colspan="6">C001 [<a href="JavaScript:fncShow('tr1');">Show</a>] [<a href="JavaScript:fncHide('tr1');">Hide</a>]</td> </tr> <tr id="tr1"> <td><div align="center">C001</div></td> <td>Win Weerachai</td> <td>[email protected]</td> <td><div align="center">TH</div></td> <td align="right">1000000</td> <td align="right">600000</td> </tr> <tr> <td colspan="6">C002 [<a href="JavaScript:fncShow('tr2');">Show</a>] [<a href="JavaScript:fncHide('tr2');">Hide</a>]</td> </tr> <tr id="tr2"> <td><div align="center">C002</div></td> <td>John Smith</td> <td>[email protected]</td> <td><div align="center">EN</div></td> <td align="right">2000000</td> <td align="right">800000</td> </tr> <tr> <td colspan="6">C003 [<a href="JavaScript:fncShow('tr3');">Show</a>] [<a href="JavaScript:fncHide('tr3');">Hide</a>]</td> </tr> <tr id="tr3"> <td><div align="center">C003</div></td> <td>Jame Born</td> <td>[email protected]</td> <td><div align="center">US</div></td> <td align="right">3000000</td> <td align="right">600000</td> </tr> <tr> <td colspan="6">C004 [<a href="JavaScript:fncShow('tr4');">Show</a>] [<a href="JavaScript:fncHide('tr4');">Hide</a>]</td> </tr> <tr id="tr4"> <td><div align="center">C004</div></td> <td>Chalee Angel</td> <td>[email protected]</td> <td><div align="center">US</div></td> <td align="right">4000000</td> <td align="right">100000</td> </tr> </table> </form> </body> </html>
<html> <head> <title>ThaiCreate.Com Tutorial</title> </head> <body> <script language="JavaScript"> function fncShow(ctrl) { document.getElementById(ctrl).style.display = ''; } function fncHide(ctrl) { document.getElementById(ctrl).style.display = 'none'; } </script> <form name="frmMain" action="" method="post" OnSubmit="return onDelete();"> <? $objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database"); $objDB = mysql_select_db("mydatabase"); $strSQL = "SELECT * FROM customer"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); ?> <table width="600" border="1"> <tr> <th width="91"> <div align="center">CustomerID </div></th> <th width="98"> <div align="center">Name </div></th> <th width="198"> <div align="center">Email </div></th> <th width="97"> <div align="center">CountryCode </div></th> <th width="59"> <div align="center">Budget </div></th> <th width="71"> <div align="center">Used </div></th> </tr> <? $i = 0; while($objResult = mysql_fetch_array($objQuery)) { $i++; ?> <tr> <td colspan="6"><?php echo $objResult["CustomerID"];?> [<a href="JavaScript:fncShow('tr<?php echo $i;?>');">Show</a>] [<a href="JavaScript:fncHide('tr<?php echo $i;?>');">Hide</a>]</td> </tr> <tr id="tr<?php echo $i;?>"> <td><div align="center"><?php echo $objResult["CustomerID"];?></div></td> <td><?php echo $objResult["Name"];?></td> <td><?php echo $objResult["Email"];?></td> <td><div align="center"><?php echo $objResult["CountryCode"];?></div></td> <td align="right"><?php echo $objResult["Budget"];?></td> <td align="right"><?php echo $objResult["Used"];?></td> </tr> <? } ?> </table> <? mysql_close($objConnect); ?> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท