I use this piece of code to display data from my database on my (joomla 2.5) web.
$query
->select($db->quoteName(array('Code', 'Name', 'Price', $username)))
->from($db->quoteName('mytable'))
->where($db->quoteName($username)." != ".$db->quote('0'));
$username is used to display quantity ordered by the client. So there are 4 columns. I want to add 5th column "Total" where there will be the multiplication - "Price" * "$username".
Tried to do it something like:
$query
->select(array('Code', 'Name', 'Price', $username, 'Price' * $username as 'Total'))
->from($db->quoteName('mytable'))
->where($db->quoteName($username)." != ".$db->quote('0'));
But for a reason it doesn't work (blank page). What am I missing? Thanks for your time.