my php code runnig nicely without any error in my local host but not running on

Hi friends !!

my php code runnig nicely without any error in my local host but not running on server !!
it shows error where i use php’s mysqli_numrows(),mysqli_fetchrows() etc, it showing errors like this
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/maxdudes/public_html/gujaratraksha.in/index.php on line 127

Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in /home/maxdudes/public_html/gujaratraksha.in/index.php on line 131

Warning: mysqli_fetch_row() expects parameter 1 to be mysqli_result, boolean given in /home/maxdudes/public_html/gujaratraksha.in/index.php on line 136

my code is here

include_once("db_conx.php");                              
$xbt = "SELECT * from photo_upload";
$query1 = mysqli_query($con,$xbt);
$rows = mysqli_num_rows($query1); 
   
$last_date = "SELECT SrNo,Upload_Date from photo_upload WHERE SrNo='$rows'";
$query_date = mysqli_query($con,$last_date);
 
$last_inserted_date = mysqli_fetch_row($query_date);
echo $last_inserted_date[1];
 
$sql = "SELECT Img_Location from photo_upload WHERE Upload_Date = '$last_inserted_date[1]'";
$query = mysqli_query($con,$sql);
while($result = mysqli_fetch_row($query)){		
echo '';
}

It means your query is failing. Use mysqli_error to find out why.

Do something like this:

if (!mysqli_query($con,"INSERT INTO Persons (FirstName) VALUES ('Joe')")) { echo("Error description: " . mysqli_error($con)); }

Thanx for reply,

  I tried it but there is no error detected !! Its running nicely on my local host but on server its not running !! is php 4.0.8 version supoort mysqli queries ??

You are way behind on PHP version. You need to upgrade your PHP. Version 5 came out eleven years ago.

As Kevin said, that PHP version is way too outdated to be able to do anything on.

You need to running on, at the very least, PHP 5.2, although 5.4 or 5.5 would be better. If you’re struggling to find a host, check out DigitalOcean. They have a plan for $5 per month and provide you with SSH access and a LAMP stack where you’ll be able to control the PHP version yourself.

Sponsor our Newsletter | Privacy Policy | Terms of Service