New Version: AppGini Helper Javascript Library 2021/07

We finally have released a new version of AppGini Helper Javascript Library. Order now but don't miss our 15% discount due to bizzworxx' 5th anniversary.

SOLVED: “Remove image”-bug in AppGini > 5.9x – hooks-only solution

For some time there have been problems with deleting uploaded images. The bug seems to be still present in AppGini version 5.97. In this article I show a small help function to fix this problem.

In the AppGini Forum a solution is shown which requires the modification of the files TABLENAME_dml.php. However, changes in these files are overwritten the next time they are generated. Here I show a solution that uses only hooks, which remain in place the next time they are generated.


In the past, uploaded images could be deleted by clicking the Remove image checkbox and then saving the record. Due to a bug in AppGini generated code this still does not work in latest version 5.97, as you can see here:

The image remains. This affects both, the database table and the file system.


Step 1

Copy & Paste the following function in a central place, for example in hooks/__global.php:

// file: hooks/__global.php
function remove_image_hack($tn, $field, &$data)
  $pk = $data["selectedID"] ?? $data[getPKFieldName($tn)] ?? null;
  $key = "{$field}_remove";
  if (isset($_REQUEST[$key]) && $_REQUEST[$key] == "1" && $pk) {
    $fn = existing_value($tn, $field, $pk);
    if ($fn) {
      $dir = getUploadDir('');
      $ft = pathinfo($fn, PATHINFO_FILENAME);
      $fe = pathinfo($fn, PATHINFO_EXTENSION);
      foreach (["", "_tv", "_dv"] as $key => $suffix) @unlink("{$dir}{$ft}{$suffix}.{$fe}");
      $data[$field] = null;
  return TRUE;

Note: If you are using an outdated PHP version prior to PHP 7, there may be problems in line 4, starting with $pk = ... . In these cases, you can use the following legacy replacement:

$pk = $data["selectedID"] ? $data["selectedID"] : ($data[getPKFieldName($tn)] ? $data[getPKFieldName($tn)] : null);

Step 2

For each table containing images, open the PHP hook file, find the TABLENAME_before_update(...) function and add the following line of code per image-field:

function TABLENAME_before_update(&$data, $memberInfo, &$args) {
    return remove_image_hack("TABLENAME", "FIELDNAME", $data);


In my case, tablename is employees and fieldname is image. So, my code looks like this:

function employees_before_update(&$data, $memberInfo, &$args)
    return remove_image_hack("employees", "image", $data);

That's it. Repeat this line for every problematic image field, if you have more than one in that table.


Here is the result, it works as expected, now:


I'm pretty sure the bug will be fixed with one of the next versions. Anyway, if you, like me and my customers, need a soIution immediately, this function should help you.

Solved: AppGini Database Backup Error on Windows

Have you also noticed that the database backup feature built into AppGini web applications does not work on Windows? The solution is quite simple, as I found out today. Read this post to see how we can solve this problem.

Database Backup

Maybe you have already seen the database backup function in the admin area of your AppGini application:

Click the Create Backup File button, confirm the prompt and check if it works for you:


I don't get any backup but I get the following error message:

(mysqldump --no-tablespaces -u"root" -p**** -h"localhost" "..." -r "C:/xampp/htdocs/...../admin"/backups/....sql) 2>&1
Der Befehl "mysqldump" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

This is not only the case on your Windows development computer, but also when your application is installed on a Windows server at the customer's site. Database backup is even more important in customer's productive environment.


The Apache webserver tries to execute a program called mysqldump on the server, but this program is not found.


The solution to this is actually quite simple. The easiest way is: we have to tell our Webserver (Apache) where to look for this program. For this we can use the environment variable Path of the Windows system environment.


  1. Add the following directory name to your Windows Systemenvironment PATH variable (XAMPP):
  2. Restart your webserver

Step by step

Locate the local mysql/bin directory (on your machine or on the server) and copy the full directory name to the clipboard.

Note: The screenshot above shows the installation directory of my XAMPP environment. This directory will be different when using a different webserver like WAMP.

Open System environment editor

Click button for Environment Variables

At the bottom part, find Path variable and edit the row

Create new entry...

...paste directory name and close all open dialogs using OK button.

Although you have added the mysql/bin directory, your Apache process does not know about this, yet. By default it "reads" environment variables on process start. So we have to restart our webserver. This will force Apache to read the (modified) environment variables including Path variable.

Please note that your web-applications running on that webserver will not be available for a few seconds. If this is critical for your users, you should postpone restart to maintenance times.

Restart Apache webserver
by using services management console

Restart your (Apache) webserver in service management console (services.msc).

by using XAMPP Control Panel

You can also use XAMPP-Control Panel for this, if you are more familiar with that.

Then you have to stop Apache first, confirm Admin-prompt, then start Apache and confirm Admin prompt again.

Test backup function

Test backup function again:

That's it. Apache was able to find mysqldump program and created a backup file of our database. Restore works as well, now.


Finding the reason and solution was much easier than expected. I hope this blog post will help you in the future!