Page 1 of 1

PHP Warning: mysqli_begin_transaction()

PostPosted: 13. October 2016 10:40
by toreachdeepak
Hello,

I am using PHP 5.6.24

=================My Program========================================
$link = mysqli_connect("127.0.0.1", "root", "", "testdb");

if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}

mysqli_begin_transaction($link, MYSQLI_TRANS_START_READ_ONLY);

mysqli_query($link, "SELECT name,age FROM person_table LIMIT 1");
mysqli_query($link, "SELECT name,age FROM person_table LIMIT 5");
mysqli_commit($link);

mysqli_close($link);
======================================================================

I get the following warning

PHP Warning: mysqli_begin_transaction(): This server version doesn't support 'R
EAD WRITE' and 'READ ONLY'. Minimum 5.6.5 is required in C:\xampp\htdocs\commit1
.php on line 10

Re: PHP Warning: mysqli_begin_transaction()

PostPosted: 13. October 2016 11:01
by Nobbie
And what? A clear message including the fix - what are you missing?

Re: PHP Warning: mysqli_begin_transaction()

PostPosted: 13. October 2016 11:15
by toreachdeepak
Hello Nobbie,

Why I am getting the warning when my PHP Version is 5.6.24. Is there any fix to this problem ? Please send me the the fix.

Regards

Deepak

Re: PHP Warning: mysqli_begin_transaction()

PostPosted: 13. October 2016 11:28
by Nobbie
Thats only MININUM requirement, did you follow http://php.net/manual/en/mysqli.begin-transaction.php? Which engine did you declare on the table?

Anyway, version 5.6.5 relates to the MySQL Version(!), whereas you are referring to the PHP Version (which is similar, unfortunately). Which MySQL Version are you running?

toreachdeepak wrote:Why I am getting the warning when my PHP Version is 5.6.24.


See above. Because the PHP Version does not matter, the MySQL Version matters.

Re: PHP Warning: mysqli_begin_transaction()

PostPosted: 13. October 2016 11:48
by toreachdeepak
Hello Nobbie,

I downloaded xampp-win32-5.6.24-1-VC11-installer.exe. Which version of mysql does it have ? When I open the mysql from command line

========================================================================================================
C:\Users\abc>mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 86
Server version: 10.1.16-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>
=================================================================================

Re: PHP Warning: mysqli_begin_transaction()

PostPosted: 13. October 2016 12:05
by Nobbie
I dont know, ask Bitnami. But dont confuse PHP Version and Server Version (which relates to MySQL / MariaDB). Maybe MariaDB does not support transactions, maybe the message itself is faulty, anyway, the message tells you AT LEAST to use MySQL 5.6.5.

If Xampp / MariaDB does not support transactions, you cannot use it. Ask Bitnami.

Re: PHP Warning: mysqli_begin_transaction()

PostPosted: 13. October 2016 12:12
by toreachdeepak
Hi Nobbie,

MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE '%version%';
+-------------------------+---------------------------------
| Variable_name | Value
+-------------------------+---------------------------------
| innodb_version | 5.6.30-76.3
| protocol_version | 10
| slave_type_conversions |
| version | 10.1.16-MariaDB
| version_comment | mariadb.org binary distribution
| version_compile_machine | 32
| version_compile_os | Win32
| version_malloc_library | system
| version_ssl_library | YaSSL 2.3.9b
+-------------------------+---------------------------------
9 rows in set (0.00 sec)