0

Hi
i have a query that i want to display the pulser1 pulser2 pulser3 pulser4 from table but only when the input type for each pulser=2
when i run the query not working as i want it
please check my query
$netw is a variable it can be any value from 1 until 72 it is serial_no

$query4="select account_ref,serial_no,pulser1_name,pulser2_name,pulser3_name,pulser4_name,pulser1_input_type,pulser2_input_type,
 pulser3_input_type,pulser4_input_type from net_watch_units
         where serial_no=$netw and pulser1_input_type=2 OR pulser2_input_type=2 OR pulser3_input_type=2 OR pulser4_input_type=2"; 
$result4=mysql_query($query4);
$record4=mysql_fetch_array($result4);
$pulser1=$record4['pulser1_name'];  
$pulser2=$record4['pulser2_name'];
$pulser3=$record4['pulser3_name'];
$pulser4=$record4['pulser4_name'];
3
Contributors
5
Replies
25
Views
4 Years
Discussion Span
Last Post by asaidi
0
where serial_no=$netw AND ( pulser1_input_type=2 OR pulser2_input_type=2 OR pulser3_input_type=2 OR pulser4_input_type=2)

I think so u want to check either of 4 input type = 2 and serial no = value padded

0

one of them must have 2 it can be puler1=2 the pulser2=3 pulser3=1 and pulser4=14
then if one of them have 2 i need to get the name
ex:if pulser1=2 then pulser1_name=name i collect the name ..and each pulser has a field

0

@asaidi : then use this:-

$query4="select account_ref,serial_no,pulser1_name,pulser2_name,pulser3_name,pulser4_name,pulser1_input_type,pulser2_input_type,
 pulser3_input_type,pulser4_input_type from net_watch_units
         where serial_no=$netw AND ((pulser1_input_type=2) OR (pulser2_input_type=2) OR (pulser3_input_type=2) OR (pulser4_input_type=2))"; 

Only thing i am not sure is why are you using serial_no=$netw
If it is your requirement then above code snippet will work for you

0

it is to test the right unit when the user choose then the variable is saved in $netw

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.