duanjiong1952 2013-01-03 01:15
浏览 21

PHP Mysql_fetch_assoc正在省略最后一行

In PHP MYSQL_FETCH_ASSOC is omitting Last Row. This never happened. But this time it put me into soup at the last moment.

Even I've put up mysql_num_rows the result is 14 records -- but on list it shows only 13 records and the 14th record is omitted.

Any kind of help is Appreciated.

                $uno = $_GET["uno"];

                $xtc1 = 'select * from rform where uno="' . $uno . '" order by rno DESC';
                $xtc = mysql_query($xtc1) or die('User Reservation Retrival Error : ' . mysql_error());

                $trno = mysql_fetch_assoc($xtc);
                $trow = mysql_num_rows($xtc);


                echo '<p>List of Onlilne Reservations made by <strong style="font-weight:bold; color:red;">' . ucwords($trno["cname"]) . ' (' . $trow . ')</strong></p>';

                echo '<table cellpadding="5" cellspacing="0" border="1">';
                    echo '<tr>';
                        echo '<td colspan="5" style=" font-size:14px; text-align:center; font-weight:bold; color:red;">' . ucwords($trno["cname"]) . '</td>';
                    echo '</tr>';
                    echo '<tr>';
                            echo '<th>R.NO</th>';
                            echo '<th>From</th>';
                            echo '<th>To</th>';
                            echo '<th>Date &amp; Time of<Br>Travel</th>';
                            echo '<th>Reserved On</th>';
                        echo '</tr>';   
                    while($mtn = mysql_fetch_assoc($xtc)){
                        $dt = $mtn["csdate"] . ' ' . $mtn["ctime"];
                        echo '<tr>';
                            echo '<td>' . $mtn["rno"] . '</td>';
                            echo '<td>' . $dt . '</td>';
                            echo '<td>' . $mtn["caddr"] . '</td>';
                            echo '<td>' . $mtn["cdest"] . '</td>';
                            echo '<td>' . date('d-M-Y',strtotime($mtn["tstamp"])) . '</td>';
                        echo '</tr>';   
                    }
                    echo '</table>';

  • 写回答

2条回答 默认 最新

  • dsnw2651 2013-01-03 01:20
    关注

    You have an extra $trno = mysql_fetch_assoc($xtc) that you sem to be discarding. This is your missing row. Just remove that line.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据