These two files will output the number of records (2) from a MySQL database
but not the record data. Can anyone suggest what I'm doing wrong?

Thanks, Chris

$dbc = mysqli_connect("localhost", "root", "password", "cjfiles"); 
$results = mysqli_query($dbc, "SELECT * FROM article");
$records = mysqli_num_rows($results);

require_once 'PHPTAL.php';

$template = new PHPTAL('show_articles.html');
$template->results = $results;
$template->records = $records;

try {
   echo $template->execute();
catch (Exception $e){
   echo $e;

<h1 tal:content="records">Records</h1>
<table border="1" cellpadding="2" cellspacing="2">
  <tr tal:repeat="result results">
    <td tal:content="result/id">text replaced by result</td>
    <td tal:content="result/entitled">text replaced by result</td>
    <td tal:content="result/located_at">text replaced by result</td>
    <td tal:content="result/written_by">text replaced by result</td>
    <td tal:content="result/created_on">text replaced by result</td>
    <td tal:content="result/updated_on">text replaced by result</td>
    <td tal:content="result/words_long">text replaced by result</td>
PHPTAL mailing list

Reply via email to