Page 1 of 1

how to check whether all columns in an array have null value

Posted: Wed Jul 29, 2009 3:35 am
by harikamat
Hi,

I have to create a table to store product details. But the structure is inconsistent. For eg:- some product requires only six columns, some 7 columns, etc. and the column names would also be different as given below:

CODE - CARTRIDGE MODEL NO. - PRINTER DESCRIPTION - COLOR - TYPE
CODE - CARTRIDGE MODEL NO. - PRINTER DESCRIPTION - PRODUCT

From the above you can figure out that the product properties are inconsistent. In such a scenario how should i design a database table, and how should i display the product details on php page.

Can anyone help

regards,

harish

Re: how to check whether all columns in an array have null value

Posted: Wed Jul 29, 2009 4:15 am
by papa
Allow null values in those columns that doesn't require a value.

When displaying the content you can for example use if(!empty($db_value) echo $value
or however you would like to display the data.

Play around a little bit and show us what you come up with.