[請益] {Smarty問題}撈出資料怎麼顯示不出來呢?
目前我有個資料表有三個欄位
ID - 主鍵編號
Name - 姓名
Tel - 手機號碼
我的目的只是想把資料庫中的所有資料作顯示
首先一些設定檔放在main.php
<?php
include "library/Smarty/Smarty.class.php";
define('APP_PATH', str_replace('\\', '/', dirname(__FILE__)));
$tpl = new Smarty();
$tpl->template_dir = APP_PATH . "/templates/";
$tpl->compile_dir = APP_PATH . "/templates_c/";
$tpl->config_dir = APP_PATH . "/configs/";
$tpl->cache_dir = APP_PATH . "/cache/";
?>
執行的test.php
<?php require_once('Connections/test_conn.php'); ?>
<?php
mysql_select_db($database_test_conn, $test_conn);
$query_Recordset1 = "SELECT * FROM test ORDER BY ID ASC";
$Recordset1 = mysql_query($query_Recordset1, $test_conn) or
die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
require "main.php";
$tpl->assign('$AllMan', $Recordset1);
$tpl->display('test2.htm');
mysql_free_result($Recordset1);
?>
顯示的樣板test.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>姓名列表</title>
</head>
<body>
{section name="sel1" loop=$AllMan}
<table width="300" border="1">
<tr>
<td>{$AllMan[sel1].ID}</td>
<td>{$AllMan[sel1].Name}</td>
<td>{$AllMan[sel1].Tel}</td>
</tr>
</table>
{/section}
</body>
</html>
我如果單純在同一支php裡面做顯示都沒有問題
這樣應該等於說撈出來的資料應該沒錯才對
指示分開成樣板和php時候就都一片空白
不知道哪邊的問題呢? 謝謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.193.225.140
推
03/01 20:46, , 1F
03/01 20:46, 1F
→
03/02 05:47, , 2F
03/02 05:47, 2F
→
03/02 05:48, , 3F
03/02 05:48, 3F
→
09/15 00:44, , 4F
09/15 00:44, 4F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 3 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章