Welcome,
Guest
.
Please
login
or
register
.
Did you miss your
activation email
?
News:
Bug reports and fixes
.
Home
Help
Login
Register
Elxis CMS Forum
»
Support
»
General
(Moderators:
Ivan Trebješanin
,
Farhad Sakhaei
) »
New article Id to 0 and can't delete
« previous
next »
Print
Pages: [
1
]
Author
Topic: New article Id to 0 and can't delete (Read 8357 times)
maple
Full Member
Posts: 192
New article Id to 0 and can't delete
«
on:
October 28, 2018, 13:42:25 »
Hi,
suddenly when I try to add a new article, Elxis add the ID 0. And when I try to delete this new article, can't do It, also can't publish this article and some other things. I need to go to phpmyadmin and delete manually. And then when I add a new article again, Elxis add ID 0 again. I have about 70 articles that works fine. Don't know why Elxis don't add the following number, example 71 instead of 0.
thanks
«
Last Edit: October 28, 2018, 18:26:39 by maple
»
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: New article Id to 0 and can't delete
«
Reply #1 on:
October 30, 2018, 21:10:24 »
In phpmyadmin have you modified the auto-incement value for column ID in table elx_content?
PHP My Admin > Click table elx_content > Click tab "Settings" > Set the proper value of "
AUTO_INCREMENT
" option.
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
maple
Full Member
Posts: 192
Re: New article Id to 0 and can't delete
«
Reply #2 on:
October 30, 2018, 22:32:56 »
Hi thank you,
I just attached an screenshot below. I never modified this.
Could be possible that I need to reinstall MariaDB ? Or some any other issue due a possible server attack?
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: New article Id to 0 and can't delete
«
Reply #3 on:
October 31, 2018, 18:28:10 »
Click tab "Operations" and see the value of the "
AUTO_INCREMENT
" option.
If you can't fix it by yourself send me with a personal message access details for your site to fix it for you (ftp + phpmyadmin + elxis administration).
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
maple
Full Member
Posts: 192
Re: New article Id to 0 and can't delete
«
Reply #4 on:
November 01, 2018, 13:24:40 »
Hi, I just send you a PM
thanks
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: New article Id to 0 and can't delete
«
Reply #5 on:
November 01, 2018, 21:42:57 »
Problem solved!
The problem was that, for some reason (I don't really know why), the value of auto_increment columns (IN ALL TABLES) did not get the proper value on
INSERT
statements but, instead,
zero
. Elxis uses
NULL
as value on auto increment columns which is automatic updated by mysql. This does not work for you. Maybe the value was not interpreted as NULL but as string or maybe something changed in latest PHP/PDO/MySQL versions although I didn't found something relevant. Maybe was our mistake defining NULL value for auto increment columns. What I did is to remove these columns from INSERT queries in PDO statements. Although I have not seen the problem in other sites I will apply this fix in Elxis official release and in the upcoming Elxis 5.x.
If you have the same problem here is how to fix it:
Open file:
includes/libraries/elxis/database/table.class.php
Change line
209
from this:
$data = $this->makeParams();
to this:
$data = $this->makeParams(true);
Change line
587
from this:
private function makeParams() {
to this:
private function makeParams($is_insert=false) {
Add below line
600
:
foreach ($this->columns as $name => $column) {
this:
if ($is_insert) {
if ($name == $this->primary_key) {
if ($column['type'] == 'integer') {
$v = (int)$column['value'];
if ($v < 1) { continue; }
}
}
}
One additional change to fix an old bug:
Change lines
622-624
from this:
switch ($column['type']) {
case 'interger':
case 'bit';
To this:
switch ($column['type']) {
case 'integer':
case 'bit':
Save the file and you are ready!
«
Last Edit: December 11, 2018, 12:26:05 by datahell
»
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
maple
Full Member
Posts: 192
Re: New article Id to 0 and can't delete
«
Reply #6 on:
November 02, 2018, 13:07:55 »
Hi datahell, thank you so much!
(I just send you a PM)
Logged
datahell
Elxis Team
Hero Member
Posts: 10356
Re: New article Id to 0 and can't delete
«
Reply #7 on:
November 02, 2018, 19:19:30 »
My original reply
updated
. Tested and works fine!
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
maple
Full Member
Posts: 192
Re: New article Id to 0 and can't delete
«
Reply #8 on:
November 02, 2018, 19:45:41 »
Great! Thank you so much!!
Logged
Print
Pages: [
1
]
« previous
next »
Elxis CMS Forum
»
Support
»
General
(Moderators:
Ivan Trebješanin
,
Farhad Sakhaei
) »
New article Id to 0 and can't delete