Problem with sql
Moderator: General Moderators
-
Citizen99
- Forum Commoner
- Posts: 32
- Joined: Wed Dec 24, 2003 6:52 am
- Location: Where noone understand me...
Problem with sql
I need some good tutorial about sql. I want to make form in php/mysql and I have problems with counting I dont know how to '+' '-' '*' '/' and I want to make some stats. Anyone can help ? Know that is simple problem but i do something wrong and only erros appear..
Last edited by Citizen99 on Tue Feb 10, 2004 1:21 pm, edited 1 time in total.
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
-
Citizen99
- Forum Commoner
- Posts: 32
- Joined: Wed Dec 24, 2003 6:52 am
- Location: Where noone understand me...
Here is part of my code it counts how much money I win depending on how much I bet etc :] it shows for example how to multiply 2 columns and then adding results :]
Code: Select all
...
$sql="SELECT SUM(kurs*stawka) from typy where stawka=4 AND status like 'win'";
$wynik = mysql_query($sql) or die(sql_error);
while ($row = mysql_fetch_row($wynik)) {
$win=round($row[0],2);
}
$sql="SELECT SUM(stawka) from typy where stawka=4";
$wynik = mysql_query($sql) or die(sql_error);
while ($row = mysql_fetch_row($wynik)) {
$bet=$row[0];
}
$prof=($win-$bet);
print $prof;
...