Thise will be for survey almost finished, i need calculat a.res from multiple rows for total number of votes for percents. I also dont have idea how to handle errors with mysql or die()? I want make it a bit fancy with error page and custom message is it common to make it thise way?
$sql = "SELECT s.ques, s.author_id, s.voted, s.add, a.res, a.ans, u.user
FROM survey s, answer a, user u WHERE u.id=s.author_id AND a.survey_id=$surveyId AND s.id=$surveyId ORDER BY s.id DESC";
$result = mysql_query($sql) or die(include "template/error.php"; $_SESSION['error'] = "hello world");