• λ我爱Aspx >> C#.Net >> 用PHP实现ODBC数据分页显示一例_PHP技巧
  • 用PHP实现ODBC数据分页显示一例_PHP技巧

  • :aspxer  Դ:internet  :2007-4-28 23:45:59  ؼ:数据
  • $rst = odbc_exec($con,$sql) or die("$sql查询出错"); //执行取得数据SQL语句

    $fieldcount = odbc_num_fields($rst); //取得字段总数

    echo '<table border="1" cellspacing="0" cellpadding="0">';

    echo '<tr>';

    for($i=1;$i<=$fieldcount;$i++){

    echo '<th>' . odbc_field_name($rst,$i) . '</th>'; //显示第$i个字段名

    }

    echo '</tr>';

    $rowi = ($page-1)*$pagesize+1;

    for($i=0;$i<$pagesize;$i++){

    echo '<tr>';

    if($rowi>$recordcount){

    for($j=0;$j<$fieldcount;$j++){

    echo '<td>&nbsp;</td>';

    }

    }

    else{

    odbc_fetch_into($rst,$rowi,&$row);

    for($j=0;$j<$fieldcount;$j++){

    $field = $row[$j];

    if($field=='') $field = '&nbsp;';

    echo '<td>' . $field . '</td>';

    }

    $rowi = $rowi+1;

    }

    echo '</tr>';

    }

    echo '</table>';

    odbc_free_result($rst); //释放资源

    }

    else{

    echo "无数据";

    }

    odbc_close($con); //关闭连接并释放资源

    ?>

    Ҷƪл˵?
  • һƪPHP 留言簿(带Oracle数据库分页的显示功能)_PHP实例
    һƪ在ASP中,用JScript脚本实现分页的另类办法_ASP技巧