ebchost Posted December 23, 2011 Share Posted December 23, 2011 $utakmice = mysql_query(" SELECT `man_timovi`.`id`, `man_timovi`.`naizv`, `man_timovi`.`user_id`, `man_utakmice`.`id`, `man_utakmice`.`liga_id`, `man_utakmice`.`sezona_id`, `man_utakmice`.`kolo`, `man_utakmice`.`datum, `man_utakmice`.`domacin`, `man_utakmice`.`brojd`, `man_utakmice`.`gold`, `man_utakmice`.`golg`, `man_utakmice`.`brojg`, `man_utakmice`.`gost`, SUM(`man_utakmice`.`bodd` + `man_utakmice`.`bodg`) FROM `man_timovi`,`man_utakmice` WHERE `man_utakmice`.`liga_id`= '1' AND `man_timovi`.`id` = `man_utakmice`.`domacin` OR `man_timovi`.`id`=`man_utakmice`.`gost` GROUP BY `man_timovi`.`id` ORDER BY SUM(`man_utakmice`.`bodd`+`man_utakmice`.`bodg`) DESC") or die(mysql_error()); while($row = mysql_fetch_array($utakmice)) { .. } You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`.`domacin`, `man_utakmice`.`brojd`, `man_utakmice`.`gold`, `man_utakmice`.`g' at line 9 man_timovi: id, liga_id, naziv, user_id berger, sifra man_utakmice: id, liga_id, sezona_id, kolo, datum, domacin, brojd, gold , golg, brojg, gost, bodd, bodg Quote Link to comment https://forums.phpfreaks.com/topic/253771-selection-problem-all-data-is-corect/ Share on other sites More sharing options...
trq Posted December 23, 2011 Share Posted December 23, 2011 Your kidding aren't you? Quote Link to comment https://forums.phpfreaks.com/topic/253771-selection-problem-all-data-is-corect/#findComment-1300988 Share on other sites More sharing options...
ebchost Posted December 23, 2011 Author Share Posted December 23, 2011 Your kidding aren't you? i mast write SQL with out `` thanks Quote Link to comment https://forums.phpfreaks.com/topic/253771-selection-problem-all-data-is-corect/#findComment-1300992 Share on other sites More sharing options...
trq Posted December 23, 2011 Share Posted December 23, 2011 Your kidding aren't you? i mast write SQL with out `` thanks Pardon? Quote Link to comment https://forums.phpfreaks.com/topic/253771-selection-problem-all-data-is-corect/#findComment-1300993 Share on other sites More sharing options...
ebchost Posted December 23, 2011 Author Share Posted December 23, 2011 Your kidding aren't you? i mast write SQL with out `` thanks Pardon? SELECT man_timovi.id, man_timovi.naziv, man_timovi.liga_id, SUM( gold ) , SUM( golg ) , SUM( bodd ) , SUM( bodg ) FROM man_timovi, man_utakmice WHERE man_timovi.liga_id = '1' AND man_timovi.id = man_utakmice.domacin OR man_timovi.id = man_utakmice.gost GROUP BY man_timovi.id ORDER BY SUM( `man_utakmice`.`bodd` + `man_utakmice`.`bodg` ) DESC the only thing bothering me now is, which is still showing data for the league labeled liga=2, liga=3 .. I want only league 1 (liga_id = 1) Quote Link to comment https://forums.phpfreaks.com/topic/253771-selection-problem-all-data-is-corect/#findComment-1300999 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.