PHP新手上路(十一)
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-05-24
cn.com"; $admin_name = "Webmaster"; $html_mail = "no"; ?> <HTML> <HEAD> <TITLE><?php echo $page_title; ?></TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" LINK="#000000"> <FONT FACE="Verdana" SIZE="-2"> <? /* connect to the database */ mysql_pconnect("$host","$user","$password") or die("Can''t connect to the SQL-server"); mysql_select_db("$database"); /* action=view : retrieve data from the database and show it to the user */ if($action == "view") { /* function for showing the data */ function search_it($name) { /* some vars */ global $offset,$total,$lpp,$dir; global $table,$html_mail,$admin_name,$admin_mail; /* select the data to get out of the database */ $query = "SELECT name, email, job, comments FROM $table"; $result = mysql_query($query); $total= mysql_numrows($result); print "<CENTER><FONT FACE="Verdana" SIZE="-2"><A HREF="guestbook.php3?action=add" onMouseOver="window.status=''Add your name'';return true" onMouseOut="window.status='''';return true" TITLE="Add your name">加入留言</A></FONT></CENTER><br><br>"; if ($total== 0) { print "<CENTER>此刻没人留言</CENTER><br><br>"; } elseif ($total> 0) { /* default */ $counter=0; if ($dir=="") $dir="Next"; $lpp=5; if ($offset==0) $offset=0; if ($dir=="Next") { if ($total > $lpp) { $counter=$offset; $offset+=$lpp; $num=$offset; if ($num > $total) { $num=$total; } } else { $num=$total; } } elseif ($dir=="Previous") { if ($total > $lpp) { $offset-=$lpp; if ($offset < 0) { $offset=0; } $counter=$offset-$lpp; if ($counter < 0) $counter=0; $num=$counter+$lpp; } else { $num=$total; } } while ($counter < $num) { $j=0; $j=$counter + 1; /* now really grab the data */ $i1=mysql_result($result,$counter,"name"); $i2=mysql_result($result,$counter,"email"); $i3=mysql_result($result,$counter,"job"); $i4=mysql_result($result,$counter,"comments"); $i4 = stripslashes ("$i4"); /* print it in a nice layout */ print "<CENTER>n"; print "<TABLE WIDTH=400 BORDER=0 ALIGN=CENTER VALIGN=TOP><TR><TD><FONT FACE="Verdana" SIZE="-2">n"; print "<HR>n"; print "<BR><B>Name:</B> $i1n"; print "<BR><B>email:</B><A HREF="mailto:$i2" onMouseOver="window.status=''Email $i2'';return true" onMouseOut="window.status='''';return true" TITLE="Email $i2">$i2</A>n"; print "<BR><B>Job:</B> $i3n"; prin |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
上一篇: php面向对象(四)下一篇: php面向对象(五)
关于PHP新手上路(十一)的所有评论