Error: Deleting Sale Not Working, shows “Something Went Wrong Please Try again Later”
Issue:
Sometimes, when attempting to delete a sale, the system may display the following error: “Something went wrong. Please try again later.”
This usually occurs due to a database configuration issue.
Solution:
Follow the steps below to diagnose and fix the issue:
Step 1: Check the Error Log
Navigate to your application’s log file located at: pos/storage/logs/laravel.log
Step 2: Identify the Error
If the log shows the following error: General error: Prepared statement needs to be re-prepared
Step 3: Update Database Configuration
Open the database configuration file located at:
pos/config/database.php
Find the MySQL configuration block and ensure it includes the following option:
‘mysql’ => [
‘driver’ => ‘mysql’,
‘url’ => env(‘DATABASE_URL’),
‘host’ => env(‘DB_HOST’, ‘127.0.0.1’),
‘port’ => env(‘DB_PORT’, ‘3306’),
‘database’ => env(‘DB_DATABASE’, ‘forge’),
‘username’ => env(‘DB_USERNAME’, ‘forge’),
‘password’ => env(‘DB_PASSWORD’, ”),
‘unix_socket’ => env(‘DB_SOCKET’, ”),
‘charset’ => ‘utf8mb4’,
‘collation’ => ‘utf8mb4_unicode_ci’,
‘prefix’ => ”,
‘prefix_indexes’ => true,
‘strict’ => false,
‘engine’ => null,
‘options’ => extension_loaded(‘pdo_mysql’) ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env(‘MYSQL_ATTR_SSL_CA’),
\PDO::ATTR_EMULATE_PREPARES => true, // Add this line
]) : [],
],
Important: Make sure the line \PDO::ATTR_EMULATE_PREPARES => true
is included under the options
array. This setting helps prevent the “re-prepared” error by enabling emulation of prepared statements.
Step 4: Save Changes
After updating the configuration save the file.
📩 Still stuck? Contact Support