Sunday 4 December 2016

mysql - PHP mysqli multiple queries bind_param crash

I have this php code (my server is at 5.3), it crashes on creating of multi-query.



I already tried deleting other queries, works when there is only one, crashes on the second. Also tried changing atributes in SELECT statement when I left first and second query, still didn't work.




$time = time();


$forum_update = $forum_db->prepare("SELECT @idpm := max(`id_pm`)
FROM `smf_personal_messages`;

SELECT @realname := `member_name`, @pmcount := `unread_messages`
FROM `smf_members` WHERE `id_member` = ? ;

INSERT INTO `smf_personal_messages`
(`id_pm_head`, `id_member_from`, `msgtime`, `from_name`, `subject`, `body`)
VALUES (@idpm+1, ?, ?, @realname, '?', '?');


INSERT INTO `smf_pm_recipients` (id_pm, id_member, is_new)
VALUES (LAST_INSERT_ID(), ?, 1);

UPDATE `smf_members` SET `unread_messages` = (@pmcount + 1), `new_pm` = 1
WHERE `id_member` = ?")
or die("Could not create query");

$forum_update->bind_param('dddssdd', $fprofile, $fprofile, $time, $subject,
$body, $fprofile, $fprofile);

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...