<form id="form2" name="form1" method="post" action=""> <p> คำค้นรายชื่อผลงาน <label> <input type="text" name="s2" id="s2" /> </label> <label> <input type="submit" name="button2" id="button2" value="ค้นหา" /> </label> <label> </label> </p> </form> <table width="300" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" bgcolor="#FFFFCC"><a href="performanceinsert.php">เพิ่มข้อมูลผลงานนักเรียนู</a></td> </tr> </table> <p class="sss"> <?php include "class.datethai.php"; $s=$_POST[s]; $con = mysql_connect("localhost","root","wayha"); mysql_select_db("prongket",$con); mysql_query("SET NAMES UTF8"); //$sql = "select * from performance INNER JOIN student where Name_ps like '%$s%'"; $sql = "select * from performance INNER JOIN student on performance.Id_ps = stunent.Id_sd"; $objQuery = mysql_query($sql) or die ("Error Query [".$strSQL."]"); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 5; $Page = $_GET["Page"]; if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page) { $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0) { $Num_Pages =($Num_Rows/$Per_Page) ; } else { $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $sql .=" order by Id_ps DESC LIMIT $Page_Start , $Per_Page"; $rs = mysql_query($sql); while($cols = mysql_fetch_row($rs)) { ?> </p> <table width="700" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="184" rowspan="8" align="center" valign="middle" bgcolor="#FF0000"><img src="gallery/<?=$cols[3];?>" alt=""width="150" height="150" /></td> <td align="right" valign="top" bgcolor="#CCFFFF"> </td> <td align="center" valign="top" bgcolor="#CCFFFF"> </td> <td bgcolor="#CCFFFF"> </td> <td bgcolor="#CCFFFF"> </td> </tr> <tr> <td align="right" valign="top" bgcolor="#CCFFFF">ชื่อผลงาน</td> <td align="center" valign="top" bgcolor="#CCFFFF">:</td> <td bgcolor="#CCFFFF"> </td> <td bgcolor="#CCFFFF"><?=$cols[1];?></td> </tr> <tr> <td width="190" align="right" valign="top" bgcolor="#CCFFFF">นักเรียนที่ได้รับผลงาน</td> <td width="7" align="center" valign="top" bgcolor="#CCFFFF">:</td> <td width="5" bgcolor="#CCFFFF"> </td> <td width="314" valign="top" bgcolor="#CCFFFF"><? $Id_sd = $cols[5]; $sql2 = "SELECT * FROM student WHERE Id_sd='$Id_sd'"; $rs2 = mysql_query($sql2); $cols2 = mysql_fetch_row($rs2); ?> เด็ก<?=$cols2[4]?><?=$cols2[3];?></td> </tr> <? mysql_free_result($rs2); ?> <tr> <td align="right" valign="top" bgcolor="#CCFFFF">รายละเอียดผลงาน</td> <td align="center" valign="top" bgcolor="#CCFFFF">:</td> <td bgcolor="#CCFFFF"> </td> <td bgcolor="#CCFFFF"><?=$message=substr("$cols[2]",0,500)."..."; ?></td> </tr> <tr> <td align="right" valign="top" bgcolor="#CCFFFF">ปีที่ได้รับผลงาน</td> <td align="center" valign="top" bgcolor="#CCFFFF">:</td> <td bgcolor="#CCFFFF"> </td> <td bgcolor="#CCFFFF"><?= $cols[4];?></td> </tr> <tr> <td align="right" valign="top" bgcolor="#CCFFFF"> </td> <td align="center" valign="top" bgcolor="#CCFFFF"> </td> <td bgcolor="#CCFFFF"> </td> <td bgcolor="#CCFFFF"> </td> </tr> <tr> <td colspan="3" align="center" bgcolor="#CCFFFF"><a href="performanceedit.php?Id_ps=<?=$cols[0]; ?>">แก้ไข</a></td> <td align="center" bgcolor="#CCFFFF"><a href="performancedel.php?Id_ps=<?=$cols[0]; ?>" onclick="return confirm('คุณต้องการที่จะลบข้อมูลหรือไม่')">ลบ</a></td> </tr> <tr> <td height="20" bgcolor="#CCFFFF"> </td> <td bgcolor="#CCFFFF"> </td> <td bgcolor="#CCFFFF"> </td> <td bgcolor="#CCFFFF"> </td> </tr> </table> <? } ?> <p> </p> <p>ทั้งหมด <?= $Num_Rows;?> ผลงาน : หน้า <?= $Page; ?> จากทั้งหมด <?=$Num_Pages;?> หน้า : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< ย้อนกลับ</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>หน้าถัดไป>></a> "; } mysql_close(); ?>
select * from performance INNER JOIN student on performance.Id_ps = stunent.Id_sd where performance.xxx like '%%'
$sql = "select * from performance INNER JOIN student on performance.Id_ps = stunent.Id_sd WHERE stunent.Name_sd like '%$s2%'";
<form id="form2" name="form1" method="post" action=""> <p> คำค้นรายชื่อผลงาน <label> <input type="text" name="s2" id="s2" /> </label> <label> <input type="submit" name="button2" id="button2" value="ค้นหา" /> </label> <label> </label> </p> </form> <table width="300" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" bgcolor="#FFFFCC"><a href="performanceinsert.php">เพิ่มข้อมูลผลงานนักเรียนู</a></td> </tr> </table> <p class="sss"> <?php include "class.datethai.php"; $s=$_POST[s2]; $con = mysql_connect("localhost","root","wayha"); mysql_select_db("prongket",$con); mysql_query("SET NAMES UTF8"); $sql = "select * from performance where Name_ps like '%$s2%'"; [color=blue][glow=red][font=Verdana]//$sql = "select * from performance INNER JOIN student on performance.Id_sd = student.Name_sd WHERE [/font]performance.Id_sd like '%$s2%'";[/glow] $objQuery = mysql_query($sql) or die ("Error Query [".$strSQL."]"); $Num_Rows = mysql_num_rows($objQuery);
$s=$_POST[s2]; //บรรทัด 21
$sql = "select * from performance where Name_ps like '%$s2%'"; //บรรทัด 26
//$sql = "select * from performance INNER JOIN student on performance.Id_sd = student.Name_sd WHERE performance.Id_sd like '%$s2%'";
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง