# Slim has randomly stopped working for my mobile app

**URL:** <https://discourse.slimframework.com/t/slim-has-randomly-stopped-working-for-my-mobile-app/3269>\
**Category:** Questions\
**Created:** [July 13, 2019, 1:29am UTC](https://discourse.slimframework.com/t/slim-has-randomly-stopped-working-for-my-mobile-app/3269 "2019-07-13T01:29:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![early237](https://avatars.discourse-cdn.com/v4/letter/e/c5a1d2/32.png) [@early237](https://discourse.slimframework.com/u/early237)\
**Post date:** [July 13, 2019, 1:29am UTC](https://discourse.slimframework.com/t/slim-has-randomly-stopped-working-for-my-mobile-app/3269/1 "2019-07-13T01:29:08Z")

</div>

Hey all,

I’ve been running a simple mobile application fine for a while now and a few days a go, it has stopped working. I haven’t changed a single piece of code both front or back end so this is random.

I’ve checked the error logs and it seems something involving Slim is causing the issue.

It’s a huge log as i’ve only just noticed that no new users have signed up so please can someone help ASAP.

I used AJAX calls to the back-end php to contact slim and make various functions work but nothing is working.

Here is a snippet of the error:

[28-Feb-2019 23:30:35 UTC] Slim Application Error:  
Type: Error  
Message: Call to undefined function mysql\_num\_rows()  
File: /home/u643930530/domains/tattmatch.tech/src/routes/customers.php  
Line: 93  
Trace: #0 [internal function]: Closure-\>{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response), Array)  
#1 /home/u643930530/domains/tattmatch.tech/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(41): call\_user\_func(Object(Closure), Object(Slim\Http\Request), Object(Slim\Http\Response), Array)  
#2 /home/u643930530/domains/tattmatch.tech/vendor/slim/slim/Slim/Route.php(335): Slim\Handlers\Strategies\RequestResponse-\>\_\_invoke(Object(Closure), Object(Slim\Http\Request), Object(Slim\Http\Response), Array)  
#3 /home/u643930530/domains/tattmatch.tech/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route-\>\_\_invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))  
#4 /home/u643930530/domains/tattmatch.tech/vendor/slim/slim/Slim/Route.php(313): Slim\Route-\>callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))  
#5 /home/u643930530/domains/tattmatch.tech/vendor/slim/slim/Slim/App.php(495): Slim\Route-\>run(Object(Slim\Http\Request), Object(Slim\Http\Response))  
#6 /home/u643930530/domains/tattmatch.tech/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App-\>\_\_invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))  
#7 /home/u643930530/domains/tattmatch.tech/vendor/slim/slim/Slim/App.php(388): Slim\App-\>callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))  
#8 /home/u643930530/domains/tattmatch.tech/vendor/slim/slim/Slim/App.php(296): Slim\App-\>process(Object(Slim\Http\Request), Object(Slim\Http\Response))  
#9 /home/u643930530/domains/tattmatch.tech/public\_html/index.php(21): Slim\App-\>run()  
#10 {main}  
View in rendered output by enabling the “displayErrorDetails” setting.

Any help will be greatly appreciated!

Thanks

James

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [July 13, 2019, 9:32am UTC](https://discourse.slimframework.com/t/slim-has-randomly-stopped-working-for-my-mobile-app/3269/2 "2019-07-13T09:32:41Z")

</div>

> `mysql_num_rows`

It looks like your provider changed the PHP version or removed the [deprecated](https://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) `mysql_` extension.

You should change your codebase from `mysql_` to `mysqli_` or `PDO`.

---

<div class="post-metadata">

**Author:** ![early237](https://avatars.discourse-cdn.com/v4/letter/e/c5a1d2/32.png) [@early237](https://discourse.slimframework.com/u/early237)\
**Post date:** [July 13, 2019, 12:12pm UTC](https://discourse.slimframework.com/t/slim-has-randomly-stopped-working-for-my-mobile-app/3269/3 "2019-07-13T12:12:40Z")

</div>

Thank you for the prompt reply and comments Odan but looking at the error log more, it seems the errors aren’t just related the mysql\_ extension.

I have just spoken with the providers and they did in fact change the php version which messed with my app! So all is fine now as it’s on version 5.6.

I’m new to this still so could you please explain why that would effect the functionality?

Thank you for your time!

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [July 13, 2019, 1:40pm UTC](https://discourse.slimframework.com/t/slim-has-randomly-stopped-working-for-my-mobile-app/3269/4 "2019-07-13T13:40:40Z")

</div>

The mysql\_\* extension has been **[removed](https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7#extmysql) entirely** as of PHP 7.0 (released December 2015)

Until PHP 5.6 the mysql extensions works, but after your provider changed the PHP version to 7.x, all mysql\_\* functions are gone.

> <https://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php/12860046#12860046>

---

<div class="post-metadata">

**Author:** ![early237](https://avatars.discourse-cdn.com/v4/letter/e/c5a1d2/32.png) [@early237](https://discourse.slimframework.com/u/early237)\
**Post date:** [July 13, 2019, 3:23pm UTC](https://discourse.slimframework.com/t/slim-has-randomly-stopped-working-for-my-mobile-app/3269/5 "2019-07-13T15:23:02Z")

</div>

Oh I see! Thank you for the clarity.

However, I feel if my app isn’t using the most up-to-date php version, will it cause issues down the line?

Looking at my php, it all uses PDO to carry out its functions EXCEPT the php code containing the connection to my database.

Could you suggest a way to structure this code so it able to use PHP 7.\*\*\*\*\*\*

public function connect(){

```
    $mysql_connect_str = "mysql:host=$this->dbhost;dbname=$this->dbname";
    $dbConnection = new PDO($mysql_connect_str,$this->dbuser, $this->dbpass);
    $dbConnection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    return $dbConnection;
}

```

}

Thank you!

---

<div class="post-metadata">

**Author:** ![odan](https://avatars.discourse-cdn.com/v4/letter/o/9de053/32.png) [@odan](https://discourse.slimframework.com/u/odan)\
**Post date:** [July 13, 2019, 5:08pm UTC](https://discourse.slimframework.com/t/slim-has-randomly-stopped-working-for-my-mobile-app/3269/6 "2019-07-13T17:08:01Z")

</div>

For Slim I would recommend using the container (as factory) for your [database connection](https://odan.github.io/2017/11/30/creating-your-first-slim-framework-application.html#database).

You may search in in your codebase, `/src/routes/customers.php Line: 93` and replace the old database code with PDO (for example).
