I have this simple query that finds the average salary of a table named permanent_employee:
SELECT AVG(E.salary)
FROM employee as E,permanent_employee as P
WHERE E.empID=P.empID
What i want to to is bind this to a PHP variable.If this returned the salary i would bind it like this echo "<td>{salary}</td>"; and everything would work OK.However this echo "<td>{$AVG(E.salary)}</td>"; gives me errors.How could i make this query return a variable that can be later coverted to PHP form?
UPDATE: solution was to use AVG(E.salary) AS sth
SELECT AVG(E.salary) as salary?gives me errors? What error(s) do you get?