|
That code doesn't 'get the values from the db' -- I see two variables that look like they may come from your database ($sqldate and $sqldate2) -- Where's your current query code?
Can you clarify your original question? '2 columns with the same variable' doesn't make much sense to me. If you're trying to add all of the fields from one column in a table, you would use the SQL SUM() function. For two columns, you would typically construct one query (e.g., "SELECT SUM(x) AS sum_x, SUM(y) as sum_y FROM table_name", then use php to add the two results together.
|