PHP version 7, MySQLi support

PHP version 7, MySQLi support

jkane50jkane50 Posts: 3Questions: 1Answers: 0

I'm using PHP version 7.x where PDO is depreciated and mysqli is the best choice. Do your products have a mysqli based data connector that will work with PHP 7.x?

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Where did you learn that PDO is deprecated in PHP7? First I've heard of it.

  • rf1234rf1234 Posts: 2,985Questions: 87Answers: 421
    edited November 2018

    Guys, I am pretty sure that PDO is not deprecated and I wouldn't call mysqli the best choice.

    https://www.linkedin.com/pulse/why-should-you-switch-pdo-from-mysql-mysqli-diwaker-mishra/

    Here is a quote:

    Summary
    There are only two possibilities to use extension because MySQL is deprecated as of PHP 5.5.0 and removed as of PHP 7.0.0.

    1. MySQLi
    2. PDO

    Ultimately, PDO wins this battle with ease. With support for twelve different database drivers (eighteen different databases!) and named parameters, we can ignore the small performance loss, and get used to its API. From a security standpoint, both of them are safe as long as the developer uses them the way they are supposed to be used (read: prepared statements).

    So if you're still working with MySQLi, maybe it's time for a change!
    Keep Smiling and Enjoy

    Thanks for reading

    Diwaker

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    I am pretty sure that PDO is not deprecated and I wouldn't call mysqli the best choice.

    My thoughts exactly. Thank you, @rf1234 .

  • jkane50jkane50 Posts: 3Questions: 1Answers: 0

    I am hosted at GoDaddy. I had the problem described here: https://stackoverflow.com/questions/32256416/pdo-not-working-in-godaddy-server
    so I did as suggested, and in the cPanel, PHP select version set to 7.0 and checked off PDO. Still had the problem with PDO functions not being recognized. Called GoDaddy support, they said to get it to work I had to go to PHP 5.4 so I assumed PDO was depreciated. Maybe only a godaddy issue? I don't know but either way, since I otherwise am happy with goDaddy, unless this product uses mysqli, I'd rather not use it.

    The linkedin reference has a table in it that says mysqli can't prepare statements. That is not accurate. I prepare statements every time in mysqli for injection protection:
    $sql2 = 'SELECT pointTotal FROM Volunteers where lName = ? and fName=?';
    if($stmt2 = mysqli_prepare($con, $sql2)){
    mysqli_stmt_bind_param($stmt2, 'ss', $lnamevalue, $fnamevalue);
    I don't care that PDO has many drivers as I only use mysql. So the only real difference in that list is named parameters which to me are no big deal. I'm very happy with the mysqli performance.

    So, my question remains, does datatables php driver use msqli or not?

  • rf1234rf1234 Posts: 2,985Questions: 87Answers: 421
    edited November 2018

    "The linkedin reference has a table in it that says mysqli can't prepare statements. That is not accurate."

    The table has a typo that is true. But let me quote from the linkedin reference which makes it clear that the author does understand that mysqli actually can prepare statements:
    "MySQLi The i stands for Improved. The MySQLi is an extension to work with MySQL version 4.1.13 or newer. MySQLi is introduced with PHP Version 5.0 and is a replacement for the mysql functions, with object-oriented and procedural versions. It has support for prepared statements."

    "From a security standpoint, both of them are safe as long as the developer uses them the way they are supposed to be used (read: prepared statements)."

    That sounds like a GoDaddy issue. Never heard of it before to be honest. It would make me look for a different hosting provider.

    Just searched for "mysqli" in the Editor PHP libraries and found nothing. Lots of PDO though. Of course you can use Data Tables without Editor and code the PHP data provision yourself using mysqli. Many people use Data Tables without Editor.

    I don't know whether data tables has other "data connectors" in addition to Editor which use mysqli. @allan can you give us an update on that please.

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    @jkane50, a look through Google suggests that you can enable PDO at GoDaddy yourself through cPanel.
    I agree with @rf1234 (again) - if my host was telling me PDO wasn't available I'd be thinking about changing hosts.

  • rf1234rf1234 Posts: 2,985Questions: 87Answers: 421
    edited November 2018

    Found the other "data connector" Data Tables provides for people who do not want to use Editor. It is the so called "ssp class". That is also based on PDO.
    https://github.com/DataTables/DataTablesSrc/blob/e21f86edcb006dcf793debda0abc59d8f88617fb/examples/server_side/scripts/ssp.class.php

    I have never used the ssp class because using Editor you don't need it.

  • jkane50jkane50 Posts: 3Questions: 1Answers: 0

    Well if I want to continue on my chosen mysqli path this product is NOT for me. The web programming I do is for a non-profit (day job is engineering support desktop programming, numerical methods oriented). I searched for a while for price/performance for hosting. Since I like both price and performance on GoDaddy, I'm not moving. Bandwidth is great. I have dhtmlx.com tables/editor working with the latest GitHub data layer which they upgraded to mysqli so I'll stick with that. Thanks for the opinions!

  • rf1234rf1234 Posts: 2,985Questions: 87Answers: 421

    There might be a misunderstanding here. Even if you decided to use Editor you would use your own database handler for your proprietary SQL anyway, and it is no problem if you want to use mysqli for this.

    Editor uses PDO with its database handler. Unless you want to use the Editor database handler in your own coding you have no involvement with PDO because Editor generates its own SQL and PDO statements. You don't see any of this in your code. (Data Tables is purely front end and written in Java Script. It neither uses mysqli nor PDO. Only Editor and the ssp class use PDO.)

    All you would need to do is enable PDO with GoDaddy so that Editor can use it.

This discussion has been closed.