|
|
|
สอบถามเกี่ยวกับการการค้นหาสองเงื่อนไข พี่ท่านใดพอสละเวลามาตอบหน่อยนะคะ |
|
|
|
|
|
|
|
ไม่ใช่คะ แบบนี้คะ
แล้วแสดง รายละเอียดออกมา
นี้เป็นฐานข้อมูล
พอมีโคีดตัวอย่างไหมคะ
ขอบคุณล่วงหน้าคะ
|
|
|
|
|
Date :
2012-11-16 10:27:06 |
By :
Too |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอโคีดแบบเต็มๆได้ไหมคะ ขอบคุณล่วงหน้าคะ
|
|
|
|
|
Date :
2012-11-16 14:43:21 |
By :
Too |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คุณต้อง วาง Code ของคุณด้วยครับ เดี๋ยวไม่ตรงตามความต้องการ
|
|
|
|
|
Date :
2012-11-16 14:44:28 |
By :
Ex-[S]i[L]e[N]t |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
นี้คะโค๊ดแบบนี้คะ ขอบคุณล่วงหน้าคะ
Code (PHP)
<?
session_start();
$sess_userid=$_SESSION[sess_userid];
$sess_user=$_SESSION[sess_user];
if ($sess_userid <> session_id() or $sess_user == "") {
header("Location: login.php");
exit();
}
include('connectdb.php');
$sql="select * from users where username='$sess_user' ";
$result=mysql_db_query($dbname, $sql);
$row = mysql_fetch_array($result);
$username1 = $row["1"];
?>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<link rel="stylesheet" href="css/style.css" type="text/css">
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.10.custom.css" rel="stylesheet" />
<LINK REL="shortcut icon" href="images/favicon.ico">
<TITLE><? echo $title; ?></TITLE>
<script language="javascript" src="css/jquery.min.js"></script>
<script language="javascript" src="css/jquery1.js"></script>
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.10.offset.datepicker.min.js"></script>
<script language=Javascript>
function Inint_AJAX() {
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {} //IE
try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
try { return new XMLHttpRequest(); } catch(e) {} //Native Javascript
alert("XMLHttpRequest not supported");
return null;
};
function dochange(src, val) {
var req = Inint_AJAX();
req.onreadystatechange = function () {
if (req.readyState==4) {
if (req.status==200) {
document.getElementById(src).innerHTML=req.responseText; //รับค่ากลับมา
}
}
};
req.open("GET", "locale.php?data="+src+"&val="+val); //สร้าง connection
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); // set Header
req.send(null); //ส่งค่า
}
window.onLoad=dochange('province', -1);
</script>
<!--ตรวจสอบช่องว่าง-->
<script language="JavaScript" src="js/checknull.js"></script>
<style type="text/css">
<!--
.style4 {font-family: "MS Sans Serif", "microsoft Sans Serif"; font-size: 14px; }
.style5 {font-size: 14px}
-->
</style>
</HEAD>
<BODY onLoad="hide();" LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<?php include('header.php'); ?>
<TABLE WIDTH="919" ALIGN="CENTER" CELLPADDING="0" CELLSPACING="0" BORDER="0" style='border:1px solid #000000'>
<tr><td width="849"><table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20"></td>
</tr>
</table>
<table width="855" border="0" align="center" id="mytable">
<tr>
<center>
<td colspan="7"><table width="540" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="540" height="124" valign="top"><fieldset>
<legend></legend>
<br />
<table width="516" border="0" align="center">
<tr>
<td><div align="right"><span class="style24">จังหวัด : </span></div></td>
<td><font id="province">
<select name="select" class="typebox-contact" id="province" style="width:195px">
<option value="">-เลือก-</option>
<option value="75">ยะลา</option>
</select>
</font></td>
<td><div align="right"><span class="style24">ปี : </span></div></td>
<td><select name="select">
<option value="">เลือกปี</option>
<?php for($i=date("Y");$i>=date("Y")-3;$i--){?>
<option value="<?php echo ($i)?>" <?php if($_POST['year']==($i)){ echo "selected" ; } ?>> <?php echo ($i+543)?> </option>
<?php } ?>
</select></td>
<td><input name="Submit" type="submit" value="แสดงข้อมูล" /></td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
<p> </p>
<?php
//
require_once("connectdb.php");
$sql = "SELECT * FROM employees ";
$objQuery = mysql_db_query($dbname,$sql);
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 10; // Per Page
$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 cid ASC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_db_query($dbname,$sql);
?></td>
</center>
</tr>
<tr bgcolor="#CCCCCC">
<center>
<td width="62" bgcolor="#FF9933"><div align="center"><strong>ที่</strong></div></td>
<td width="333" bgcolor="#FF9933"><div align="center"><strong>ชื่อโครงการ</strong></div></td>
<td width="157" bgcolor="#FF9933"><div align="center"><strong>ปีงบประมาณ</strong></div></td>
<td width="155" bgcolor="#FF9933"><div align="center"><strong>จังหวัด</strong></div></td>
<td colspan="2" bgcolor="#FF9933"><div align="center"><strong>แก้ไข</strong></div></td>
</center>
</tr>
<?
$i = 1;
if($Page > 1)
{
$i = ($Per_Page * ($Page-1)) + 1;
}
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr bgcolor="#EDEDEF">
<td align="center"><span class="style4"><?php echo $i ; ?></span></td>
<td align="left"><span class="style4"><?php echo $objResult["lname"]; ?></span></td>
<td align="left"><div align="center"><span class="style4"><?php echo $objResult["year"]; ?></span></div></td>
<td align="left"> </td>
<td colspan="2"><center class="style4">
<a href="ex.php?id=<?php echo $objResult["cid"]; ?>&action=edit"><img src="img/edit_icon.gif" width="26" height="27"/></a>
</center></td>
</tr>
<?
$i++;
}
?>
<tr bgcolor="#EDEDEF">
<td><span class="style5"></span></td>
<td colspan="3"><span class="style5"></span></td>
<td width="45"><span class="style5"></span></td>
<td width="77"> </td>
</tr>
<tr>
<td colspan="7"><span class="style4"> ทั้งหมด
<?= $Num_Rows;?>
แถว :
<?=$Num_Pages;?>
หน้า :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><img src=\"img/prev.png\" title=\"$page_prev\"></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'><img src=\"img/next.png\" title=\"$page_prev\"></a> ";
}
?>
<a href="main.php">กลับสู่หน้าหลัก</a></span></td>
</tr>
</table>
<?php if($_REQUEST[action]=="edit") { ?>
<?php $_REQUEST[cid];?>
<?php
require_once("connectdb.php");
/*$sql_check="select max(news_id) from news";
$table_check = mysql_db_query($dbname,$sql_check);
$row_check = mysql_fetch_array($table_check);
$id_pk= $row_check["max(news_id)"];
$id = ($id_pk+1);
*/
$id=$_REQUEST[id];
$sql = "SELECT * FROM employees where cid=$id ";
$objQuery = mysql_db_query($dbname,$sql);
$row = mysql_fetch_array($objQuery);
//$cid=$row['cid'];
//$pname=$row['pname'];
$lname=$row['lname'];
//$fname=$row['fname'];
$year=$row['year'];
$addpart=$row['addpart'];
$moopart=$row['moopart'];
$country =$row['country'];
$disciplines=$row['disciplines'];
$talentmy =$row['talentmy'];
$position =$row['position'];
$date0 =$row['date0'];
$ment =$row['ment'];
$district=$row['district'];
$amphur =$row['amphur'];
$province =$row['province'];
$pname = $row[3];
$fname = $row[5];
//$fname = $rowedit[3];
$district = $row[8];
$amppart= $row[9];
$chapart = $row[10];
$education =$row[13];
if($education=='1'){
$educationid="1";
$educationname="S";
}else if($education=='2'){
$educationid="2";
$educationname="M";
}else if($education=='3'){
$educationid="3";
$educationname="L";
}
?>
<form action="save_news.php?id=<?php echo $_REQUEST[id];?>&ac=edit" method="post">
<table width="895" border="0" align="center" cellpadding="0" cellspacing="0">
<tr height="34">
<td>ประเภทโครงการ </td>
<td colspan="2"><select name="pname" style="width:500px" class="typebox-contact">
<?
$sqlpname = "select * from category where id=$pname";
$resultpname = mysql_db_query($dbname,$sqlpname);
$rowpname=mysql_fetch_array($resultpname);
$idpname = $rowpname[0];
$namepname = $rowpname[1];
?>
<option value="<? echo $idpname; ?>"><? echo $namepname; ?></option>
<?
$result1=mysql_db_query($dbname,"select * from category order by id");
while($row1 = mysql_fetch_array($result1)){
$prid=$row1["id"];
$prname=$row1["name"];
?>
<option value='<? echo $prid; ?>'><? echo $prname; ?></option>
<?
}
?>
</select></td>
</tr>
<tr height="34">
<td width="260">ด้าน</td>
<td colspan="2"><select name="fname" class="typebox-contact" id="fname" style="width:300px">
<?
$sqlfname1 = "select * from side where id=$fname";
$resultfname1 = mysql_db_query($dbname,$sqlfname1);
$rowfname1=mysql_fetch_array($resultfname1);
$idfname = $rowfname1[0];
$namefname = $rowfname1[2];
?>
<option value="<? echo $idfname; ?>"><? echo $namefname; ?></option>
<?
$result2=mysql_db_query($dbname,"select * from side order by id");
while($row2 = mysql_fetch_array($result2)){
$frid=$row2["id"];
$frname=$row2["name"];
?>
<option value='<? echo $frid; ?>'><? echo $frname; ?></option>
<?
}
?>
</select></td>
</tr>
<tr height="34">
<td width="260">ชื่อโครงการ</td>
<td colspan="2"><input name="lname" type="text" id="lname" value="<?php echo $lname ; ?>" size="70" />
ปีงบประมาณ
<label>
<input name="year" type="text" id="year" value="<?php echo $year ; ?>" size="10" />
</label></td>
</tr>
<tr height="34">
<td width="260">ชื่อบ้าน</td>
<td colspan="2"><input name="addpart" type="text" value="<?php echo $addpart ; ?>" size="10" />
หมู่ที่
<label>
<input name="moopart" type="text" id="moopart" value="<?php echo $moopart ; ?>" size="10" />
</label></td>
</tr>
<tr height="34">
<td width="260">จังหวัด</td>
<td colspan="2"><?
$sqlcha = "select * from province where PROVINCE_ID=$province";
$resultcha = mysql_db_query($dbname,$sqlcha);
$rowcha = mysql_fetch_array($resultcha);
$codecha = $rowcha[0];
$namecha = $rowcha[2];
?>
<select id="selProvince" name="province">
<option value="<? echo $codecha; ?>"><? echo $namecha; ?> </option>
<?php
$result = mysql_query("
SELECT
PROVINCE_ID,
PROVINCE_NAME
FROM
province
ORDER BY PROVINCE_LIST;
");
while($row = mysql_fetch_assoc($result)){
echo '<option value="', $row['PROVINCE_ID'], '">', $row['PROVINCE_NAME'],'</option>';
}
?>
</select></td>
</tr>
<tr height="34">
<td width="260">อำเภอ</td>
<td colspan="2"><?
$sqlamp = "select * from amphur where AMPHUR_ID=$amphur";
$resultamp = mysql_db_query($dbname,$sqlamp);
$rowamp = mysql_fetch_array($resultamp);
$codeamp = $rowamp[0];
$nameamp = $rowamp[2];
?>
<label></label>
<select id="selAmphur" name="amphur">
<option value="<? echo $codeamp; ?>"><? echo $nameamp; ?></option>
</select></td>
</tr>
<tr height="34">
<td width="260">ตำบล</td>
<td colspan="2"><?
$sqltam = "select * from district where DISTRICT_ID=$district";
$resulttam = mysql_db_query($dbname,$sqltam);
$rowtam = mysql_fetch_array($resulttam);
$codetam = $rowtam[0];
$nametam = $rowtam[2];
?>
<label></label>
<select id="selTumbon" name="district">
<option value="<? echo $codetam; ?>"> <? echo $nametam; ?> </option>
</select></td>
</tr>
<tr height="34">
<td width="260">ขนาดโครงการ</td>
<td colspan="2"><select name="education" class="typebox-contact" id="education" tyle="width:150px">
<option value="<? echo $educationid; ?>"><? echo $educationname; ?></option>
<option value="1">S</option>
<option value="2">M</option>
<option value="3">L</option>
</select></td>
</tr>
<tr height="34">
<td width="260">งบประมาณที่ได้รับอนุมัติ ดำเนินการ </td>
<td colspan="2"><label>
<input name="country" type="text" id="country" value="<?php echo $country ; ?>">
</label>
บาท </td>
</tr>
<tr height="34">
<td width="260" >ผลการเบิกจ่าย</td>
<td width="207"><label>
<input name="disciplines" type="text" id="disciplines" value="<?php echo $disciplines ; ?>">
บาท</label></td>
<td width="428">ว/ด/ป ผลการเบิกจ่าย
<input name="date0" type="text" id="datepicker-th-2" value="<?php echo $date0 ; ?>" /></td>
</tr>
<tr height="34">
<td width="260">ผลการเบิกจ่ายคิดเป็นร้อยละ</td>
<td colspan="2"><label></label>
<label>
<input name="talentmy" type="text" id="talentmy" value="<?php echo $talentmy ; ?>">
%</label></td>
</tr>
<tr height="34">
<td width="260"><p>ดำเนินการได้เนื้องาน คิดเป็นร้อยละ</p> </td>
<td colspan="2"><label>
<input name="position" type="text" id="position" value="<?php echo $position ; ?>">
%</label></td>
</tr>
<tr height="34">
<td width="260">ปัญหาและอุปสรรค์</td>
<td colspan="2"><textarea name="ment" cols="50" rows="10" id="ment"><?php echo $ment ; ?></textarea></td>
</tr>
<tr>
<td height="30"> </td>
</tr>
<tr>
<td height="35" colspan="3"><center>
<input name="submit" type="submit" onClick="return confirm ('ยืนยันการบันทึกข้อมูล')" value="บันทึกข้อมูล"/>
<input type="reset" name="button2" value="ยกเลิก" />
</center></td>
</tr>
</table>
</form>
<?php } ?>
</td>
</tr>
<tr valign="middle"><td height="20"></td></tr>
</TABLE>
<TABLE WIDTH="919" ALIGN="CENTER" CELLPADDING="0" CELLSPACING="0" BORDER="0">
<tr><td height="60" bgcolor="#CCCCFF"><center>ศูนย์อำนวยการบริหารจังหวัดชายแดนภาคใต้ (ศอ.บต.) <br>
ส่วนเทคโนโลยีสารสนเทศและการสื่อสาร สำนักนโยบายและแผน</center></td></tr>
</TABLE>
</BODY>
</HTML>>
|
|
|
|
|
Date :
2012-11-16 15:46:03 |
By :
Too |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
พี่ๆ ช่วยหน่อยคะ ขอบคุณล่วงหน้าคะ
|
|
|
|
|
Date :
2012-11-17 13:27:30 |
By :
Too |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่ใครช่วยเลยหรือคะ เศร้า T__T
|
|
|
|
|
Date :
2012-11-19 09:52:12 |
By :
Too |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|