The data array is deleted if the column is empty or empty in the database

My table contains columns with null values. But when I try to get the data set to a variable, the data array is deleted if the column is null or empty.

lets say i have 4 columns

[cid] => 357 [smcoordinator] => [title] => Null [cname] => Maddox Adam Portland 

And my function

 function getValue($data){ $dataset = $data['dataset']['result_set']; print_r($dataset); //somecode... } 

resut in print_r

 [cid] => 357 [smcoordinator] => [cname] => Maddox Adam Portland 

How can I get a null column in my dataset?

+4
source share
2 answers

Try replacing NULL with something else

 $dataset = $data['dataset']['result_set']; $Title = $dataset['title']; //if title has no value give it one if (!$Title) { $Title = "No Value"; } 

then rebuild the array of result sets

 $data['dataset']['result_set']['title'] = $Title; 

Let me know if this works!

+1
source

Severity Level: Notification

Message: Undefined index: title

File Name: helpers / cigen_helper.php

Line Number: 42

- user2006282 3 minutes ago

Well in MYSQL, make sure the header column is not a column column of a column or index column, as these columns cannot be null and make sure NOT NULL is not checked

And this SQL error tells you about index search

+1
source

Source: https://habr.com/ru/post/1489388/


All Articles