[php-src] Issue #8249: PHP Fatal error: Uncaught mysqli_sql_exception: Duplicate column name

From: Date: Fri, 25 Mar 2022 13:11:15 +0000
Subject: [php-src] Issue #8249: PHP Fatal error: Uncaught mysqli_sql_exception: Duplicate column name
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-240492@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8249 Author: Gilmar-Conectar ### Description The following code: ```php $cComando = 'ALTER TABLE T_ORGA ADD ORGA_VLR DECIMAL(18,8) NULL'; mysqli_query($link,$cComando) if(mysqli_error($link)){ echo '<br>Column exists'; } <?php ``` Resulted in this output: ``` PHP Fatal error: Uncaught mysqli_sql_exception: Duplicate column name Stop execution do aplication. ``` But I expected this output instead: ``` Ignore the error and continue running aplication. ``` When I run the Alter Table in MYSQL, it returns Duplicate column name, but this shouldn't interrupt the process execution, just allow it to be treated normally as a standard error and continue executing the other commands. This option to ignore the change if the column already exists is a database decision, not PHP's, so I believe there should be some command to ignore PHP Fatal error for these cases. IMPORTANT : I have several databases and eventually some have some column missing, so I run the process on all databases. ### PHP Version PHP 8.1.4 ### Operating System Windows 10

« previous php.bugs (#240492) next »