2015-12-03 57 views
0

警告:mysql_num_rows()預計參數1是資源,布爾在E:\xampp\htdocs\php\oop\codingcage_one\index.php Image選擇查詢不起作用

<table align="center"> 
    <tr> 
    <th colspan="5"><a href="insert-update.php">add data here.</a></th> 
    </tr> 
    <th>First Name</th> 
    <th>Last Name</th> 
    <th>City Name</th> 
    <th colspan="2">Operations</th> 
    </tr> 
    <?php 

     $res = $con->getdata("SELECT * FROM users "); 
     if (mysql_num_rows($res) == 0) 
     { 

    ?> 
    <tr> 
    <td colspan="5">Nothing Found Here !</td> 
    </tr> 
    <?php 
     } 
     else 
     { 
      while($row = mysql_fetch_array($res)) 
      { 
    ?> 
     <tr> 
     <td><?php echo $row['first_name']; ?></td> 
     <td><?php echo $row['last_name']; ?></td> 
     <td><?php echo $row['user_city']; ?></td> 
     <td align="center"><a href="javascript:edt_id('<?php ?>')"><img src="b_edit.png" alt="EDIT" /></a></td> 
     <td align="center"><a href="javascript:delete_id('<?php ?>')"><img src="b_drop.png" alt="DELETE" /></a></td> 
     </tr> 
     <?php 
      } 
     } 
?> 
    </table> 
+2

僅供參考 - mysql已棄用,請嘗試使用mysqli或PDO。向我們顯示連接信息。 – Thamilan

回答

0
$res = $con->getdata("SELECT * FROM users "); 

給出替換爲:

$res = mysql_query("SELECT * FROM users ");