Question: I saw in the zookeper C binding that one of the events is ZOO\_CREATED\_EVENT.

So i assumed that when i set watch on path without real node - and then the node created - i will get "created event". but when i try to do it (Set the watch and then create the node) nothing happened. 

So is it possible? and if no when the "create-event" is triggered?

thanks a lot,

eyal

Answer: 
Per the [manual](http://php.net/manual/en/function.array-sum.php), the `array_sum` expects an array, not a string.

Your code also currently is only working with one record. You need to loop the fetch to get all records.

This should give you the sum.

```
$query = "SELECT * FROM table";
$stmt = sqlsrv_query($conn, $query);
$total = 0;
while($data = sqlsrv_fetch_array($stmt)) {
     $total += $data['Value'];
    //other stuff you are doing with results, otherwise just do SQL sum.
}
echo $total;

```

Another approach would be just selecting the sum via sql.

```
select sum(value) as the_sum from table

```

Then fetch the result and output `the_sum`.
```
$sum = array();
$users = array();
$query = "SELECT * FROM table";
$stmt = sqlsrv_query($conn, $query);

$data = sqlsrv_fetch_array($stmt);

while ($row = sqlsrv_fetch_array($result)) {

    $users[] = $row;

}
foreach ($users as $user) {
    $sum[] = $user['value'];
}
echo $total = array_sum($sum);

```