总结表SQL的所有价格

how to sum the row of the price in my table here's my code.

$sql=mysql_query("SELECT sum(Price) * FROM reservations as A
    inner join service as B on A.Res_ser_ID = B.Ser_ID
    inner join personel as C on A.Res_per_ID = C.Per_ID
    where Res_cus_ID = '$userID' ");

You need to upgrade to supported software such as mysqli_. PHP's mysql_ API has been unsupported for many years. Then you can use parameters -- a key to safe and effective use of SQL from applications.

I think something like this (not using parameters):

SELECT sum(s.Price) as sum_price
FROM reservations r JOIN
     service s 
     ON r.Res_ser_ID = s.Ser_ID
WHERE r.Res_cus_ID = '$userID';

This assumes that the price comes from the service table.

"select sum(service.price) as sum_price from (reservations  inner join
 service  on reservation.Res_ser_D = service.Ser_ID inner join personnel
 on reservation.Res_per_ID = personnel.Per_ID ) where
 reservation.Res_cus_ID = '$userID'"

this shall work ,i have assumed that the price is in table service.