Answer the question
In order to leave comments, you need to log in
How to send an array of std class objects to mysql with php?
I use mysqli, all data is sent except for one array, I don’t understand what the problem is, the request looks like this:
$stmt = $link->prepare("INSERT INTO movies (ID,,..actors) VALUES (?, ... ?)");
$stmt->bind_param("s...s", $ID ... $actors_cast);
$actors_cast=serialize($actors->cast);//попробовал и с json_encode,все равно одно и то же или ошибку выдает или на БД появляется вместо массива в виде строки запись Array и все
$stmt->execute();
массив выглядит вот так
array(53) {
[0]=>
object(stdClass)#86 (8) {
["cast_id"]=>
int(0)
["character"]=>...
Answer the question
In order to leave comments, you need to log in
Judging by the code, it should work, except for the fact that for writing such arrays to the database you have to kick your toes in army boots, so that later even the edge of such a thought does not arise.
> Please tell me what to do???
Describe your problems in clear Russian.
Only Harry Potter is "sent" to Hogwarts, and something is written to the database.
So you need to clearly write what exactly ends up in the database and how you found out about it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question