 |
|
|
 |
 |
|
มาต่อให้ใหม่
Code (PHP)
$sqlc="select OUTDATE from book1 where substring(OUTDATE,11,2)='$code' ";
ผมไม่รู้ว่าตำแหน่งชม.ของคุณมันคือตำแหน่งอะไร ระหว่างวันที่ กับเวลา มีกี่คำ ไงๆก็แสดงตัวอย่าง OUTDATE มาให้ดูหน่อย
|
 |
 |
 |
 |
Date :
2009-10-07 21:16:51 |
By :
xbeginner01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Fatal error: Maximum execution time of 30 seconds exceeded in C:\AppServ\www\time\SaveFaculty.php on line 14
โดนแบบนี้อ่าครับ
|
 |
 |
 |
 |
Date :
2009-10-07 22:04:33 |
By :
nuttapont |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เช่น แบบนี้อ่ะครับ
07-15-2009 18:13
07-15-2009 16:13
07-15-2009 19:13
07-15-2009 13:13
07-15-2009 14:13
07-15-2009 15:13
เอาเลขตำแหน่ง 18 16 19 13 14 15 อ่ะครับพี่
มาช่วยด้วยนะครับผม
ขอบคุณนะครับ
|
 |
 |
 |
 |
Date :
2009-10-07 22:07:03 |
By :
nuttapont |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?
include("connect.php");
$sql="select * from book1";
$query=mysql_query($sql) or die("error=$sql");
while($row=mysql_fetch_array($query))
{
$code=$row['code'];
$sqlc="select count(OUTDATE) as numc , substring(OUTDATE,11,2) as subs from book1 where substring(OUTDATE,11,2)='$code' ";
$queryc=mysql_query($sqlc) or die("error=$sqlc");
$rs=mysql_fetch_array($queryc);
echo "nums : $rs[nums] at $rs[subs]<br/>";
//$sqlI="update time_type set quantity=$rs[numc] where code='$code'";
//mysql_query($sqlI) or die("error=$sqlI");
}
mysql_close();
echo "<script>alert('บันทึกเรียบร้อยแล้ว');window.location='Index.php';</script>";
?>
ผมไม่รู้ว่ามันไปติดวนลูปตรงไหน ขอทดสอบโค้ดนี้ก่อนครับแล้วส่งผลมาให้ดูหน่อยครับ
|
 |
 |
 |
 |
Date :
2009-10-07 22:29:16 |
By :
xbeginner01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
error=select count(OUTDATE) as numc , substring(OUTDATE,11,2) as subs from book1 where substring(OUTDATE,11,2)=''
เป็นแบบนี้อ่ะครับพี่
มาช่วยหน่อยนะครับ
|
 |
 |
 |
 |
Date :
2009-10-08 01:21:46 |
By :
nuttapont |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โอเค ขอทำสมาธิแปป ทำไรผิดหว่า.....         
|
 |
 |
 |
 |
Date :
2009-10-08 01:42:12 |
By :
xbeginner01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอาใหม่ ที่นี้ให้มันฟ้อง mysql_error() น่ะ
Code (PHP)
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?
include("connect.php");
$sql="select code from book1 group by code";
$query=mysql_query($sql) or die(mysql_error());
while($row=mysql_fetch_array($query))
{
$code=$row[code];
$sqlc="select count(OUTDATE) as numc , substring(OUTDATE,11,2) as subs from book1 where substring(OUTDATE,11,2)='$code' ";
$queryc=mysql_query($sqlc) or die(mysql_error()."<br/>error=$sqlc");
$rs=mysql_fetch_array($queryc);
echo "nums : $rs[nums] at $rs[subs]<br/>";
//$sqlI="update time_type set quantity=$rs[numc] where code='$code'";
//mysql_query($sqlI) or die("error=$sqlI");
}
mysql_close();
echo "<script>alert('บันทึกเรียบร้อยแล้ว');window.location='Index.php';</script>";
?>
ถามหน่อย ใช้ตารางเดียวหรอ? query แรกก็เรียกตาราง book1 query อันที่สองยังตาราง book1 อีกมันแปลกๆ เช็คให้พี่ด้วย ไม่งั้นส่งรายละเอียดตารางมาที
|
 |
 |
 |
 |
Date :
2009-10-08 01:54:49 |
By :
xbeginner01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$code ตรงนี้ใช้ POST หรือ GET ละ
|
 |
 |
 |
 |
Date :
2009-10-08 09:24:02 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช้ตารางเดียว ครับผม
ไฟล์ที่ทำทั้งหมด
และ ไฟล์ฐานข้อมูลทั้งหมดที่เกี่ยวข้องนะครับ
http://student.nu.ac.th/deego/Time.rar
ขอบคุณที่มาช่วยผมนะครับ
จะพรีเซ้นวันจันแล้วครับ ติดตรงนี้อันเดียวครับ
|
 |
 |
 |
 |
Date :
2009-10-08 13:38:48 |
By :
nuttapont |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอาโค้ตพี่ด้านบนไปลองรันดู เป็นแบบนี้อ่ะครับ
Unknown column 'code' in 'field list'
|
 |
 |
 |
 |
Date :
2009-10-08 19:06:41 |
By :
nuttapont |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมว่าดูใหม่ คับ มีผิดตรง เครื่องหมายนิดหน่อย
|
 |
 |
 |
 |
Date :
2009-10-09 09:05:35 |
By :
apicha31 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|