Problem database access with PHP 7

In my application, I’ve some grids and form that I load from mysql tables.
It works fine in PHP 5.6 but no data is loaded with PHP 7.1

Here is the code : gridcontacts.php

<?php require ("../connector/grid_connector.php"); require ("configDB.php"); $res = mysql_connect($srv, $user, $pwd); if (!$res) { die('Connexion impossible: ' . mysql_error()); } mysql_select_db("gestco"); $sql = "SELECT id_contact, genre.designation as genre, nom, prenom, telephone_fixe, mobile, email, fact_adrs_1, fact_adrs_2, fact_codepost, fact_ville FROM contacts INNER JOIN genre ON (genre.id_genre = contacts.id_genre)"; $conn = new GridConnector($res); $conn->render_sql($sql,"id_contact","id_contact,genre,nom,prenom,telephone_fixe,mobile,email,fact_adrs_1,fact_adrs_2,fact_codepost,fact_ville"); ?>

Here is the part of code to load a grid

contactGrid = myLayout.cells(“b”).attachGrid();
contactGrid.setHeader(“,Genre,Nom,Prénom,N° Téléphone Fixe,Mobile,e-Mail,Adresse Facturation 1,Adresse Facturation 2,Code Postal,Ville Facturation”);
contactGrid.setColumnIds(“id_contact,id_genre,nom,prenom,telephone_fixe,mobile,email,fact_adrs_1,fact_adrs_2,fact_codepost,fact_ville”);
contactGrid.setColTypes(“ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro”);
contactGrid.setInitWidths(“25,50,200,180,130,130,200,200,200,100,220”);
contactGrid.enableAutoWidth();
contactGrid.attachEvent(“onRowDblClicked”, doOnRowDblClicked);
contactGrid.init();
contactGrid.load(“php/gridcontacts.php”);

How can I fixe this ?
Thanks for your help

mysql_connect is deprecated in PHP 7
You need to use PDO instead of mysql driver.

<?php 
require ("../connector/grid_connector.php");
require ("../connector/db_pdo");
require ("configDB.php"); 

$res= new PDO("mysql:dbname=gestco;host=$mysql_server",$mysql_user,$mysql_pass);

$sql = "SELECT id_contact, genre.designation as genre, nom, prenom, telephone_fixe, mobile, email, fact_adrs_1, fact_adrs_2, fact_codepost, fact_ville FROM contacts INNER JOIN genre ON (genre.id_genre = contacts.id_genre)";

$conn = new GridConnector($res, "PDO");
$conn->render_sql($sql,"id_contact","id_contact,genre,nom,prenom,telephone_fixe,mobile,email,fact_adrs_1,fact_adrs_2,fact_codepost,fact_ville"); ?>

Thanks Stanislav,

I follow your recommendation and I get these errors :

I have tested my server with that php script :
<?php
$mysqlnd = function_exists(‘mysqli_fetch_all’);

	if ($mysqlnd) {
    	echo 'mysqlnd enabled!';
	}

	try 
	{
		$pdo = new PDO('mysql:host=localhost;dbname=gestco', 'user', 'password');
	}
	catch (PDOException $e) 
	{
    	echo 'Error: ' . $e->getMessage();
    	exit();
	}
	echo 'Connected to MySQL';
?>

And it’s ok.
How can I investigate ?

Regards

Try to open php file directly in a browser. So you will see error messages, if any.
The client side error just shows that incoming data is invalid