建立动态的WML站点(三)

继之顾客必需在下二个文书中输入。咱们须求客户输入科指标名字大概教师的姓。你要小心一下变量在页面之间是哪些传送的。语法看来有些复杂,可是能够让您打探全体进度是怎么样通过多少个文本来成功的。
?phpHeader(Content-type: text/vnd.wap.wml卡塔尔国;header(Cache-Control:
no-cache, must-revalidate卡塔尔(قطر‎;header(Pragma: no-cache卡塔尔(قطر‎;echo (<?xml
version=’1.0’?>;卡塔尔(قطر‎;>; <!DOCTYPE wml PUBLIC -//WAPFORUM//DTD WML
1.1//EN _1.1.xml >; <WML> <CARD id=card3 title=Name> <?phpecho
(<p>Insert );if (${$choice} == surname) {echo (professor’s surname (or
part of it).n);} else if (${$choice} == subject) {echo (the subject (or
part of it).n); } else {echo (Maybe there is some problem.n);} echo
(<INPUT name=’${$choice}’ type=’text’>);?<DO type=text label=Go>
<GO href=query.wml method=get> ?phpecho (<POSTFIELD
value=’$.$choice./’ name=’$choice’>);echo (<POSTFIELD
value=’$.${$choice}./’ name=’${$choice}’>);?</GO> </DO>
<P></P> </CARD> </WML> <DO type=text label=Go> <GO
href=index3.wml#card3 method=get> ?phpecho (<POSTFIELD
value=’$.$choice./’ name=’$choice’>卡塔尔国;echo (<POSTFIELD value=’$choice/’
name=’choice’>State of Qatar;?</CATucsonD> </WML> 写查询代码
以下的文书肩负管理查询。它的名字是query.wml,大家将更详实地剖判它。
?phpHeader(Content-type: text/vnd.wap.wml卡塔尔国;printf(?xml
version=1.0?n卡塔尔国;printf(n卡塔尔;printf(nState of Qatar;//
以下各行是用来为查询授课时间布局SQL语句的$consulting_tables
=(professors left join teach on (professors.Id = teach.Id),
subjects);$consulting_columns =professors.Surname, professors.Name,
subjects.Subject , ;$consulting_columns .=subjects.Cod_number,
professors.Consulting_hour,
professors.Consulting_place;$consulting_query=subjects.Cod_Subject =
teach.Cod_subject ;//
以下各行是用来为查询考试时间协会SQL语句的$exams_tables= (exams left
join professors ON (exams.Id = professors.Id),
subjects);$exams_columns= subjects.Subject , subjects.Cod_number,
professors.Surname, ;$exams_columns.= professors.Name, exams.Date,
exams.Time, exams.Room, exams.Test;$exams_query= exams.Cod_Subject =
subjects.Cod_Subject ;//
以下各行是用来为查询考试时间表的sql语句扩充查询范围 if ($exams_data)
{switch($exams_data) {case subject:$exams_query.= and subjects.Subject
like ‘%$subject%’;break;case surname:$exams_query.= and
professors.Surname like ‘%$surname%’;break;}}//
以下各行是用来为查询授课时间的sql语句扩大查询范围 if ($consulting_data)
{switch($consulting_data) {case subject:$consulting_query.= and
subjects.Subject like ‘%$subject%’;break;case
surname:$consulting_query.= and professors.Surname like
‘%$surname%’;break;}}// 管理与数据库的连接function connect($tables,
$data, $condition_passed) {//// put your password and username in next
line//$db = mysql_pconnect(localhost,***,***);// put your
database name in next linemysql_select_db(lanfranchi_co_uk,$db);$sql
= SELECT $data FROM $tables WHERE $condition_passed order by
professors.Surname;$result = mysql_query($sql,$dbState of Qatar;return $result;}//
那几个函数发生授课时间的wml代码 function
consulting_print($consulting_result) {global $file;printf(n);printf(
<P>Receiving hoursn);while ($myrow =
mysql_fetch_row($consulting_result)) {printf( <P>$myrow[0],
$myrow[1]</P>n);printf( <P>$myrow[2]</P>n);printf(
<P>$myrow[3]</P>n);printf( <P>$myrow[4]</P>n);printf(
<P>$myrow[5]</P>nState of Qatar;}printf(</CA冠道D>n);}//
那几个函数产生检查实验时间表的wml代码 function print_exams($exams_result)
{global $file;printf(<CARD id=’card1′ title=’hours’>n);printf(
<P>Examinations hoursn);while ($myrow =
mysql_fetch_row($exams_result)) {printf( <P>$myrow[2],
$myrow[3]</P>n);printf( <P>$myrow[0]</P>n);printf(
<P>$myrow[1]]</P>n);printf( <P>$myrow[4],
$myrow[5]</P>n);printf( <P>$myrow[7]</P>n);printf(
<P>$myrow[6]</P>nState of Qatar;}printf(</CAPAJEROD>n卡塔尔;}//
检查你时候选用任课时间仍然质量评定时间,连接数据库並且调用发生wml代码的函数
if ($consulting_data) {$connection_result
=connect($consulting_tables, $consulting_columns,
$consulting_query);consulting_print($connection_result);}if
($exams_data) {$connection_result =connect($exams_tables, $
exams_columns, $
exams_query);print_exams($connection_result卡塔尔(قطر‎;}printf(</WML>n卡塔尔;?
好,达成了。你曾经确立了第一个依赖MySQL数据库的PHP/WML页面了,本人一连实施一下吗。

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图