/*如果下拉列表不为空执行以下*/
if($_POST['select']){
include ("conn.php")
$select=$_POST['select']
$search=$_POST['search']
$SQL = "SELECT * FROM emails where $select='$search' limit 0,10 "
$query=mysql_query($SQL,$conn)
while($row=mysql_fetch_array($query)){
echo'<tr>
<td width="120" height="31" align="center">'.$row[emaildata].'</td>
<td width="93" height="31" align="center">'.$row[name].'</td>
<td width="93" height="31" align="center">'.$row[type].'</td>
<td width="119" height="31" align="center">'.$row[emailtype].'</td>
<td width="119" height="31" align="center">'.$row[emailid].'</td>
<td width="173" height="31" align="center">'.$row[emailadd].'</td>
</tr>'
}}else{
/*如果下拉列表为空执行以下*/
$SQL = "SELECT * FROM emails limit 0,10"
$query=mysql_query($SQL,$conn)
while($row=mysql_fetch_array($query)){
echo'<tr>
<td width="120" height="31" align="center">'.$row[emaildata].'</td>
<td width="93" height="31" align="center">'.$row[name].'</td>
<td width="93" height="31" align="center">'.$row[type].'</td>
<td width="119" height="31" align="center">'.$row[emailtype].'</td>
<td width="119" height="31" align="center">'.$row[emailid].'</td>
<td width="173" height="31" align="center"> '.$row[emailadd].'</td>
</tr>'
}}
?>
分不分前后台是要看网站项目大小的吧,php混编一来代码看着不美观,二来代码穿插太凌乱,以后想二次开发扩展肯定困难。现在都讲究一个好的架构模式,实现表现层(UI)、业务逻辑层(BLL)、数据访问层(DAL)分离或MVC模式,这样整个站点结构是不是更美观清晰呢欢迎分享,转载请注明来源:内存溢出
评论列表(0条)