本帖最后由 spg120 于 2011-01-09 21:50:55 编辑

解决方案 »

  1.   

    $row[] = $db->fetch_row($query);
      

  2.   

     $sql="SELECT * FROM `message` where id = ".$_GET[id];
    由于这句话就是根据id查处一行的值啊。
      

  3.   

    smarty模板的问题
    参考
    http://www.smarty.net/docsv2/en/language.function.section.tpl
    {section name=customer loop=$row}
      id: {$row[customer][1]}<br />
    {/section}
      

  4.   

    恩  赋值$row[]=mysql_fetch_array()
    or array_push($row,$row[id]);
      

  5.   

    数组$row assign以后到页面 按照 {$row.key}读取如 {$row.id}
    {$row.user}
    {$row.title}
      

  6.   

    首先 mysql与smarty没有关系
    只要把结果集转化为正常的数组 然后按照上面的写法就可以了
      

  7.   

    不好使啊 
    难道你们是这么写的
      $sql="select * from users";//表里有password 和name
      $result=mysql_query($sql);
    $row=mysql_fetch_array($result)
      $smarty->assign("test",$row);
      $smarty->display("index.htm"); 
    }这是我html文件,如果这样写只能遍出历 头一个字母
    <table>
     {section name=list loop=$test}
     <tr>
      <td> {$test[list].name} </td>//这里我想遍历出NAME
      <td>&nbsp;</td>
      <td> {$test[list].password} </td>//这里我想遍历出PASSWORD
      <td height="44">5</td>
      </tr>
     {/section}
      </table>
      

  8.   

     $row=$db->fetch_row($query);
    这个查询出来的是一维数组,所以你在index.htm 页面这样就行了
    标题:{$row.title} 
    内容:{$row.content}
    如果你查询出来的是二维数组 (比如列表页)
    你就这样了 {foreach from=$newslist item=r}  
      <tr>
        <td><a href="index.php?m=show&id={$r.id}">{$r.title}</a></td>    
      </tr>
    {/foreach}section和foreach 都是循环的,foreach 比较简单直观,没有section功能多
      

  9.   

    参考
    http://topic.csdn.net/u/20110110/12/3d399672-271f-42c7-94cb-fa4cd0a3dced.html
      

  10.   

    {foreach from=$array key=$key,;item=$value}
    echo $key:$value
      

  11.   

    {foreach item=value key=key from=$StieInfo}
    {$key} : {$value}
    {/foreach}