No announcement yet.

Problem connect to database

  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem connect to database

    After deployment to my project and installing it in root folder the following problem occurs when I try to edit the connection to database :
    Connection error mysql_connect() : the mysql extension is deprecated and will be removed in the future : use mysqli or PDO instead
    Some information about my server :Ubuntu 13.04 / php version 5.5.6
    I think the problem is with php version but how can I use scriptcase project on this machine (I tried to use all types of dbms : mysql (transaction) - mysql and mysql pdo) , When I tried to test the connection "success connection" message displayed .
    The problem occurs when I tried to select the database and the list of database is empty

    Note : In scriptcase (before deployment) there is no problem
    Last edited by alex; 12-21-2013, 01:59 PM.

  • #2
    Same problem with
    ubuntu 13.10
    PHP 5.5.3-1
    mysql-server 5.5.34-0


    • #3
      Link to a comment about the php problem
      The way to solve is not possible for SC users: the php code is inside SC.


      Why was mysql deprecated in PHP 5.5?

      Johannes Schlüter, one of the PHP developers listed missing points like these:

      Stored Procedures
      Prepared Statements
      Full charset support

      How to solve the warnings?

      Currently mostly many MySQL connections in PHP use this construct:
      $link = mysql_connect('localhost', 'user', 'password');
      mysql_select_db('dbname', $link);

      The way with MySQLi would be like this:
      $link = mysqli_connect('localhost', 'user', 'password', 'dbname');

      To run database queries is also simple and nearly identical with the old way:
      // Old
      mysql_query('CREATE TEMPORARY TABLE `table`', $link);
      // New
      mysqli_query($link, 'CREATE TEMPORARY TABLE `table`');

      Alternative solutions

      Besides the shown possibility there's are also solutions like using MySQLi in object oriented style or even switch to PHPs PDO (PHP Data Objects) like shown in this PDO Tutorial for MySQL Developers.

      Filthy and fastest solution

      Suppress all deprecated warnings including them from mysql_*:
      error_reporting(E_ALL ^ E_DEPRECATED);