《index.php》
<?php
include "db.php"; //資料庫連線設定
$sql="select a,b,c from tbl where a>10";
$res=@mysql_query($sql);
if(mysql_num_rows($res)>0){
$main="";
while(list($a,$b,$c)=mysql_fetch_row($res)){
$main.="a+b+c=".$a+$b+$c."<br/>";
}
}
if($main){
include "template.php";
}
?>
《template.php》
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
</head>
<body>
<?php
echo $main;
?>
</body>
</html>
沒有留言:
張貼留言