而php和jquery - 如果php有一段时间jquery不工作?

I don't know what is happening, but if I haven't any row in my php while to show jquery click will not work.

If I have one or more rows in WHILE jquery works. If I remove the while part of php, it works.

php:

$stmt = $mysqli_link->prepare("select id, user from posts limit 10");
$stmt->execute();
$stmt->bind_result($id, $user);

$i=0;
while($stmt->fetch()) { //if nothing to show JQUERY will not work
 $i=$i+1;
 show_p($id, $user);
}

$stmt->close();

jquery

$(document).ready(function(){
$(".changesize").click(function(e){
 alert("ok");
});
});

what is the problem with while and jquery? any ideas?

EDIT----------------------- my temporary solution:

$stmt->store_result();
$num = $stmt->num_rows; //NUM ROWS

if($num>0){ //if more than 0 rows. call while

    $i=0;
    while($stmt->fetch()) {
...

Maybe not the main cause of your problem, but here's a problem: you cannot use bind_results() with PHP Data Objects. There is no point in using it in the first place as PDO's functions handle all that hassle.

I'm concerned about the method because you pass the same variables to it which you pass to the show_p() function in the while loop; and your problem apparently comes from the show_p() function.

Undo that line with bind_results() and run your query again.