 |
|
|
 |
 |
|
1.คูณมี checkbox ไว้เช็คว่า ถ้ามีการถูกเช็ค จะทำการลบ/ทับ รูปเดิม และมีการให้เลือกเลือกรูปให่หากต้องการใช่ม่ะ
ตอบ ก็ตรวจสอบค่า checkbom
2.?%20x มันคือไรหรอ
ตอบ เวลาขึ้นอ่า แสดงชื่อ เวลา QueryString ใช้ ไอดีซะส่วนมาก(ความคิดผมนะ)
3.มันก็ลงฟิลdatetime_edit เวลาอัพเดตอ่า
อันนี้คุนเขียนมันเองใช่ม่ะ ไงก็โพสโค้ดไว้ด้วยก็ดีนะ
|
 |
 |
 |
 |
Date :
8 เม.ย. 2550 16:10:09 |
By :
bomครหวัน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ข้อ 1 ที่มีการใส่เช็คบ๊อกซ์เข้าไปเอามาจากหนังสืออ่ะค่ะ เเล้วจะมาประยุกต์กลับไม่ได้ ช่วยแนะนำวิธีที่กระจ่างกว่าที่หนูทำอยู่ได้ป่าวค่ะ
สำหรับข้อ 2
โค้ดนะค่ะ
<html>
<head>
<title>ข่าวประกวดราคาจัดซื้อจัดจ้าง</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
</head>
<body>
<?php
include("connect.php");
include("function.php");
$sql="Select * From news where type_news='1' ORDER BY `id` ASC ";
$db_query=mysql_db_query($db,$sql);
$num_rows=@mysql_num_rows($db_query); /* นับ Reccord ที่พบ */
?>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#00CCFF"><div align="center">
<p><strong><font color="#000000" size="2" face="MS Sans Serif, Tahoma, sans-serif">ข่าวประกวดราคาจัดซื้อจัดจ้าง</font></strong></p>
</div></td>
</tr>
<?
$a=0;
while($a < $num_rows)
{
$result = mysql_fetch_array($db_query);
$id=$result[id];
$title_news=$result[title_news];
$story_news=$result[story_news];
$datetime_news=$result[datetime_news];
$type_news=$result[type_news];
$humanfill_news=$result[humanfill_news];
$pic=$result[pic];
?>
<tr>
<td><div align="left"><font color="#003399" size="2"><strong><<<</strong></font><font size="2"> <a href="view.php?%20xName=<? echo $title_news;?>"></a></font></div></td>
</tr>
<? $a++;}
?>
<tr>
<td><div align="right"><a href="listprice.php"><strong><font size="2" face="Microsoft Sans Serif, MS Sans Serif, sans-serif">ดูข่าวทั้งหมด<<<</font></strong></a></div></td>
</tr>
</table>
<p> </p></body>
</html>
******************%20xName เป็นเหมือนตัวแปรที่ส่งค่าไปให้คำสั่ง เอสคิสแอลนำไปคำนวณอ่ะค่ะ******************
3.โค้ดน่ะค่ะ
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<title>หน้าแก้ไขข่าวสารสำหรับผู้ดูแลระบบ</title>
<style type="text/css">
<!--
body,td,th {
font-family: Microsoft Sans Serif, MS Sans Serif, sans-serif;
font-size: small;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a {
font-family: Microsoft Sans Serif, MS Sans Serif, sans-serif;
}
-->
</style></head>
<body>
<?php
include("connect.php");
include("function.php");
include("thai.inc");
$d1=date("m")-1;
$a= strftime("%d");
$b=$ThaiFullMonth[$d1];
$c=strftime("%Y")+543;
$d =date("d m Y");
$d2=date("h:i:s A");
$sql ="Select * From news where id='$xName'";
$rcs=mysql_query($sql)or die("ไม่สามารถเลือกข้อมูลผู้ใช้ได้ โปรดตรวจสอบ");
$num=mysql_num_rows($rcs);
if ($num>0)
{
$rs=mysql_fetch_row($rcs);
}
if($Submit2)
{
echo "<meta http-equiv=refresh content=0;URL=news_main.php>";
}
if($Submit)
{
if($txt2!='')
{
if($txt1==$xName)
{
if($txt3=="")
{
show_msg("กรุณาเลือกประเภทของข่าว");
}
$sql2="Insert Into news Values ('','$txt1','$txt2','$txt3','$txt4','$txt5','$a $b $c @ $d2')";
mysql_query($sql2) or die ("การแก้ไขข้อมูลมีข้อผิดพลาด");
$num_rows=mysql_num_rows($dbquery);
$sql3="Update news Set id='$txt1',title_news='$txt2',story_news='$txt3',type_news='$txt4',humanfill_news='$txt5','$a $b $c @ $d2' Where id='$xName'";
$dbquery=mysql_db_query($db,$sql3);
show_msg("แก้ไขหัวข้อข่าวชื่อ $txt1 เรียบร้อยแล้วค่ะ");
echo "<meta http-equiv=refresh content=0;URL=news_main.php>";
}
else
{
show_msg( "ในฐานข้อมูลมีหัวข้อข่าวชื่อ $txt1 อยู่แล้วค่ะ");
}
}
else
{
show_msg("คุณกรอกข้อมูลไม่ครบค่ะ");
}
}
?>
<form action="" method="post" enctype="multipart/form-data" name="form1">
<div align="center"><br>
<table width="50%" height="282"border="10" cellspacing="5" bordercolor="#0099FF">
<tr bordercolor="#0099FF" bgcolor="#00CCFF">
<td height="32" colspan="2"> <div align="center"><font color="#000000" size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong>แก้ไขข่าว</strong></font></div></td>
</tr>
<tr bordercolor="#0099FF">
<td><div align="right"><strong>รหัสข่าว</strong></div></td>
<td><div align="left">
<input name="txt1" type="text" id="txt1" value="<?php printf ( "%05d" ,$rs[0]); ?>" readonly >
</div></td>
</tr>
<tr bordercolor="#0099FF">
<td width="27%"><div align="right"><font color="#000000" size="2"><strong><font face="MS Sans Serif, Tahoma, sans-serif">ชื่อหัวข้อข่าว</font></strong></font></div></td>
<td width="66%"><div align="left"><font color="#000000" size="1">
<input name="txt2" type="text" id="txt2" value="<? echo $rs[1];?>" size="30">
</font></div></td>
</tr>
<tr bordercolor="#0099FF">
<td height="104"><div align="right"><font color="#000000" size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong>รายละเอียดของข่าว</strong></font></div></td>
<td><div align="left"><font color="#000000" size="1">
<textarea name="txt3" cols="45" rows="5" id="txt3"><? echo $rs[2];?>
</textarea>
</font></div></td>
</tr>
<tr bordercolor="#0099FF">
<td><div align="right"><font color="#000000" size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong>ประเภทข่าว</strong></font></div></td>
<td><div align="left"><font color="#000000" size="1">
<select name="txt4" id="txt4">
<option value="<?php echo $rs; ?>">
<?php if($rs[4]=='1'){echo"ข่าวประกวดราคาจัดซื้อจัดจ้าง";}elseif($rs[4]=='2'){echo"ข่าวประชาสัมพันธ์เทศบาล";}elseif($rs[4]=='3'){echo"ข่าวสารส่วนราชการอื่น ๆ";}
elseif($rs[4]=='4'){echo"ข่าวเหตุการณ์ปัจจุบัน";}else{echo"เลือกประเภทข่าว";}; ?>
</option>
<option value="1">ข่าวประกวดราคาจัดซื้อจัดจ้าง</option>
<option value="2">ข่าวประชาสัมพันธ์เทศบาล</option>
<option value="3">ข่าวสารส่วนราชการอื่น ๆ</option>
<option value="4">ข่าวเหตุการณ์ปัจจุบัน</option>
</select>
</font></div></td>
</tr>
<tr bordercolor="#0099FF">
<td height="27"><div align="right"><font color="#000000" size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong>ผู้ป้อนข่าว</strong></font></div></td>
<td><div align="left"><font color="#000000" size="1">
<input name="txt5" type="text" id="txt5" value="<? echo $rs[5];?>" size="30">
</font></div></td>
</tr>
<tr bordercolor="#0099FF">
<td height="27"><div align="right"><strong>วันเวลาแก้ไขข่าว</strong></div></td>
<td><div align="left">
<input name="txt6" type="text" id="txt6" size="30">
</div></td>
</tr>
<tr bordercolor="#0066FF" bgcolor="#00CCFF">
<td height="22" colspan="3"> <div align="center"><font color="#000000" size="1"><strong>
<input type="submit" name="Submit" value="บันทึก">
<input name="Submit2" type="submit" id="Submit2" value=" ล้าง ">
</strong></font></div></td>
</tr>
</table>
<p></p>
<a href="news_main.php">กลับหน้าหลัก</a></div>
</form>
</body>
</html>
**************พอรันแล้วไม่ได้สักทีค่ะมีแต่บอกว่าการแก้ขข้อมูลผิดลาดอ่ะค่ะ******************
+++++++++++++++++++++ช่วยหน่อยคะ+++++++++++++++++++++++
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
 |
 |
 |
 |
Date :
8 เม.ย. 2550 18:38:57 |
By :
taenoy |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เก่งจังเลยคับ ไม่มีใครตอบเลย ไม่มีใครเก่งเท่า 55
|
 |
 |
 |
 |
Date :
9 ก.ค. 2550 22:47:21 |
By :
normalman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|