2012-05-22 19 views

回答

0

嘗試使用支票這樣的:

$link = mysql_connect("localhost", "mysql_user", "mysql_password"); 
mysql_select_db("database", $link); 

$result = mysql_query("SELECT * FROM users", $link); 
$num_rows = mysql_num_rows($result); 

$i=0; 
while ($row = mysql_fetch_assoc($result)) { 
$i++; 
    echo $row["userid"]; 
    echo $row["fullname"]; 
    echo $row["userstatus"]; 

    if ($i == $num_rows)  
       break; 

    echo '<hr>'; 
} 

mysql_free_result($result); 
1
<?php 
$args = array('YOUR_QUERY_ARGS'); 
$query = new WP_Query($args); 
$i=1; 
if($query->have_posts()) : while($query->have_posts()) : $query->the_post(); 
?> 
    <!-- YOUR POSTS HERE --> 
<?php 
    echo $i==$query->found_posts ? '' : '<hr/>'; 
    $i++; 
endwhile;endif; 
?> 

我會強烈建議使用WP Query到位query_posts()如果您還不是的。

相關問題