mysqli_query()期望参数1为mysqli null,任何人都可以修复它?

时间:2015-01-29 17:54:40

标签: php mysqli

<?php


$results = mysqli_query($connecDB,"SELECT COUNT(*) FROM paginate WHERE IDmen='$name11'");
$get_total_rows = mysqli_fetch_array($results); //total records

//break total records into pages
$total_pages = ceil($get_total_rows[0]/$item_per_page); 

?>

我收到此错误:

  

mysqli_query()要求参数1为mysqli,在第4行的/home//public_html/load-more-men.php中给出null   mysqli_fetch_array()要求参数1为mysqli_result,在第5行的/home//public_html/load-more-men.php中给出null   在第8行的/home//public_html/load-more-men.php中除以零

enter image description here

1 个答案:

答案 0 :(得分:0)

<?php

$connecDB = mysqli_connect("localhost","my_user","my_password","my_db");

$results = mysqli_query($connecDB,"SELECT COUNT(*) FROM paginate WHERE IDmen='$name11'");
$get_total_rows = mysqli_fetch_array($results); //total records

//break total records into pages
$total_pages = ceil($get_total_rows[0]/$item_per_page); 

?>