php - Notice: Array to string conversion when inserting a stdClass into a stdClass -


i trying insert data database stdclass reason, notice notice: array string conversion in data.php on line 47.

i'm creating 2 stdclasses, 1 each vehicle , 1 general contains of them. when i'm trying insert vehicle's stdclass general 1 notice.

here code (notice wrote line 47 is):

$data = new stdclass();  while($row = mysqli_fetch_array($tresult)) {     $vehicle = new stdclass();     $vehicle->name = $row['name'];     $vehicle->position = $row['position'];      $data->$row['name'] = $vehicle; //line 47 } 

what missing here? thank you

try assign way, because have interpolate variable

$data->{$row['name']} = $vehicle


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -