"Your First App" - mysql not working


#1

hi all,
i’m walking my first steps with dhtmlx and try to rebuild the “Your First App” (docs.dhtmlx.com/tutorials__firs … index.html).

I have XAMPP running on a Win7 maschine.

in Step 6 i’m supposed to connect to a mysql DB.

This is my contact.php

<?php
require("../codebase/connector/grid_connector.php");//adds the connector engine
$res=mysql_connect("localhost","root","");//connects to server with  db

mysql_select_db("mysql");//connects to db with name "dhtmlx_tutorial"  
 
$conn = new GridConnector($res);             //initializes the connector object
$conn->render_table("db","host","user,db");  //loads data //the method takes: the table's name, the id field, a list of fields to load

?>

and i’m receiving the following error:

googling gave me the suggestions, to exchange all mysql_* methods with mysqli_* methods, which carried the error a bit further:

[Wed Feb 21 11:02:22.359466 2018] [php7:warn] [pid 9264:tid 1620] [client ::1:57231] PHP Warning: Declaration of GridConnector::fill_collections($list) should be compatible with Connector::fill_collections() in C:\\xampp\\htdocs\\contact_manager\\codebase\\connector\\grid_connector.php on line 126, referer: http://localhost/contact_manager/ [Wed Feb 21 11:02:22.384466 2018] [php7:warn] [pid 9264:tid 1620] [client ::1:57231] PHP Warning: mysqli_select_db() expects exactly 2 parameters, 1 given in C:\\xampp\\htdocs\\contact_manager\\data\\contacts.php on line 5, referer: http://localhost/contact_manager/ [Wed Feb 21 11:02:22.385466 2018] [php7:error] [pid 9264:tid 1620] [client ::1:57231] PHP Fatal error: Uncaught Error: Call to undefined function mysql_query() in C:\\xampp\\htdocs\\contact_manager\\codebase\\connector\\db_common.php:964\nStack trace:\n#0 C:\\xampp\\htdocs\\contact_manager\\codebase\\connector\\db_common.php(650): MySQLDBDataWrapper->query('SELECT `host`,`...')\n#1 C:\\xampp\\htdocs\\contact_manager\\codebase\\connector\\base_connector.php(513): DBDataWrapper->select(Object(DataRequestConfig))\n#2 C:\\xampp\\htdocs\\contact_manager\\codebase\\connector\\base_connector.php(496): Connector->get_resource()\n#3 C:\\xampp\\htdocs\\contact_manager\\codebase\\connector\\base_connector.php(398): Connector->render()\n#4 C:\\xampp\\htdocs\\contact_manager\\data\\contacts.php(8): Connector->render_table('db', 'host', 'user,db')\n#5 {main}\n thrown in C:\\xampp\\htdocs\\contact_manager\\codebase\\connector\\db_common.php on line 964, referer: http://localhost/contact_manager/ [Wed Feb 21 11:02:50.996363 2018] [php7:warn] [pid 9264:tid 1616] [client ::1:57291] PHP Warning: Declaration of GridConnector::fill_collections($list) should be compatible with Connector::fill_collections() in C:\\xampp\\htdocs\\contact_manager\\codebase\\connector\\grid_connector.php on line 126, referer: http://localhost/contact_manager/

do you have any idea?
I couldn’t find anything in the search facilities.

Thanks and Cheers,
K.


#2

phpinfo()
shows, that mysqli is configured:
mysqli
MysqlI Support enabled
Client API library version mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $
Active Persistent Links 0
Inactive Persistent Links 0
Active Links 0
Directive Local Value Master Value
mysqli.allow_local_infile On On
mysqli.allow_persistent On On
mysqli.default_host no value no value
mysqli.default_port 3306 3306
mysqli.default_pw no value no value
mysqli.default_socket no value no value
mysqli.default_user no value no value
mysqli.max_links Unlimited Unlimited
mysqli.max_persistent Unlimited Unlimited
mysqli.reconnect Off Off
mysqli.rollback_on_cached_plink Off Off


#3

Hi,

I am experiencing same issue. Did you find any solution to this problem?


#4

Please, try to use PDO.
Something like this in your contact.php:

<?php require("../codebase/connector/grid_connector.php"); $res= new PDO("mysql:dbname=dhtmlx_tutorial;host=localhost","root",""); $conn = new GridConnector($res,"PDO"); $conn->render_table("contacts","contact_id","fname,lname,email"); ?>

You also need to update your dhtmlxConnector by the following link: