The right func breake it, other func also but at least it works

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
arcanebits
Veteran Member
Posts: 104
Joined: 2018-12-10 21:52

The right func breake it, other func also but at least it works

Post by arcanebits » 2024-02-22 13:15

CONTEXT:
Will add manualy a record after the login_ok, After the partial success and total failure I GET ERROR500, the insert works nice in phpadmin and also using the wrong func it ADDS a record but the right func does noting at all. Code Bellow:

function login_ok($memberInfo, &$args) {

///This sends an email it works nicely
$timeTasks=sqlValue("SELECT SUM(minuesti) FROM tareas WHERE tareas.cip='1' AND tareas.estado='Activo' AND DATE(tareas.fechaini) = CURDATE()");
mail(
'aalain@???.com',
'Entrada al sistema exitosa, dentro veras los segundos pendientes' ,
'Tienes un total de: ' . $timeTasks . ' segundos pendientes.' ,
"From: tachasserver@???\r\n"
);
///This works adding the record (I know this is not the right func but at least it adds the record, then breaks
$anade=sqlValue("INSERT INTO tareas (detalle, fechaini, fechafinal, cip, estado, minuesti, tipo) VALUES ('macarron', '$fecha_actual', '$fecha_actual', 1, 'Activo', 88, 'Recu')");

///This is supposed to be the right func, it just breaks the system
sql("INSERT INTO tareas (detalle, fechaini, fechafinal, cip, estado, minuesti, tipo) VALUES ('macarron', '$fecha_actual', '$fecha_actual', 1, 'Activo', 99, 'Recu')");

return '';
}

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: The right func breake it, other func also but at least it works

Post by pbottcher » 2024-02-22 21:18

Hi try

Code: Select all

$eo=Array();
$anade=sqlValue("INSERT INTO tareas (detalle, fechaini, fechafinal, cip, estado, minuesti, tipo) VALUES ('macarron', '$fecha_actual', '$fecha_actual', 1, 'Activo', 88, 'Recu'),$eo");
Actually the Same applies for the sql function call
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

arcanebits
Veteran Member
Posts: 104
Joined: 2018-12-10 21:52

Re: The right func breake it, other func also but at least it works

Post by arcanebits » 2024-02-26 17:36

Hi, thanks for the help this is the status (failed) here is what I did

01 Sanitized the sql statement so it adds nulls just for minimize any dumb error

02 Tested running and works but BREAKS it
$anade=sqlValue("INSERT INTO tareas (cip, nomb1, ape1, detalle, fechaini, comentario, fechafinal, estado, minuesti, tipo) VALUES (1, NULL, NULL, 'gettinghelp','$fecha_actual', NULL, '$fecha_actual', 'Activo', 77, 'Recu')");

03 Added the sugested adjustments and it doesnt breake it, but it doesnt add anything to the DB either:
$eo=Array();
$anade=sqlValue("INSERT INTO tareas (cip, nomb1, ape1, detalle, fechaini, comentario, fechafinal, estado, minuesti, tipo) VALUES (1, NULL, NULL, 'gettinghelp','$fecha_actual', NULL, '$fecha_actual', 'Activo', 77, 'Recu'),$eo");

I think Im doing something wrong
Any comment?
a3

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1817
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: The right func breake it, other func also but at least it works

Post by jsetzer » 2024-02-26 18:35

Just a hint:
I've seen that data-mofifying SQL commands like INSERT, UPDATE, DELETE may not work with sqlValue-function.

For those try sql("YOUR SQL COMMAND", $eo) instead of sqlValue("...", $eo).

That's just what I've noticed when migrating projects to PHP 8.x.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

arcanebits
Veteran Member
Posts: 104
Joined: 2018-12-10 21:52

Re: The right func breake it, other func also but at least it works

Post by arcanebits » 2024-02-28 15:34

Thanks! Im gonna try that ASAP
aw

Post Reply