Telugu and Kanada language pdf generation using fpdf

I want to generate report in multiple languages. However, I derive the words to be displayed in the report from mySQL on fpdf. For other regional languages tamil, hindi, and malayalam i convert the words to unicode and print on my pdf using fpdf. Similarly I want for Telugu and Kannada. Also I tried using tpdf with the below code

require('tfpdf.php');
$pdf = new tFPDF();
$pdf->AddPage();
// Add a Unicode font (uses UTF-8)
$pdf->AddFont('Mandali','','Mandali.ttf',true);
$pdf->SetFont('Mandali','',14);
$telugu2="నమూనా సంఖ్య";
$pdf->Write(25,$telugu2);

But the result is coming like the below one

నమూనా
సంఖ

I want the output to be నమూనా సంఖ్య

How to add multiple sender email addresses in WordPress and WooCommerce?

I am trying to add multiple email addresses or change the email address where customer responses to order notifications are sent.

I have the WooCommerce configuration as follows:

WooCommerce => Settings => Emails => Email Sender Options => Sender Address:

Initially, in this configuration I had the following email: [email protected]

I have tried to add two different email addresses, separating them by a comma ("," ), as follows:

[email protected], [email protected],

But this doesn’t work.

When the user responds to the email that arrived to notify him that his order was received, his message is not sent and he receives the following notice:

Address not found
Your message has not been delivered to [email protected]
because the domain mybusiness.commyemailgmail.com was not found. Check that there are no typos or spaces required and try again.

This is displayed as you see it, the email addresses together.

I have asked professionals and they have suggested some function with php.
I have used some example but it doesn’t work either.

function custom_change_reply_to_address( $headers, $email_id, $order ) {
    // Verificar si el correo electrónico es para notificar al cliente sobre el pedido completado
    if ( $email_id === 'customer_completed_order' ) {
        // Cambiar las direcciones de correo a las que quieres que lleguen las respuestas del cliente
        $new_reply_to_emails = array(
            '[email protected]',
            '[email protected]',
            '[email protected]',
        );

        // Convertir el array de direcciones en una lista separada por comas
        $new_reply_to_email = implode( ',', $new_reply_to_emails );

        // Remover el "Reply-To" actual, si es que existe
        $headers = preg_replace( '/^Reply-To:/m', '', $headers );

        // Agregar la nueva lista de direcciones de correo al encabezado
        $headers .= "Reply-To: $new_reply_to_emailrn";
    }

    return $headers;
}
add_filter( 'woocommerce_email_headers', 'custom_change_reply_to_address', 10, 3 );

How can I add two email addresses to this WooCommerce setup?
WooCommerce => Settings => Emails => Email Sender Options => Sender Address

Laravel package development – Configure priority of middleware component in package

I’m currently developing an internal Laravel package which is used in more than five applications. I register two middleware component in a service provider in the package:

public function boot()
{
    /** @var Router $router */
    $router = $this->app['router'];
    $router->pushMiddlewareToGroup('web', ComponentOne::class);
    $router->pushMiddlewareToGroup('web', ComponentTwo::class);
    $router->pushMiddlewareToGroup('api', ComponentOne::class);
    $router->pushMiddlewareToGroup('api', ComponentTwo::class);
}

Is there a possibility to configure priority within the package itself? Component one must be executed before component two. The only thing that I found up till now is configure the Kernel class for each application that uses this package:

protected $middlewarePriority = [
     ComponentOne::class,
     ComponentTwo::class,
];

Laravel compare models and cast attributes

i’m working inside a Laravel 10 application and am building a notification feature designed to notify users when significant columns on various models change. I’ve got a global model observer set up which contains these methods, when a model is updated I want to compare the original against the current.

My issue is that getAttributes() isn’t casting my columns on my model, for example, my Buyer model does indeed define a correct casts property (we can see this from getOriginal() working)

How can I ensure the values are casted / compared correctly:

<?php

namespace AppObservers;

use IlluminateSupportFacadesLog;
use AppJobsProcessModelObserver;
use CarbonCarbon;
use Exception;

class GlobalModelObserver
{
    /**
     * Handle the User "created" event.
     */
    public function created($model): void
    {
        try {
            ProcessModelObserver::dispatch($model, $model->id, 'created', Carbon::now());
        } catch (Exception $e) {
            // ...
        }
    }

    /**
     * Handle the User "updated" event.
     */
    public function updated($model): void
    {
        try {
            $originalAttributes = $model->getOriginal();
            $currentAttributes = $model->getAttributes();

            $columnsToExclude = [
                'id',
                'description',
                'is_favourited',
                'last_used_at',
                'updated_at',
                'created_at',
                'type',
                'last_built_at',
                'last_successful_build_at',
                'last_failed_build_at',
                'slug'
            ];

            $originalAttrs = collect($model->getOriginal())->reject(function ($value, $key) use ($columnsToExclude) {
                return in_array($key, $columnsToExclude);
            })->sort()->all();

            $currentAttrs = collect($model->getAttributes())->reject(function ($value, $key) use ($columnsToExclude) {
                return in_array($key, $columnsToExclude);
            })->sort()->all();

            $numDifferences = count(collect($originalAttrs)->diffAssoc(collect($currentAttrs))->toArray());

            // only dispatch if there are differences
            if ($numDifferences > 0) {
                ProcessModelObserver::dispatch($model, $model->id, 'updated', Carbon::now(), [
                    'model' => [
                        'original' => collect($originalAttrs)->toArray(),
                        'current' => collect($currentAttrs)->toArray()
                    ]
                ]);
            }

        } catch (Exception $e) {
            Log::debug("cannot send update notification", [
                'e' => $e->getMessage(),
                'f' => $e->getFile(),
                'l' => $e->getLine()
            ]);
        }
    }

    /**
     * Handle the User "deleted" event.
     */
    public function deleted($model): void
    {
        try {
            ProcessModelObserver::dispatch($model, $model->id, 'deleted', Carbon::now());
        } catch (Exception $e) {
            // ...
        }
    }

    /**
     * Handle the User "force deleted" event.
     */
    public function forceDeleted($model): void
    {
        try {
            ProcessModelObserver::dispatch($model, $model->id, 'deleted', Carbon::now());
        } catch (Exception $e) {
            // ...
        }
    }
}

This code, outputs the following JSON:

{
   "model":{
      "original":{
         "is_default":false,
         "dedupe_is_enabled":false,
         "dedupe_value":0,
         "dedupe_accepts":false,
         "deleted_at":null,
         "user_id":1,
         "company_id":1,
         "product_id":1,
         "name":"TUK",
         "is_enabled":true,
         "dedupe_period":"days"
      },
      "current":{
         "is_default":0,
         "dedupe_is_enabled":0,
         "dedupe_value":0,
         "dedupe_accepts":0,
         "deleted_at":null,
         "user_id":1,
         "company_id":1,
         "product_id":1,
         "is_enabled":1,
         "name":"TUK",
         "dedupe_period":"days"
      }
   }
}

What do I need to change please?

this is my to-do list project and it doesnt save data to database

this is code for my to-do list web app. the Task.php is for my functions the testcreatetasks works well and add the test task to my db, but when i want the createtask func to save my inputs it doesnt work there is no error or misstakes in my connection.php or anything else i want to save inputs data from my html into my database this is the js:

function clock() {
    let d = new Date();
    let day = d.getDay();
    let date = d.getDate();
    let month = d.getMonth();

    let daysOF = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
    let monthsOF = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];

    let time = ` ${daysOF[day]}, ${monthsOF[month]} ${date}`;

    document.querySelector('.dayMonth').textContent = time;
    setTimeout(clock, 1000);
}

let addList = document.querySelector('.addList');
let addingNote = document.querySelector('.addingNote');
let description = document.querySelector('.description');

addList.addEventListener('input', () => {
    if (addList.value) {
        addingNote.style.display = 'block';
        description.style.display = 'block';
    } else {
        addingNote.style.display = 'none';
        description.style.display = 'none';
    }
});

document.addEventListener('DOMContentLoaded', function () {
    let listContain = document.querySelector('.ListOfWork');
    let addButton = document.querySelector('.addButton');
    let numPinned = document.querySelector('.numberOfPins');
    let completedTask = document.querySelector('.completedTask');
    numPinned.textContent = 0;
    completedTask.textContent = 0;

    addButton.addEventListener('click', () => {
        if (addList.value.trim() !== '') {
            let taskActive = document.createElement('div');
            taskActive.classList.add('taskActive');
            listContain.appendChild(taskActive);

            let taskHead = document.createElement('h2');
            taskHead.classList.add('TextAdded');
            taskHead.textContent = addList.value;
            taskActive.appendChild(taskHead);

            let takeDescription = document.createElement('div');
            takeDescription.classList.add('descriptionAdded');
            takeDescription.textContent = `Notes: ${description.value}`;
            taskActive.appendChild(takeDescription);

            let takeEdit = document.createElement('i');
            takeEdit.classList.add('fa-solid', 'fa-ellipsis-vertical', 'editing');
            taskActive.appendChild(takeEdit);

            let taskDone = document.createElement('input');
            taskDone.classList.add('taskDone');
            taskDone.type = 'checkbox';
            taskActive.appendChild(taskDone);

            let editAllText = document.createElement('div');
            editAllText.classList.add('editAllText');
            takeEdit.appendChild(editAllText);

            let editInnerText = document.createElement('button');
            editInnerText.classList.add('editInnerText');
            editInnerText.textContent = `Edit`;
            editAllText.appendChild(editInnerText);

            editInnerText.addEventListener('click', () => {
                const isEditable = taskHead.contentEditable === 'true';
                taskHead.contentEditable = !isEditable;
                takeDescription.contentEditable = !isEditable;
                if (taskHead.contentEditable === 'true') {
                    taskHead.style.border = '1px dotted #ffffff7c';
                    takeDescription.style.border = '1px dotted #ffffff7c';
                    editInnerText.textContent = 'Editted';
                } else {
                    taskHead.style.border = '0px';
                    takeDescription.style.border = '0px';
                    editInnerText.textContent = 'Edit';
                }

                const taskData = {
                    title: taskHead.textContent,
                    description: takeDescription.textContent
                };
                const xhr = new XMLHttpRequest();
                const url = 'Task.php';
                xhr.open('POST', url, true);
                xhr.setRequestHeader('Content-Type', 'application/json');
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === XMLHttpRequest.DONE) {
                        if (xhr.status === 200) {
                            // Task was added successfully
                            const response = JSON.parse(xhr.responseText);
                            console.log(response.message);
                        } else {
                            console.error('Error adding task:', xhr.status, xhr.statusText);
                        }
                    }
                };
                xhr.send(JSON.stringify(taskData));

                addList.value = '';
                description.value = '';
            });

            let removeInnerText = document.createElement('button');
            removeInnerText.classList.add('removeInnerText');
            removeInnerText.textContent = `Delete`;
            editAllText.appendChild(removeInnerText);

            removeInnerText.addEventListener('click', () => {
                taskActive.remove();
            });

            taskDone.addEventListener('click', () => {
                if (taskDone.checked) {
                    taskActive.style.opacity = '0.4';
                    takeEdit.style.pointerEvents = 'none';
                    completedTask.textContent = ++completedTask.textContent;
                } else {
                    taskActive.style.opacity = '1';
                    takeEdit.style.pointerEvents = 'fill';
                    completedTask.textContent = --completedTask.textContent;
                }
            });

            let pinTop = document.createElement('button');
            pinTop.classList.add('pinTop');
            pinTop.textContent = `Pin`;
            editAllText.appendChild(pinTop);

            pinTop.addEventListener('click', () => {
                if (listContain.contains(taskActive)) {
                    listContain.removeChild(taskActive);
                    pinTop.textContent = `Pin`;
                    numPinned.textContent = --numPinned.textContent;
                } else {
                    listContain.appendChild(taskActive);
                    pinTop.textContent = `Unpin`;
                    numPinned.textContent = ++numPinned.textContent;
                }
            });

            addList.value = '';
            description.value = '';
        }
    });

    clock();
});
ere

and this is my Task.php:

<?php

class Task
{
    private $pdo;

    public function __construct($pdo)
    {
        $this->pdo = $pdo;
    }

    public function getAllTasks()
    {
        $query = "SELECT * FROM tables";
        $statement = $this->pdo->query($query);
        $tasks = $statement->fetchAll(PDO::FETCH_ASSOC);
        return $tasks;
    }

    public function getTaskById($id)
    {
        $query = "SELECT * FROM tables WHERE id= :id";
        $statement = $this->pdo->prepare($query);
        $statement->bindValue(":id", $id, PDO::PARAM_INT);
        $statement->execute();
        $task = $statement->fetch(PDO::FETCH_ASSOC);
        return $task ? $task : null;
    }

    public function updateTask($id, $title, $description = '', $status = 0)
    {
        $query = "UPDATE tables SET title=:title,description=:description, status=:status WHERE id=:id";
        $statement = $this->pdo->prepare($query);
        $statement->bindVaLUE(":id", $id, PDO::PARAM_INT);
        $statement->bindValue(":description", $description, PDO::PARAM_STR);
        $statement->bindValue(':status', $status, PDO::PARAM_INT);
        $statement->bindValue(":title", $title, PDO::PARAM_STR);
        return $statement->execute();
    }

    public function deleteTask($id)
    {
        $query = "DELETE FROM tables WHERE id=:id";
        $statement = $this->pdo->prepare($query);
        $statement->bindValue(":id", $id, PDO::PARAM_INT);
        return $statement->execute();
    }

    public function testCreateTask()
    {
        $title = "Test Task";
        $description = "This is a test task.";
        $taskId = $this->createTask($title, $description);
        echo "Test Task created with ID: " . $taskId;
    }

}


$pdo = require_once "connection.php";
$task = new Task($pdo);
$task->CreateTask();
type here

help me please:))))))))))))))

i want it to save my data in my db

Best solution implementing “basic” bbcode with php [duplicate]

I’m writing a board software which have basic styling such as bold, italic, underline, strikethrough. I use the bbcode syntax for them. For full bbcode support/compatible, I will need regex, but for that basic styling, I found that I can do str_replace with [b] [i] [/close-tag]… replaced with after I do a htmlspecialchars() sanitize. Could there be a problem with that?

json_encode output can’t have more than 3 backslashes?

I have code that manipulates very large amounts of data and transforms them with json_encode, (about 255’000 characters) and transforms them with json_encode but I notice that each time json_encode does not return more than 3 backslashes, is is this on purpose, a bug, or something else?

<?php
header("content-type: application/json");
function Json_Zip($dir, $data) {
if ($dh = opendir($dir)) {
    while (($entry2 = readdir($dh)) !== false) {
        if ($entry2 != "." && $entry2 != "..") {
            $entry2 = $dir . $entry2;
                if (is_dir($entry2)) {
                    $data[$entry2] = 0;
                    $data = Json_Zip($entry2."/", $data);
                } else {
                    $fileContent = file_get_contents($entry2);
                    $data[$entry2] = $fileContent;
                }
        }
    }
}
return $data;
}

file_put_contents("content.json",json_encode(Json_Zip("./", []), JSON_UNESCAPED_UNICODE));

and when I use a script for transform the file to a directory that’s happend :

(At start : “hercher “Nom : Le mei”)
(After json_encode : “hercher “Nom : Le mei”),
I try to update the php version put, nothing

rouble with CodeIgniter framework – Issue with ‘ext-intl’ extension

I try to create a ci4 project via Composer and this message has appeared “Your requirements could not be resolved to an installable set of packages.

Problem 1
– codeigniter4/framework[4.0.0, …, v4.3.7] require ext-intl * -> it is missing from your system. Install or enable PHP’s intl extension.
– Root composer.json requires codeigniter4/framework ^4.0 -> satisfiable by codeigniter4/framework[4.0.0, …, v4.3.7].

To enable extensions, verify that they are enabled in your .ini files:
– C:xamppphpphp.ini
You can also run php --ini in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with --ignore-platform-req=ext-intl to temporarily ignore these required extensions.” and when I enable the intl extension in php.ini it not work also

I try to create ci4 project and via composer and this doesn’t work

Populate input values from MySQL | PHP

I am developing an Interrail Planner for my friends and I use to plan and budget our next summer interrail trip.
I’m developing it with php and mysql (obviously with html css and js for front-end/back-end). I also have a folder inside the project with the names “Testes” so I can develop and try the pages before create the final page and respective css files.

Right now, I am testing part of the page with the personal info of each travelers (still have only the front-end for one, then is just to multiply it).

The connection file (config.php) looks like:

<?php
    define('HOST', 'localhost');
    define('USER', 'root');
    define('PASS', '');
    define('BASE', 'interrail');

    $conn = new MySQLi(HOST, USER, PASS, BASE);

Part of the page test looks like:

<div class="pass-body">
                        <div class="primary-info">
                            <div id="pass-name">
                                <label for="name">Full Name:</label>
                                <input type="text" name="name" id="name" readonly>
                            </div>
                            <div id="pass-birth-date">
                                <label for="birth-date">Birth Date:</label>
                                <input type="date" name="birth-date" id="birth-date" readonly>
                            </div>
                        </div>
                        <div class="fiscal-info">
                            <div class="first-line">
                                <div id="pass-street">
                                    <label for="street">Street:</label>
                                    <input type="text" name="street" id="street" readonly>
                                </div>
                                <div id="pass-no">
                                    <label for="street-no">No.:</label>
                                    <input type="text" name="street-no" id="street-no" readonly>

Part of JS looks like:

<script>
            // Function to fetch user data based on the selected person (button click)
            function fetchUserData(personId) {
                const xhr = new XMLHttpRequest();
                xhr.onreadystatechange = function () {
                    if (this.readyState === 4 && this.status === 200) {
                        const data = JSON.parse(this.responseText);
                        if (data) {
                            document.getElementById('name').value = data.name;
                            document.getElementById('birth-date').value = data.birth_date;
                            document.getElementById('street').value = data.street;
                            document.getElementById('street-no').value = data.street_no;
        
                            // Save the filled data to localStorage
                            localStorage.setItem('name', data.name);
                            localStorage.setItem('birth-date', data.birth_date);
                            localStorage.setItem('street', data.street);
                            localStorage.setItem('street-no', data.street_no);
                        }
                    }
                };
                xhr.open('GET', `travelersdata.php?id=${personId}`, true);
                xhr.send();
            }
        
            // Function to retrieve saved data from localStorage and populate the input fields
            function loadSavedData() {
                const name = localStorage.getItem('name');
                const birthDate = localStorage.getItem('birth-date');
                const street = localStorage.getItem('street');
                const streetNo = localStorage.getItem('street-no');
        
                document.getElementById('name').value = name;
                document.getElementById('birth-date').value = birthDate;
                document.getElementById('street').value = street;
                document.getElementById('street-no').value = streetNo;
            }
        
            // Load saved data on page load
            window.addEventListener('load', function () {
                // Call fetchUserData with personId=1 to populate the data for id=1
                fetchUserData(1);
                // Load any previously saved data from localStorage
                loadSavedData();
            });
        
</script>

However, it only populates some of the information (the birth date is not populate) and some of them is populated but as undefined.

I have changed the database columns names and checked and rechecked all the code but nothing has changed.

How can I connect the rest api I wrote to my flutter project?

When I test my php files with postman, it works but I can’t run it with retrofit.

I am trying to write an API for the first time and both methods return an error on the resource status.

get: https://www.codeocean.net/codeocean/getdata.php
post: https://www.codeocean.net/codeocean/adddata.php (in the request body:

{
    "userName": "uzaktan ",
    "userSurname": "uzaktan ",
    "userBalance": 111,
    "userEmail": "uzaktan ",
    "userPassword": "123123"
}

)

mixinuserfeature.dart

  Future<Resource<List<UserModel>>> getData() async {
    try {
      final result = await client.getData();
      debugPrint(" result: $result");
      return Resource.success(await client.getData());
    } catch (e) {
      return Resource.error('Failed to fetch datas: $e');
    }
  }

  Future<Resource<UserModel>> createUser(
      String userName, String userSurname, int userBalance, String userEmail, String userPassword) async {
    try {
      return Resource.success(await client.createUser({
        "userName": userName,
        "userSurname": userSurname,
        "userBalance": 111,
        "userEmail": userEmail,
        "userPassword": userPassword,
      }));
    } catch (e) {
      return Resource.error('Failed to create user: $e');
    }
  }

generator.dart

import 'package:dio/dio.dart' hide Headers;
import 'package:retrofit/retrofit.dart';

import '../models/user_model.dart';
import 'constants.dart';

part 'generator.g.dart';

@RestApi(baseUrl: ApiConstants.BASE_URL)
abstract class RestClient {
  factory RestClient(Dio dio, {String? baseUrl}) = _RestClient;

  @GET('/codeocean/getdata.php')
  Future<List<UserModel>> getData();

  @POST('/codeocean/adddata.php')
  @Headers(<String, dynamic>{
    "Content-Type": "application/json",
  })
  Future<UserModel> createUser(@Body() Map<String, dynamic> user);

}

adddata.php

<?php

include 'conn.php'; 

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $json_data = file_get_contents('php://input');
    $data = json_decode($json_data, true);

    $userName = $data['userName']; 
    $userSurname = $data['userSurname']; 
    $userBalance = $data['userBalance']; 
    $userEmail   = $data['userEmail']; 
    $userPassword    = $data['userPassword']; 

    $sql = "INSERT INTO users (userName, userSurname, userBalance, userEmail, userPassword)
            VALUES ('$userName', '$userSurname', '$userBalance', '$userEmail', '$userPassword')";

    if ($conn->query($sql) === TRUE) {
        $lastInsertId = $conn->insert_id;
        $response = array(
            "userId" => $lastInsertId,
            "userName" => $userName,
            "userSurname" => $userSurname,
            "userBalance" => $userBalance,
            "userEmail" => $userEmail,
            "userPassword" => $userPassword
        );
        
        echo json_encode($response);
    } else {
        $response = array(
            "status" => "error",
            "message" => "error while creating user : " . $conn->error
        );
        echo json_encode($response);
    }

    $conn->close();
} else {
    $response = array(
        "status" => "error",
        "message" => "method error"
    );
    echo json_encode($response);
}

getdata.php

<?php

include 'conn.php';

error_reporting(E_ALL);
ini_set('display_errors', 1);

$sql = "SELECT * FROM users";
$result = $conn->query($sql);

if (!$result) {
    die("Error: " . $conn->error);
}

$res = array();

while ($row = $result->fetch_assoc()) {
    $res[] = $row;
}

echo json_encode($res);

?>

user_model.dart

import 'package:json_annotation/json_annotation.dart';

part 'user_model.g.dart';


@JsonSerializable()
class UserModel {
  String? userId;
  String? userName;
  String? userSurname;
  int? userBalance;
  String? userEmail;
  String? userPassword;

  UserModel({this.userId, this.userName, this.userSurname, this.userBalance, this.userEmail, this.userPassword});

  factory UserModel.fromJson(Map<String, dynamic> json) => _$UserModelFromJson(json);
  Map<String, dynamic> toJson() => _$UserModelToJson(this);
}

I am trying to connect my flutter project to remote mysql database but I am getting error.

Authorization in php, without further saving the password and login, which is a connection to the Oracle database

Authorization in php, without further saving the password and login, which is a connection to the Oracle database.

Modeling the situation:
The user enters his login and password in the form on the auth.php page, the data is sent,

new ConnectToDB($user,$password) 

happens, he is authorized and redirected to the example.php page On which the select request to the database occurs through the

new ExampleModel($dbConnect)

instance, $dbConnect must have a connection to the database obtained from the auth.php page similarly on other pages

I experienced: storage of connections in sessions; connection storage in pseudo-globally install; storing them in a separate facility; create SessionManager; and other options Caused connection = null on new pages, or oci8 resource could not be passed

LaminasStorageCache issue after migration from Zend Framework 3 to Laminas

I migrated a project from Zend Framework 3 to Laminas.

Since I occur an error with Doctrine and DoctrineModuleCacheLaminasStorageCache.

The message says:
Service with name “DoctrineModuleCacheLaminasStorageCache” could not be created. Reason: Could not resolve value for parameter “storage” of type LaminasCacheStorageStorageInterface in class DoctrineModuleCacheLaminasStorageCache (requested as DoctrineModuleCacheLaminasStorageCache)

I haven’t defined any “storage” parameter anywhere.

This error happend when I try to access to the database

$this->getServiceLocator()->get('DoctrineORMEntityManager');

I can get the ServiceLocator, it returns an object, but can’t reach the EntityManager.
This EntityManager subcall the service locator several times to create a lot of instances of differents Laminas modules, and fails on the LaminasStorageCache as the error message said.

I have a simple MySQL in localhost and this simple configuration regarding Doctrine:

'doctrine' => array(
        'connection' => array(
            'orm_default' => array(
                'driverClass' => DoctrineDBALDriverPDOMySQLDriver::class,
                'params' => array(
                    'host'     => 'localhost',
                    'port'     => '3306',
                    'user'     => 'root',
                    'password' => '',
                    'dbname'   => 'mybase',
                    'charset'  => 'utf8'
                )
            )
        ),

I don’t understand this error and it’s not linked to my application code, it comes from Laminas deep ^^
It should be a bad configuration but I can’t figure out what :’
I deep into the code and tried to configure the Doctrine cache, but without any difference.

If anyone can help me or explain me what I missed.

By the way, I would like to add that I have others projets, successfully migrated to Laminas, I don’t see any difference in the configuration files and they works well.

Looped elements in a form not inserting into table correctly

I have a website which allows Gyms and Customers to join. The Gym owner can add their classes and update their schedule. There’s 3 important tables in this scenario (gyms, gym_classes, gym_schedules).

Gym owners can have multiple gyms, but each gym has it’s own schedule.

The schedule will be the same weekly, so my gym_schedule table has the following columns

id | gym_id | class_id | day_of_week | start_time

As this repeats weekly, I insert the day of the week as an integer, 1 to 7 (Mon to Sun).

My Form is as so

<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"] . '?gym_id=' . $gym_id); ?>" method="post">
    <?php for ($day = 1; $day <= 7; $day++): ?>
        <h3><?php echo $dayNames[$day]; ?></h3>
        <label for="class_id_day<?php echo $day; ?>">Select Classes and Start Times:</label>
        <br>
        <?php foreach ($classes as $class): ?>
        <?php
            $class_id_key = 'class_id_day' . $day;
            $start_time_key = 'start_time_day' . $day;

            // Check if the class has a schedule for the current day
            $isChecked = isset($schedule_by_day[$day][$class['id']]);
            $startTimeValue = $isChecked ? $schedule_by_day[$day][$class['id']] : '';
        ?>

                <input type="checkbox" name="schedule[<?php echo $day; ?>][class_id][]" value="<?php echo $class['id']; ?>" <?php if ($isChecked) echo 'checked'; ?>>
                <?php echo $class['class_name']; ?>:
                <!-- With this -->
                <select name="schedule[<?php echo $day; ?>][time][]">
                    <?php
                    $selectedTime = $startTimeValue ? date('H:i', strtotime($startTimeValue)) : '';
                    for ($hour = 0; $hour < 24; $hour++) {
                        for ($minute = 0; $minute < 60; $minute += 15) {
                            $time = sprintf('%02d:%02d', $hour, $minute);
                            echo '<option value="' . $time . '" ' . ($selectedTime === $time ? 'selected' : '') . '>' . $time . '</option>';
                        }
                    }
                    ?>
                </select>
                <br>
            <?php endforeach; ?>
            <br>
        <?php endfor; ?>

        <input type="submit" value="Save Schedule">
    </form>

This renders on my page like…

Monday
Select Classes and Start Times:
Class A: **SELECT FIELD**
Class B: **SELECT FIELD** 
Class C: **SELECT FIELD** 

My PHP insert is at the top of the page…

// Map day numbers to day names
$dayNames = array(
    1 => 'Monday',
    2 => 'Tuesday',
    3 => 'Wednesday',
    4 => 'Thursday',
    5 => 'Friday',
    6 => 'Saturday',
    7 => 'Sunday'
);

// Process the form data to set the gym schedule
if ($_SERVER["REQUEST_METHOD"] === "POST") {
    try {
        // Start a transaction
        $pdo->beginTransaction();

        // Delete existing schedule data for the gym
        $stmt = $pdo->prepare("DELETE FROM gym_schedule WHERE gym_id = :gym_id");
        $stmt->bindParam(':gym_id', $gym_id);
        $stmt->execute();

        // Loop through the days of the week (1 to 7, where 1 is Monday and 7 is Sunday)
        for ($day = 1; $day <= 7; $day++) {
            // Get the selected classes and start times for each day
            if (isset($_POST["schedule"][$day]['class_id']) && isset($_POST["schedule"][$day]['time'])) {
                $class_ids = $_POST["schedule"][$day]['class_id'];
                $start_times = $_POST["schedule"][$day]['time']; // Use 'time' instead of 'start_time'

                foreach ($class_ids as $index => $class_id) {
                    // Get the selected time for this class on this day
                    $start_time = $start_times[$index];

                    // Check if the start time for this class on this day is empty
                    // If empty, skip inserting this record
                    if (empty($start_time)) {
                        continue;
                    }

                    $stmt = $pdo->prepare("INSERT INTO gym_schedule (gym_id, class_id, day_of_week, start_time)
                                        VALUES (:gym_id, :class_id, :day_of_week, :start_time)");
                    $stmt->bindParam(':gym_id', $gym_id);
                    $stmt->bindParam(':class_id', $class_id);
                    $stmt->bindValue(':day_of_week', $day);
                    $stmt->bindParam(':start_time', $start_time);
                    $stmt->execute();
                }
            }
        }

        // Commit the transaction
        $pdo->commit();
    } catch (PDOException $e) {
        // Rollback the transaction in case of an error
        $pdo->rollBack();
        die("Error: " . $e->getMessage());
    }

    // Redirect after processing form data
    header("Location: my-gyms.php");
    exit();
}

With this, I’m getting some really mixed results. Some days the class and its time are inserted correctly, others the class is inserted with the time set to 00:00:00 and others no record is inserted at all.

I’ve dumped the results of the array and all looks okay so I presume its to do with my insert statement? I’ve also tried using a time input which didn’t work.

I’ve become unstuck, I tried ChatGPT to no avail and I can’t think of anything else now to get this working.

MONTHLY REPORT ON EXCEL FORMAT [closed]

A. Sales Volume:

Routine:

AA Branches:
Patients: 2969
Tests: 5497
Covid: 116
Grand total: 3085
Head Office:

Routine:
Cash: 3,342
Credit: 577
Covid: 233
Grand total: 4,152
Total number of tests: 8,920
B. Challenges:

Test delay and sudden discontinuation
Partial release
Information gap with customer support
Return sample
Toilet flush stolen twice in AA5
Barcode malfunction frequent in AA2
Contamination concern (Hepatitis B)
Incomplete and missing test information
Locker keys issue
Partial unreleased results
Result delay
Communication issues
Pity cash issue
Printer issue
C. Completed Challenges:

AA5 toilet fixed
Connection fixed
AA6 transportation problem resolved
Pity cash issue resolved
Partial unreleased results addressed (occasionally recurs)
D. Challenges in Progress:

Contamination concern (Hepatitis B): Request for vaccination in progress
Incomplete and missing test information: Deletion of incomplete tests and pricing resolution underway
Locker keys issue being addressed
Printer issue being resolved
Communication issues under investigation
E. Updates in Work:

New staff members welcomed
Tele Birr account set up for enhanced payment convenience
Cash machine introduced for streamlined cash handling
Promptly informing customers about delayed test results
F. Achievement for the Last Month Plan:

Increased number of customers
Increased number of tests conducted
Improved customer satisfaction
Enhanced operational efficiency
G. Plan for the Next Month:

Complete all ongoing work
Increase the number of customers
Develop and maintain relationships with staff members
Adhere to SOPs for smooth operations
Perform assigned duties
Conduct regular meetings
Implement result verification process
H. Achievement for the Last Month Plan:

Successfully attracted more customers
Conducted a higher number of tests
Customers expressed satisfaction with the prompt availability of test results
Improved operational efficiency PLEASE COMPILE THIS REPORT ON EXCELOR WORD FORMAT

A GOOD REPORT ON THIS LINK OR APP