Jump to content

SQL question..


MemphiS

Recommended Posts

I wish to retrieve all data from a column which is called "cost"

 

Example:

 

$query = mysql_query("SELECT `cost` FROM `table` WHERE `id` = '1'"); // 10 users may have the id "1"

while ($getcost = mysql_fetch_row($query)){

$start = 0;

$overall = $start += $getcost[0];

}

echo "$overall";

 

Problem is it only gets the last record in the table instead of adding all the values together :(

 

Anyone have a solution

 

Thanks :D

Link to comment
https://forums.phpfreaks.com/topic/54870-sql-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.