0

Hi
i have this line of code that i want to test when a user choose ...

$c=count($pulse);

array_push($ser, $pulse);

foreach($ser as $serv){
  $serv1[] = $serv;
}
   if($c>=4){
        include('full.php');  
        $netw = empty($_POST['netw'])?null:$_POST['netw'];
        $client = empty($_POST['client'])?null:$_POST['client']; 
        getRecords($date,$date2,$report,$client,$netw,$auto);
     }

in this line all the check boxes supposed to be ticked and it works fine
and now i want to add to this command if a user tick only 2 1 any propabilities...
the script will be called

function getRecords($startDate,$endDate,$report,$customer,$serial,$auto){  

$sql="SELECT * FROM count_transactions WHERE DATE(tran_date) BETWEEN '$startDate' AND '$endDate' and account_no=$auto and unit_name='Litres' ";
           if ($customer != null) $sql .= " AND customer_no=$customer  ";
           if ($serial != null) $sql .= " AND unit_serial=$serial ";
            if ($ser<4) $sql .= " AND pulse_channel=$serv[] ";
           $sql .= " GROUP BY unit_serial";  

any help please

3
Contributors
4
Replies
28
Views
4 Years
Discussion Span
Last Post by LastMitch
0

and now i want to add to this command if a user tick only 2 1 any propabilities...

Was there an error when you ran this query?

It looks weird.

0

It is hard to figure out from your post what exactly is the problem but looking at your query on line 6 this certainly won't work:

if ($ser<4) $sql .= " AND pulse_channel=$serv[] ";

You can't use $serv[] a query (which is basicaly a string). You will either have to decide which element to use or run foreach loop and use each value from the array depending of the logic you want to implement.

0

that is what i want to test on line 6 it is not working of course when i run the script after adding line 6

0
if ($ser<4) $sql .= " AND pulse_channel=$serv[] ";

What is the purpose < 4?

I know $ser is an array but like what broj1 mention about your query not working, to me your query doesn't make any sense.

You declare it here as

$serv1[] = $serv;

but in your query it's this

pulse_channel=$serv[]

Is $serv1[ ] is the same as $serv[ ]?

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.