Why is mysqli (for PHP) not highlighted or supported in UE?

Why is mysqli (for PHP) not highlighted or supported in UE?

3

    Jul 16, 2018#1

    Recently I copied some code from a website (don't we all ;)) and it was like this:
    mysqli_query($connection,$query);

    It was white in UE as not recognized. So I made this from it:
    mysql_query($query, $connection);
    As you can see the query and connection has to be switched.
    The query took 0.5 seconds (a bit long).
    So I switch back to the mysqli statement and what do you know, the query took 0.0001 seconds.

    I think its the preferred way to query, so when will it be in UE?

    6,686585
    Grand MasterGrand Master
    6,686585

      Jul 16, 2018#2

      mysqli_query will be syntax highlighted if you add this string as word to the wordfile used by you for syntax highlighting PHP code.
      1. Open the file with that function.
      2. Next open Advanced - Settings or Configuration - Editor display - Syntax highlighting and selected is the language respectively wordfile used for syntax highlighting the active file at current position of the caret in file.
      3. Click on button Open right to the language and close the configuration dialog with button Cancel.
      4. In the opened wordfile search for the line containing mysql_query and insert on this line the word mysqli_query which starts also with lower case m.
      5. Save the updated wordfile and the keyword mysqli_query is also syntax highlighted.
      By default is installed together with UltraEdit for Windows v25.10.0.50 the wordfile php.uew which is originally a wordfile contributed by a user familiar with PHP syntax. This wordfile is copied by UltraEdit to user's default wordfile directory %APPDATA%\IDMComp\UltraEdit\wordfiles on first start of UltraEdit after installation. As long as the directory %APPDATA%\IDMComp\UltraEdit\wordfiles exists, the *.uew files in this directory are not updated anymore by UltraEdit to give the user the possibility to make any customizations like
      By default installed php.uew contains mysql_query, but not mysqli_query which is supported by PHP according to PHP mysqli_query() Function since PHP 5.0 (5.3 for asynchronous query). There are different versions of PHP each with a specific set of built-in supported functions. Best is to use a (customized) wordfile which fits to the set of functions supported by the used version of PHP.

      I don't have any knowledge about PHP language and their version differences. But standard wordfile php.uew uses currently only 10 color groups. So it is possible to add many more words for the various versions of PHP in additional color groups as UltraEdit supports up to 20 color groups. For example /C11 could be used for words which require at least PHP 5.x, /C12 for PHP 7.0, /C13 for PHP 7.1, /C14 for PHP 7.2.

      The questions are:
      1. Is there an UltraEdit/UEStudio user who is an experienced PHP programmer and has the time and motivation to collect all the data (words) for a general PHP wordfile which takes all version differences into account?
      2. Is there an UltraEdit/UEStudio user who is an experienced PHP programmer and creates a PHP language based smart template file which could be very useful for many PHP programmers using UltraEdit or UEStudio?
      I could imagine that IDM Computer Solutions, Inc. honors a completely revised PHP syntax highlighting wordfile and/or PHP template file with a free license for UE/UES.

        Jul 20, 2018#3

        John, at Functions list is empty for UTF-8 encoded PHP files after update to UltraEdit v25.10.0.50 there is an updated php.uew available containing mysqli_query and improved regular expressions for function list. Download this small ZIP file and extract the file php.uew inside the ZIP archive to %APPDATA%\IDMComp\UltraEdit\wordfiles to update the syntax highlighting wordfile for PHP.

        It looks like function name mysqli_query was just overlooked as the PHP syntax highlighting wordfile contained already many mysqli_* functions, but not this one.
        Best regards from an UC/UE/UES for Windows user from Austria

        3

          May 07, 2019#4

          Hi Mofi,

          Thanks for your extended answer and sorry for my late reply on this.

          There is a strange thing. If I do the above and try to update the file php.uew it opens the file html.uew even if I select PHP as language.
          When I open the php.uew from the location where all .uew files are, it opens and mysqli_query is already there.
          The file I have open has the .php extension, the association is set to PHP and in the bar below on the UE screen. It also says PHP (couldn't change it if I wanted, because if I set it to HTML, it just changes it back to PHP, but still no highlighting on mysqli. I am confused.

          So I think something is wrong, can you help me?

          90 minutes later:

          I now see, that I forgot to click on button Apply when I selected PHP in the syntax highlight settings.
          Also there is a lot of mysqli_ in there, but not mysqli_query and several others.
          So I added this line to it:
          mysqli_query mysqli_real_escape_string mysqli_result mysqli_select_db mysqli_set_charset mysqli_stat

          Hope it did the trick, I will let you know.

          6,686585
          Grand MasterGrand Master
          6,686585

            May 09, 2019#5

            Hi John,

            I have just sent a bug reporting email to IDM support with following content:

            I am using at the moment UltraEdit for Windows v26.10.0.14 on which the issue described below exists as well as all public released 26.00 versions. The issue is not reproducible with v25.20.0.166 which seems to be the last version on which below described behavior works as expected.

            The steps to reproduce the issue are:
            1. Start UltraEdit and save a new file with a known extension like Temp.bat, Temp.c, Temp.htm or Temp.php.
            2. Open Advanced - Settings - Editor display - Configuration.
              The installed wordfile selected is the file used to syntax highlight the active file at current position of the caret. That's fine.
            3. Select any other installed wordfile like Perl and click on button Open.
            The file perl.uew should be opened as done by UltraEdit versions up to 25.20.0.166, but opened is the wordfile currently used for syntax highlighting the active file instead of the selected file.

            So it is not possible anymore to open any other wordfile than the wordfile used for syntax highlighting the active file from the syntax highlighting configuration dialog. It does not even work to open first a new file or select No highlighting for active file and then open the configuration dialog. In this case no installed wordfile is preselected, but selecting an installed wordfile and clicking on button Open has no effect in this case as no wordfile is opened at all.

            Thanks for the additional information about missing function names in color group 6 of php.uew with group name Built-in Functions. You are right regarding to mysqli_real_escape_string, mysqli_select_db, mysqli_set_charset and mysqli_stat. The function name mysqli_query was already in the wordfile php.uew provided by me as attachment in ZIP file of forum post Functions list is empty for UTF-8 encoded PHP files after update to UltraEdit v25.10.0.50 (solved), but is still missing in php.uew installed with currently latest UltraEdit for Windows v26.10.0.14. I added yesterday the missing four function names to php.uew provided by me and uploaded it.

            mysqli_result is not a function, it is a class which is listed in php.uew in color group 10 with group name Native classes. So nothing to do by me regarding to this class name.

            I recommend to download the ZIP file at bottom of referenced post and extract the wordfile php.uew to %APPDATA%\IDMComp\UltraEdit\wordfiles which is the default location for the wordfiles used by UltraEdit with overwriting the already existing php.uew modified by you. It is currently (2019-05-09) the best syntax highlighting wordfile available for PHP. I have sent this updated php.uew also to IDM support by email with the request to add it to installation package of next (major) release of UltraEdit and UEStudio with listing the reasons why this version of php.uew is better than php.uew installed with UE v26.10.0.14.
            Best regards from an UC/UE/UES for Windows user from Austria

            3

              May 22, 2019#6

              Hi Mofi,

              I downloaded the php.uew as recommended, everything seems fine now. Thanks for everything 👍
              The version I have now is "Version 26.10.0.30"

              6,686585
              Grand MasterGrand Master
              6,686585

                May 22, 2019#7

                That's fine.

                Note: The reported issue with selected wordfile (language) not opened on clicking on button Open in syntax highlighting configuration dialog is fixed with UltraEdit hotfix version 26.10.0.38 released 2019-05-22.

                  Sep 08, 2019#8

                  The updated wordfile php.uew as attached by me to Functions list is empty for UTF-8 encoded PHP files after update to UltraEdit v25.10.0.50 (solved) is installed by default with UltraEdit for Windows since v26.10.0.72 and UEStudio since v19.10.0.46 in subdirectory wordfiles in program files directory of UltraEdit/UEStudio. This updated php.uew must be just copied manually on using default paths after an update or upgrade of UltraEdit/UEStudio from
                  • %ProgramFiles%\IDM Computer Solutions\UltraEdit\wordfiles
                    or
                    %ProgramFiles(x86)%\IDM Computer Solutions\UltraEdit\wordfiles
                    or
                    %ProgramFiles%\IDM Computer Solutions\UEStudio\wordfiles
                    or
                    %ProgramFiles(x86)%\IDM Computer Solutions\UEStudio\wordfiles
                    to
                  • %APPDATA%\IDMComp\UltraEdit\wordfiles
                    or
                    %APPDATA%\IDMComp\UEStudio\wordfiles
                  Best regards from an UC/UE/UES for Windows user from Austria