Jump to content

Kaz3367

New Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Kaz3367

  1. On 11/13/2019 at 6:16 PM, mac_gyver said:

    if you use exceptions for database statement errors and in most cases let php catch and handle the exception, php will use its error related settings to control what happens with the actual error information (database errors will 'automatically' get displayed/logged the same as php errors.)  you will be able eliminate the existing error handling, rather than to convert it. to enable exceptions for errors for the mysqli extension, add the following line of code before the point where you make the database connection -

    
    mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);

    now the bad news, it is not enough to just update statements in old code, as one of the things that was removed in php5.4, magic_quotes, eliminated some protection that php provided against sql special characters in external string data from breaking the sql query syntax (which is how sql injection is accomplished.) if your code does not have specific protection for all external/unknown data, and for all the different data types, being put into sql queries, you will need to add it. the simplest, universal way of doing this is to use prepared queries, provided that you switch to use the simpler PDO extension. the prepared query interface for the mysqli extension is overly complicated and inconsistent 

    Thanks a lot for your indepth answer.

    I will try to get more into this matter then.

     

    Also another question, we used an excel export code, now that I converted most of the code I came along this following part of code which does no longer exist in PHP 7.

    I searched for alternatives and I am not sure how to implement them in this specific example, I hope im not asking too much but Im kinda lost..

    image.png.036f2dbfe9dc26f0c026deb3d4846193.png

    mysql_field_name 

     

    Tia

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.