$Conn = Mysql Connect($Host,$User,$Pass)Or Die( ติดต่อ Host ไม่ได้br> );

$Conn = Mysql Connect($Host,$User,$Pass)Or Die( ติดต่อ Host ไม่ได้br> );

<p>1 dbcon.php <?php $host = "127.0.0.1"; $user = "root"; $pass = "123456"; $dbname = "dbregister"; $tbuser = "tbuser"; $conn = mysql_connect($host,$user,$pass)or die("ต�ดต �อHost ไม�ได�<br>"); $db =mysql_select_db($dbname) or die ("ต�ดต �อฐานข�อม�ลไม�ได�"); ?> FormRegister.php</p><p><!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>สมมัครสมาช�ก</title> </head> <body> <form id="form1" name="form1" method="post" action="AddData.php"> 2</p><p><table width="60%" border="0"> <tr> <td width="90">ชชชื่อลล็อกอ�น</td> <td width="235"><input type="text" name="logname" id="logname" /></td> <td width="102">เพศ</td> <td width="206"><p> <label> <input type="radio" name="gender" value="male" id="gender_0" /> ชาย</label> <input type="radio" name="gender" value="female" id="gender_1" /> <label>หญ�ง</label> <br /> </p></td> </tr> <tr> <td>รหมัสผาน� </td> <td><input type="password" name="pw" id="pw" /></td> <td>อายย</td> <td><select name="age" id="age"> <option value="9-18">9-18 ปป</option> <option value="19-25">19-25 ปป</option> <option value="26-45">26-45 ปป</option> <option value="46-60">46-60 ปป</option> <option value="61-80">61-80 ปป</option> 3</p><p></select></td> </tr> <tr> <td>ชชชื่อ-นามสกยล </td> <td><input type="text" name="name" id="name" /></td> <td>งานอด�เรก</td> <td><input name="hobby1" type="checkbox" id="hobby1" value="sport" /> เลนก� ปฬา <br /> <input name="hobby2" type="checkbox" id="hobby2" value="reading" /> อานหนมังสชอ� <br /> <input name="hobby3" type="checkbox" id="hobby3" value="tour" /> ท�องเทปชื่ยว<br /> <input name="hobby4" type="checkbox" id="hobby4" value="game" /> เกม </td> </tr> <tr> <td>ทปชื่อย�</td>� <td><textarea name="address" id="address" cols="30" rows="5"></textarea></td> <td>ร��จมักเวล็บไซตต์นปน จากแหล�งใด</td> <td><select name="ads" id="ads"> <option value="newspaper">หนมังสชอพ�มพต์</option> <option value="book">หนมังสชอในเครชอสสานมักพ�มพต์</option> <option value="internet">อ�นเตอรต์เนล็ต</option> 4</p><p><option value="poster" selected="selected">ใบปล�ว</option> </select></td> </tr> <tr> <td>อปเมลต์</td> <td><input name="email" type="text" id="email" size="25" /></td> <td></td> <td>&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td><input type="submit" name="Submit" id="Submit" value="ส�งข�อม�ล" /></td> <td><input type="reset" name="Reset" id="Reset" value="ล�าง ข�อม�ล" /></td> <td>&nbsp;</td> </tr> </table> </form> </body> </html></p><p>สรรางฐานขรอมมล 5</p><p>AddData.php <?php include("dbcon.php"); $sql = "insert into `$tbuser` ( `logname` , `pw` , `name` , `address` , `age` , `gender` , `ads`, `hobby1` , `hobby2` , `hobby3` , `hobby4` , `email` ) values ('$logname', '$pw', '$name', '$address', '$age', '$gender', '$ads', '$hobby1', '$hobby2', '$hobby3', '$hobby4', '$email' )"; mysql_query("set NAMES tis620"); $sqlquery=mysql_db_query($dbname, $sql); $checkadd = "select * from `$tbuser` where logname='$logname' "; $result = mysql_db_query($dbname, $checkadd); $num=mysql_num_rows($result); if ($num==1) { print"<br>เพ� ชื่มข�อม�ลผ��ใช�ลงในฐานข�อม�ลเรปยบร�อยแล�ว"; }elseif($num>=1) { print"<br>ช ชชื่อผ��ใช�งานซส นากรยณาใช�ชชชื่ออชชื่น"; }else 6</p><p>{ print"ระบบข มั ดข�องหรชอมปข�อผ�ดพลาด!!!"; }; mysql_close($conn); ?> fetcharray.php <!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>รายชชชื่อสมาช�ก</title> </head> <?php include("dbcon.php"); $sql = "select *from $tbuser "; mysql_query("set NAMES tis620"); $sqlquery=mysql_db_query($dbname, $sql); print "<h3>จสานวนผ��สมมัครสมาช�กมปทมันงหมด ".mysql_num_rows($sqlquery)." คน ซซชื่งมปข�อม�ลดมังนปน</h3>"; print "<table>"; print "<tr bgcolor=0066FF>"; print "<td align = center>ผ��ใช�</td>"; print "<td align = center>รหมัสผาน� </td>"; print "<td align = center>อปเมล</td>"; print "<td align = center>ชชชื่อ-นามสกยล</td>"; print "<td align = center>ทปชื่อย�</td>";� print "<td align = center>อายย</td>"; 7</p><p> print "<td align = center>เพศ</td>"; print "<td align = center>แหลงทปชื่มา� </td>"; print "<td align = center>งานอด�เรก</td>"; print "</tr>"; while ($array = mysql_fetch_array($sqlquery)) { $logname = $array['logname']; print "<tr bgcolor=00CCFF>"; print "<td>".$array['logname'] ."</td>"; print "<td>".$array['pw'] ." </td>"; print "<td>".$array['email'] ." </td>"; print "<td>".$array['name'] ." </td>"; print "<td>".$array['address'] ." </td>"; print "<td>".$array['age']." </td>"; print "<td>".$array['gender']." </td>"; print "<td>".$array['ads']." </td>"; print "<td>".$array['hobby'] ." ". $array['hobby2'] ." ".$array['hobby3']." ". $array['hobby4'] ."</td>"; print "</tr>"; } print"</table>"; mysql_close($conn); ?> </html></p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    7 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us