开发者

Num Rows always ='s 1 for some reason. QUICK FIX

开发者 https://www.devze.com 2023-01-11 09:57 出处:网络
I don\'t know if i am doing it right, this is what I got: while($row = mysqli_fetch_assoc($result)) { $items = mysqli_num_rows($row);

I don't know if i am doing it right, this is what I got:

while($row = mysqli_fetch_assoc($result)) {
     $items = mysqli_num_rows($row); 
}

It always sets $it开发者_如何学Goems = to 1 for some reason.

Here is my mysqli_query...

$top10_query = "SELECT * FROM users WHERE userid='$userid'";
                        $result = mysqli_query($cxn, $top10_query) or die("Couldn't execute query.");
                        $row = mysqli_fetch_assoc($result);


Well, $row only contains one row so....

$items = mysqli_num_rows($result)

should give you the correct number of items


Anyway, why are you doing that in a loop? The number of rows is constant...

0

精彩评论

暂无评论...
验证码 换一张
取 消