pragmaMx Support Forum

pragmaMx => integrierte Module => Thema gestartet von: le Chaland am 05 November 2023, 22:39:21

Titel: Database error
Beitrag von: le Chaland am 05 November 2023, 22:39:21
Hello  :BD: .

When i want to save a link (a file) in the download section in admin, i have this message :

Database Error (modAddNewData)

Field 'lid' doesn't have a default value

I deleted all the tables with the downloads prefix in the database and launched an update. Script wrote missing tables and detected no more error ...

I created succesfully a category.

Any idea ? Another table is corrupted ?

Here a screenshoot of the database. Hoping this is the good table ...

(https://i.ibb.co/9GG61yM/Screenshot-20231105-224522-Opera.png) (https://ibb.co/x33WBz4)

Thank you  :mad2:

Titel: Antw:Database error
Beitrag von: Olaf am 06 November 2023, 09:15:22
again the question: which pragma version
Please always specify: PragmaVersion, PHP.Version, MySQL version

The error can still occur in a version older than V2.8.
please update
Titel: Database error
Beitrag von: le Chaland am 06 November 2023, 18:10:21
Sorry, you are right. My mind was too much in the problem and i forgot the essential.


All in one place :

(https://i.ibb.co/wdcqb16/Screenshot-20231106-180257-Opera.png) (https://ibb.co/S6fg1pv)


Titel: Database error
Beitrag von: le Chaland am 06 November 2023, 23:05:28
Okay, here what i tried :

With myoos Dumper i edited the lid key in the downloads table :

Defined as primary and added auto-increment propertie.

Result :

I can add and save in the database the files succesfully, they appears in the apropriate category in the download section and seems succesfully indexed.
For the first one :  modules.php?name=Downloads&op=view&lid=1
Tried with 3 files.

New Problem :

When i try to edit one of the 3 files, first i have a message that changes are succesfully saved but quickly after an error :
download id 0 not found...This link in the toolbar of the web browser wich is displayed :
admin.php?op=Downloads/ModData&lid=2 [file #2, correct]
When i click on "back" link i have another error that the webpage is not reachable. The link who make the error :
admin.php?op=Downloads/ModDataSave
If i use the back button of the web browser, no problem.

More strange, changes are saved succesfully ...

If you need screenshots of the downloads table or a sql backup of this inclued the key i modified, just let me know.

After i edited commented these lines in the admin.php file of the module :
    /*
    if (empty($row['lid'])) {
        mxErrorScreen('download id ' . intval($lid) . ' not found...');
    }
    */

Now i can modify and save any download without error, but :

When the script automatically goes back to the file which is edited, all fields are empty.

Hoping this can help.
Titel: Antw:Database error
Beitrag von: le Chaland am 06 November 2023, 23:45:35
The next ,,,

The link in the toolbar of the web browser that give empty fields:
admin.php?op=Downloads/ModData&lid=3
where this one, working, should be better :
admin.php?op=Downloads/ModData&lid=3

I don't know if modifications that i made are global good ideas but this seems working at the minimum, i think.

For sure you can do a better job.

Let me know if you need more things to resolve totally the problem(s).

Sincerly.
Titel: Antw:Database error
Beitrag von: Nouvelle am 07 November 2023, 21:34:54
Also, ich habe bei mir den Fehler entdeckt, das in der Datenbank der Primärschlüssel nicht vergeben wurde.

Also leere deine _download_download Datenbank
// PREFIX anpassen
TRUNCATE TABLE `PREFIX_downloads_downloads`

Und setzte den Primärschlüssel
// PREFIX anpassen
ALTER TABLE `PREFIX_downloads_downloads` CHANGE `lid` `lid` INT(11) NOT NULL AUTO_INCREMENT, add PRIMARY KEY (`lid`);

Die Fehlermeldung (ist richtig) kannst du dann wieder auskommentieren
    if (empty($row['lid'])) {
        mxErrorScreen('download id ' . intval($lid) . ' not found...');
    }
Titel: Antw:Database error
Beitrag von: Nouvelle am 07 November 2023, 22:20:20
admin.php?op=Downloads/ModData&lid=3


kann ich nicht nachvollziehen, wie bist du dorthin gekommen ?
Titel: Antw:Database error
Beitrag von: le Chaland am 07 November 2023, 22:48:18
admin.php?op=Downloads/ModData&lid=3

I did not know how this happend, this happend every time and i make nothing of special to obtain this.

Do you have an idea to correct the string, where is called this link in the cms ?

I had not been careful, my last experience with Pragmamx is with version 1.X and I thought it was a new design of the CMS, but I have such a behavior in other parts of the administration. This requires more tests on my part to be complete, and the opening of a new dedicated topic. One thing at a time ...
Titel: Antw:Database error
Beitrag von: le Chaland am 07 November 2023, 22:51:49
Zitat von: Nouvelle am 07 November 2023, 21:34:54Also, ich habe bei mir den Fehler entdeckt, das in der Datenbank der Primärschlüssel nicht vergeben wurde.

Also leere deine _download_download Datenbank
// PREFIX anpassen
TRUNCATE TABLE `PREFIX_downloads_downloads`

Und setzte den Primärschlüssel
// PREFIX anpassen
ALTER TABLE `PREFIX_downloads_downloads` CHANGE `lid` `lid` INT(11) NOT NULL AUTO_INCREMENT, add PRIMARY KEY (`lid`);

Die Fehlermeldung (ist richtig) kannst du dann wieder auskommentieren
    if (empty($row['lid'])) {
        mxErrorScreen('download id ' . intval($lid) . ' not found...');
    }

I will try later, not the time now, and come back to give you the results ...
Titel: Antw:Database error
Beitrag von: le Chaland am 08 November 2023, 21:47:36
Hello 🙂.

Following your instructions i did the job on the database and this done :

(https://forum.pragmamx.org/proxy.php?request=http%3A%2F%2Fwww.image-heberg.fr%2Ffiles%2F16994739031302713867.jpg&hash=bc04732cb2fc24be899194115af72e20217c0e31)

After i restored this part of the code in admin.php file of the module :

if (empty($row['lid'])) {
        mxErrorScreen('download id ' . intval($lid) . ' not found...');
    }

For now, i can succesfully add a download.

But when i want to modify an existing download, i get this error :

(https://forum.pragmamx.org/proxy.php?request=http%3A%2F%2Fwww.image-heberg.fr%2Ffiles%2F1699473925454137940.png&hash=144fa1fb98c1006dd03cff6cc7100a61a69534dc)

When i click on the 'return' link it dones this :

(https://forum.pragmamx.org/proxy.php?request=http%3A%2F%2Fwww.image-heberg.fr%2Ffiles%2F16994739892101076745.png&hash=ef9167746c95fd56d53664edad2c446851d725ea)

So i disabled a new time the part of the code and when i want to modify a download, when saving, firstly i have the confirmation and immediatly after the pages goes here :

(https://forum.pragmamx.org/proxy.php?request=http%3A%2F%2Fwww.image-heberg.fr%2Ffiles%2F16994748171271046575.jpg&hash=e03d97f85a51848bebbb605f1d9c50c57ff1986a)

It seem's that, after the database bug, the problem come now from the string amp; that is inserted in the url.

If we find the source of this behaviour, maybe it will work correctly ...

Do you have an idea of the file where i could check ?

Thanks in advance.
Titel: Antw:Database error
Beitrag von: Nouvelle am 09 November 2023, 00:46:17
* The problem is not the Themes
* is the "&"

ZitatBut when i want to modify an existing download, i get this error
* Where you klick ?
* What you use ? Mobile ? Handy ? PC ? Emulator ?
* Which browser ?
* Maybe show us your setting of the Modul



Titel: Antw:Database error
Beitrag von: le Chaland am 09 November 2023, 19:11:37
I click on the button "Modifier". The boutton that is affected to this action.

I am working on a tablet samsung galaxy tab S7, android 10.

Same problem on browsers : Opéra, chrome, firefox, edge. Desktop view or mode activated.

Here is the config of the module :

(https://forum.pragmamx.org/proxy.php?request=http%3A%2F%2Fwww.image-heberg.fr%2Ffiles%2F16995533124092726208.jpg&hash=dd5f82ea243f2529161b6c3f5d046ec2eeed6187)
Titel: Antw:Database error
Beitrag von: Nouvelle am 09 November 2023, 23:17:02
Das ist jetzt nur für dich :-)

Suche in der 'modules/Downloads/admin/admin.php'
<td>' . mx_strftime(_SHORTDATESTRING, mxSqlDate2UnixTime($date)) . '</td>
<td class="nowrap align-center">
' . modCheckPopupLink($url, $img_check) . '
<a href="' . adminUrl(PMX_MODULE, 'ModData', 'lid=' . $lid) . '">' . $img_edit . '</a>

Hier ändern wir nur den Link
<a href="admin.php?op=' . PMX_MODULE . '/ModData&lid=' . $lid . '">' . $img_edit . '</a>
Titel: Antw:Database error
Beitrag von: le Chaland am 10 November 2023, 04:07:01
I just replaced the url as you advise, but nothing change and i must again disable the part of the code to avoid the error when changing a download ...

Now take a look here please, the problem maybe more global :

Here the list of the downloads :

(https://forum.pragmamx.org/proxy.php?request=http%3A%2F%2Fwww.image-heberg.fr%2Ffiles%2F16995851343835561980.jpg&hash=ac27231280c44291a841c637132a7d8cb6954ac0)

And now check the url when i modiffy the category :

(https://forum.pragmamx.org/proxy.php?request=http%3A%2F%2Fwww.image-heberg.fr%2Ffiles%2F1699585252142241222.jpg&hash=f3c16e4a32d7e4088323535cd81e9b2c3b813336)

This is the same behavior :

- Changes are made and recorded succesfully.
- Immediatly there is the confirmation message.
- And this is just after, when the page reload and the script goes to next step that the url is corrupted.
Titel: Antw:Database error
Beitrag von: le Chaland am 10 November 2023, 04:30:50
I made another test.

Take a look when i modify an user, my account. Somes parts are erased for security.

(https://forum.pragmamx.org/proxy.php?request=http%3A%2F%2Fwww.image-heberg.fr%2Ffiles%2F1699586594246525741.jpg&hash=fa6be7d6e855019b5b27b6dae850f631565a68ce)

And the result when i want to save or update account datas :

(https://forum.pragmamx.org/proxy.php?request=http%3A%2F%2Fwww.image-heberg.fr%2Ffiles%2F1699586651554795100.jpg&hash=ae1bdc5a5aecfd72495797578702b874d195191e)

I wonder if the problem is really in the downloads module ?

Same things, changed are succesfully saved and after come the errors ...
Titel: Antw:Database error
Beitrag von: le Chaland am 10 November 2023, 06:52:20
Moving to php 7.4 or 8.1 does not resolve the issues.
Titel: Antw:Database error
Beitrag von: Nouvelle am 10 November 2023, 13:32:19
Dein Problem ist in der "includes/mx_api.php" "function adminUrl()"

Habe hier gerade getestet - Da ist kein Fehler

Nachdem das ja bei dir global auftaucht .... hmm mir fällt dazu nix ein
Titel: Antw:Database error
Beitrag von: le Chaland am 10 November 2023, 19:45:10
Server side issue ?
Titel: Antw:Database error
Beitrag von: le Chaland am 11 November 2023, 10:00:04
New complete fresh install on another server :

Re-downloaded original setup files.
Installing without any extra addon,plugin, or module ...

(https://forum.pragmamx.org/proxy.php?request=http%3A%2F%2Fwww.image-heberg.fr%2Ffiles%2F16996928834014052393.jpg&hash=5d60e1279a8da7f66df53b1dad4703a88a1be684)

Same thing 🙄 ...

(https://forum.pragmamx.org/proxy.php?request=http%3A%2F%2Fwww.image-heberg.fr%2Ffiles%2F16996928952359766297.jpg&hash=82c6771adb6f55bd9dc87dcbe7cbc4abf11247e3)

And too, tried to change language. No effects ...
Titel: Antw:Database error
Beitrag von: le Chaland am 11 November 2023, 11:27:39
I try to clean the url in the function :

$qry = str_ireplace('amp;', '', $qry);
return 'admin.php' . $qry . $anchor;

But this is the same :

https://coslcb.club/admin.php?op=users/modify&amp;chng_uid=2

Or :

$qry = str_ireplace($arg_separator, '', $qry);

Done :

https://coslcb.club/admin.php?op=users/modifychng_uid=2

Where is the next step after the function is executed that i can check if i can make a workaround ?
Titel: Antw:Database error
Beitrag von: Nouvelle am 11 November 2023, 14:51:07
du musst das "&" mitnehmen also "&amp;" ergibt das Zeichen => "&"

es gibt viele HTML Sonderzeichen zb auch Copyright-Zeichen also "&copy;" => ©

https://wiki.selfhtml.org/wiki/Zeichenreferenz
Titel: Antw:Database error
Beitrag von: Nouvelle am 11 November 2023, 15:02:08
vielleicht setzt du deine HTML Version auf HTML5

Admin > Einstellungen > HTML-Darstellungsmodus (DOCTYPE) > "HTML 5.0" > Speichern
Titel: Antw:Database error
Beitrag von: le Chaland am 11 November 2023, 16:30:53
Yes, i was on doctype html 5.0

Testing differents doctypes 4.x, no changes.

Now i am on doctype xhtml 1.1, but no changes ...

I'm going to have to dust off my old pc, turn it on and test on it..
Titel: Antw:Database error
Beitrag von: le Chaland am 11 November 2023, 17:30:41
On my desktop computer, using edge, same problem ...
Titel: Antw:Database error
Beitrag von: Nouvelle am 11 November 2023, 18:24:02
versuch mal das hier
https://www.mediaevent.de/sonderzeichen-und-utf-8-haste-mal-nen-euro/

ZitatZeichenkodierung in htaccess
Die meisten Provider unterstützen den Einsatz einer .htaccess-Datei im obersten Verzeichnis. Statt jede einzelne Seite mit dem Meta-Tag auszustatten, kann die Zeichenkodierung auch mit einer Zeile in der .htaccess-Datei festgelegt werden.

AddDefaultCharset UTF-8

Das hilft auch, wenn der Server aus unerfindlichen Gründen mit Latin-1 oder windows-1252 konfiguriert ist.
Titel: Antw:Database error
Beitrag von: le Chaland am 13 November 2023, 07:15:50
Added, with no effect.

I have an smf forum on the same server, on a sub-domain, without problem. 🙄
Titel: Antw:Database error
Beitrag von: le Chaland am 18 November 2023, 14:46:14
YEEEESSSSS

Found a global fix, in .htaccess :


# Remplace la chaine &amp; par
# Le caractère & dans les urls
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{QUERY_STRING} (.*)(&amp;|&amp%3B)(.*)
  RewriteRule ^.*$ %{REQUEST_URI}?%1&%3 [L,R=301]
</IfModule>

# Correction automatique des erreurs de saisies basiques dans l'url
<IfModule mod_speling.c>
  CheckSpelling On
</IfModule>

# Slash Bug fix
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^/(.*) $1 [R,L,N]
</IfModule>

## Definition de la norme d'affichage:
## Exemple pour l'encodage LATIN-1:
# AddDefaultCharset ISO-8859-1
# AddDefaultCharset LATIN-1
## Codage internationnal UTF-8:
AddDefaultCharset UTF-8


Several instructions for more chances, but in fact only the first one is effective ...
Titel: Antw:Database error
Beitrag von: Nouvelle am 19 November 2023, 19:19:01
Super, das du eine Lösung gefunden hast  :hi: