Skip to content

Argument #2 ($arg) must be passed by reference, value given #222

Open
@Nightmare

Description

@Nightmare

I'm probably missing something out, but the query is simple and the row is correctly inserted into the db.

I installed it with composer ezsql/ezsql on windows, xampp, php 8.1.4

the, double, error

Warning: ezsql\Database\ez_mysqli::ezsql\Database{closure}(): Argument #2 ($arg) must be passed by reference, value given in C:\xampp\htdocs\vendor\ezsql\ezsql\lib\Database\ez_mysqli.php on line 307

Warning: ezsql\Database\ez_mysqli::ezsql\Database{closure}(): Argument #2 ($arg) must be passed by reference, value given in C:\xampp\htdocs\vendor\ezsql\ezsql\lib\Database\ez_mysqli.php on line 307

use ezsql\Config;
use ezsql\Database\ez_mysqli;

$dsn_path_user	= 'root';
$password	= '';
$database	= 'database';
$other_settings	= '';

$settings = new Config('mysqli', [$dsn_path_user, $password, $database, $other_settings]);

$db = new ez_mysqli($settings);

$db->prepareOn(); // with and without prepareOn

$values = [];
$values['name'] = "test name";
$values['status'] = '1';
$name = 'test name';
$status = 1;
$db->insert('meetings', $values);

i also tried, same error, and new row in the db is inserted.

$db->insert('meetings', ['name' => $name, 'status' => $status]);

or

$db->insert('meetings', ['visitor_name' => "$name", 'status' => "$status"]);

if I do simple query without shortcut it works without errors

$db->query("INSERT INTO meetings (visitor_name, status) VALUES ('$name', 1)");

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    error-bugIssues causing application termination.warning-bugIssues not causing scripts/routines to die/fail.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions