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

**URL:** <https://www.phphelp.com/t/my-php-code-runnig-nicely-without-any-error-in-my-local-host-but-not-running-on/22438>\
**Category:** General Chat\
**Created:** [April 1, 2014, 3:33pm UTC](https://www.phphelp.com/t/my-php-code-runnig-nicely-without-any-error-in-my-local-host-but-not-running-on/22438 "2014-04-01T15:33:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![saiyed9974](https://www.phphelp.com/user_avatar/www.phphelp.com/saiyed9974/32/1032_2.png) [@saiyed9974](https://www.phphelp.com/u/saiyed9974)\
**Post date:** [April 1, 2014, 3:33pm UTC](https://www.phphelp.com/t/my-php-code-runnig-nicely-without-any-error-in-my-local-host-but-not-running-on/22438/1 "2014-04-01T15:33:35Z")

</div>

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 ' ![]()';
}
```

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [April 1, 2014, 5:35pm UTC](https://www.phphelp.com/t/my-php-code-runnig-nicely-without-any-error-in-my-local-host-but-not-running-on/22438/2 "2014-04-01T17:35:37Z")

</div>

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));
  }`

---

<div class="post-metadata">

**Author:** ![saiyed9974](https://www.phphelp.com/user_avatar/www.phphelp.com/saiyed9974/32/1032_2.png) [@saiyed9974](https://www.phphelp.com/u/saiyed9974)\
**Post date:** [April 2, 2014, 7:42am UTC](https://www.phphelp.com/t/my-php-code-runnig-nicely-without-any-error-in-my-local-host-but-not-running-on/22438/3 "2014-04-02T07:42:09Z")

</div>

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 ??
```

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [April 2, 2014, 1:48pm UTC](https://www.phphelp.com/t/my-php-code-runnig-nicely-without-any-error-in-my-local-host-but-not-running-on/22438/4 "2014-04-02T13:48:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mrterryh](https://www.phphelp.com/user_avatar/www.phphelp.com/mrterryh/32/477_2.png) [@mrterryh](https://www.phphelp.com/u/mrterryh)\
**Post date:** [May 28, 2014, 2:29am UTC](https://www.phphelp.com/t/my-php-code-runnig-nicely-without-any-error-in-my-local-host-but-not-running-on/22438/5 "2014-05-28T02:29:43Z")

</div>

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.
