0 votes

Problem modifying data in php and mysql

Perform the following code to update, it prints "updated data" but when checking the database it is not modified, it helps

0voto

Ken Thompson Points 11

I think you have a problem in your query.

 $_UPDATE_SQL = "UPDATE compras set
Id = '$Id' ;
codigo_producto = '$codigo_producto' ;
cantidad = '$cantidad' ;
precio_unitario = '$precio_unitario' ;
valor_total = '$cantidad'  * '$precio_unitario';

where Id = '$Id' ;

; indicates that the query string ends here, try as follows

 $_UPDATE_SQL = "UPDATE compras SET
Id = '$Id',
codigo_producto = '$codigo_producto',
cantidad = '$cantidad',
precio_unitario = '$precio_unitario',
valor_total = '$cantidad*$precio_unitario'
WHERE Id = '$Id'; 

HolaDevs.com

HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by:

X