สอบถามการแปลงโค้ดเป็น php โดยการดึงข้อมูลมาแสดงจากฐานข้อมูลทั้งหมด ยึดที่ year
Code (ASP)
<table width="100%" border="0">
<!-- <tr valign="center" >
<td width="7%"><div align=right><img src="../images/post.gif" border=0></div></td>
<td width="2%"> </td>
<td nowrap class="extra" ><a href="fake.htm"><font size="+1">รับสมัครนักศึกษาเข้าร่วมโครงการอาสาสมัครประชาธิปไตย (นศ.ปต.)</font></a><img src="../images/new.gif" border=0></td>
</tr>
--> <%
if request.QueryString("q_year")="" then
sql2="where start_date like '%" &Year(Date)+543& "' or start_date like '%" &Year(Date)+543+1& "'"
else
sql2="where start_date like '%" &request.QueryString("q_year")& "' "
end if
Sql="Select id, name, due_state, num_submit, num_want, num_backup,limit_date From extra_jobs " &sql2&" Order By due_state DESC,id DESC"
rs.Open Sql, Conn, 0, 3
Do While Not rs.EoF
Total=0
dueState=rs("due_state")
numSubmit=rs("num_submit")
numWant=rs("num_want")
numBackUp=rs("num_backup")
Total=numWant + numBackUp
' Check Limit Date Less Then Now Date
if (rs("limit_date") < Date) Or (numSubmit=Total) then
rs("due_state")=True
rs.Update
' update Field state
'response.write rs("limit_date") &"#"& Date &"#submit="& numSubmit &"#tt="& TotalSubmit &"#"& rs("id") &"#"& rs("num_want") &"#"& rs("num_backup")
ELSE
rs("due_state")=false
rs.Update
end if
if Not dueState then
if Total > numSubmit then
%>
<tr valign="center" >
<td width="7%"><div align=right><img src="../images/post.gif" border=0></div></td>
<td width="2%"> </td>
<td nowrap class="extra" ><a href="details.asp?id=<%=rs("id") %>&signState=True"><%=rs("name") %></a><img src="../images/new.gif" border=0></td>
<%
else
%>
<tr valign="center" >
<td width="7%"><div align=right><img src="../images/post.gif" border=0></div></td>
<td width="2%"> </td>
<td nowrap class="extra" ><a href="details.asp?id=<%=rs("id") %>&signState=False"><%=rs("name") %></a><strong><font color=#FF0000> เต็ม ! </font></strong></td>
<%
end if
else
if Total > numSubmit then
%>
<tr valign=center >
<td width="7%"><div align=right><img src="../images/post.gif" border=0></div></td>
<td width="2%"> </td>
<td nowrap class="extra" ><a href="details.asp?id=<%= rs("id") %>&signState=False"> <%= rs("name") %></a><strong><font color=#FF0000> หมดเขตรับสมัคร !</font></strong></td>
<%
else
%>
<tr valign="center" >
<td width="7%"><div align=right><img src="../images/post.gif" border=0></div></td>
<td width="2%"> </td>
<td nowrap class="extra" ><a href="details.asp?id=<%=rs("id") %>&signState=False"><%=rs("name") %></a><strong><font color=#FF0000> เต็ม !</font></strong></td>
<%
end if
end if
rs.MoveNext
Loop
rs.Close
%>
</table>
Tag : PHP
Date :
2011-06-23 10:04:07
By :
emm
View :
22710
Reply :
4
ยาวเยียดดูแล้วไม่เข้าใจค่ะ ใครก็ได้ข่วยหนูที
Date :
2011-06-23 10:25:02
By :
emm
ถ้าไม่ดึงแบบนี้จะได้ไหม
Date :
2011-06-23 11:24:46
By :
deedee2338
Code (ASP)
<%
if request.QueryString("q_year")="" then
sql2="where start_date like '%" &Year(Date)+543& "' or start_date like '%" &Year(Date)+543+1& "'"
else
sql2="where start_date like '%" &request.QueryString("q_year")& "' "
end if
Sql="Select id, name, due_state, num_submit, num_want, num_backup,limit_date From extra_jobs " &sql2&" Order By due_state DESC,id DESC"
rs.Open Sql, Conn, 0, 3
Do While Not rs.EoF
Total=0
dueState=rs("due_state")
numSubmit=rs("num_submit")
numWant=rs("num_want")
numBackUp=rs("num_backup")
Total=numWant + numBackUp
' Check Limit Date Less Then Now Date
if (rs("limit_date") < Date) Or (numSubmit=Total) then
rs("due_state")=True
rs.Update
' update Field state
'response.write rs("limit_date") &"#"& Date &"#submit="& numSubmit &"#tt="& TotalSubmit &"#"& rs("id") &"#"& rs("num_want") &"#"& rs("num_backup")
ELSE
rs("due_state")=false
rs.Update
end if
if Not dueState then
if Total > numSubmit then
%>
โค้ดก้อเป็นแบบนี้แหละค่ะ ช่วยแปลงเป็น php หน่อยค่ะ
Date :
2011-06-23 13:31:24
By :
emm
Load balance : Server 04