Problem with sql

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Citizen99
Forum Commoner
Posts: 32
Joined: Wed Dec 24, 2003 6:52 am
Location: Where noone understand me...

Problem with sql

Post by Citizen99 »

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

Post by Illusionist »

do you think you can reask your question in plain english? Because none of that made any sense to me.... And if your having problems with some code, then it's probably a good idea to post it in the thread so we can check it.
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

I think he wan'ts a tutorial for forms that can Add (+) Devide (/) Multiply (*) & Subtract (-) for some stat thing.
Citizen99
Forum Commoner
Posts: 32
Joined: Wed Dec 24, 2003 6:52 am
Location: Where noone understand me...

Post by Citizen99 »

Thx for help, I handle with my problems when all the job will be done I will post php code for pople who can have similiar problem with things conected with making stats. And maybe then someone can help me with improving my code :]
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

:D
Citizen99
Forum Commoner
Posts: 32
Joined: Wed Dec 24, 2003 6:52 am
Location: Where noone understand me...

Post by Citizen99 »

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;

...
Post Reply