PHP, SQL limit query by php variable

前端 未结 2 1220
温柔的废话
温柔的废话 2021-01-17 03:00

PHP code defining variable sqlshowvalue

$sqlshowvalue = 5;
if(isset($_POST[\'showmore\'])) {
     $sqlshowvalue += 5;
}

So I connect to my

2条回答
  •  北海茫月
    2021-01-17 03:29

    Remove '' use only $sqlshowvalue:-

    $result = mysqli_query($conn,"SELECT * FROM comments 
    ORDER BY id DESC limit $sqlshowvalue");
    

    for integer value no need of ''

提交回复
热议问题