i have some problemes with mysql prepared queries. Especially UPDATE and INSERT.
$mysqliStmt->execute();
does NOT update or insert into a table. It just delivers stmt results. There are no errors, warnings or anything else. (see below)
I hope somebody knows what im doing wrong :)
The Insert query i use:
INSERT INTO testdatabase.`test` (`test1`, `test2`) VALUES(?, ?)
The Update query:
UPDATE testdatabase.`test` SET `test1` = ? WHERE `id` = ? LIMIT 1
Resultinformation (update):
'fieldCount' => 0,
'affectedRows' => 1,
'numRows' => 0,
'paramCount' => 2,
'insertId' => 0,
'sqlstate' => '00000',
'threadId' => 5291,
'errno' => 0,
'error' => '',
'warningCount' => 0,
'warnings' => false
'connectErrno' => 0,
'connectError' => NULL,
'hostInfo' => 'Localhost via UNIX socket',
'protocolVersion' => 10,
'serverInfo' => '5.1.49-3',
'serverVersion' => 50149,
'clientInfo' => '5.0.27',
'clientVersion' => 50027,
'info' => 'Rows matched: 1 Changed: 1 Warnings: 0'
The code:
$stmt = self::$_connection->prepare($query);
//binds params -> like/with $stmt::bind_param() but more generic
$this->_bindParameters($stmt)
$stmt->execute();
Now the update/insert data should be stored into database or im wrong?
If i use phpmyadmin or mysql console to verify the results of the queries, the database table was neither updated nor was the new data inserted.
Thank you for your help :)
No comments:
Post a Comment