currently I have a cop_config table. What I want is to fetch some (not all) column names using where condition too. Right now, I am only able to get all column name using the following code..
$cop_value = "SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'cop_config' and is_nullable = 'NO'";
$cop_result = $conn->query($cop_value);
while($cop_row = $cop_result->fetch_assoc()){
$cop_row = implode(',', $cop_row);
echo $cop_row;
}
currenlty my output is :
iddevice_keyfirst_pulse1first_pulse2first_pulse3first_pulse4first_pulse5first_pulse6first_pulse7first_pulse8second_pulse1second_pulse2second_pulse3second_pulse4second_pulse5second_pulse6second_pulse7second_pulse8
from the table what I want is to get only those column name according to device_key(in cop_config table) which has 1 in value. I am know my problem explanation is not so good please look at the table picture for better understanding tnx alot for your concern.
like in device_key YMR200, I just want to get the column name -- first_pulse1 & second_pulse2
similary for device_key VTA600 I want get the column name -- first_pulse3 & second_pulse4.
------------------------------☺☻♀♥♣♦♣WÇ-------------------------------- after a long search and google currently I am using
$cop_value = "SELECT 'first_pulse1' from cop_config where first_pulse1 = 1 and device_key = 'VTA600' union
select 'first_pulse2' from cop_config where first_pulse2 = 1 and device_key = 'VTA600' union
select 'second_pulse1' from cop_config where second_pulse1 = 1 and device_key = 'VTA600' union
select 'second_pulse2' from cop_config where second_pulse2 = 1 and device_key = 'VTA600'";
$cop_result = $conn->query($cop_value);
while($cop_row = $cop_result->fetch_assoc()){
echo $cop_row;
}
I knwo I have made blunder mistake here while fetching the value ... but I am dont know how to fetch the value from the query . Plz help thanks ..