Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About subuntug

  • Rank

Profile Information

  • Location
  1. Thank you for your answer, but that's not the solution. Because this query selects just one mark, it selects the best mark for the student amoung all the modules, not the best mark for each module. If there's 10 modules and 15 marks, it should select 10 marks only. Each time there's more thank one mark for a module, it should select the best mark. That's what I need.
  2. Thanks for your answer.But that's not what I need. I'm trying to keep the highest mark for each module not for the entire modules. My table looks like this: +---------+---------+---------------+-------+ | student|module |mark Number |mark | +---------+---------+---------------+-------+ | Mike |Module1 | 1 |15 | +---------+---------+---------------+-------+ |Mike |Module1| 2 |11 +---------+---------+---------------+-------+ | Mike |Module2 | 1 |9 +---------+---------+-------
  3. Hello every body, I have a table which contains exams' marks for student in different modules. Each student can have one or many marks for each module in the table. When I have more than one mark for a student in a module, I have to keep the highest mark. I need to calculate the average for each student in my table. How can I do this with mysql query. I know that there is a query like: SELECT AVG(mark) FROM MyTable WHERE student = 'MyStudent'; But, like I said before, each student may have one or more marks in each module, and in this case, I need to keep the best one for
  4. Thanks boen_robot for your help. Now it's working. But can you tell me where can I add the "WHERE" clause to filter some marks, some modules or some students ?For instance, diplay just marks for the year 2010.Thanks you in advance for your help.
  5. Yes the query failed and mysql tell me : Unknown column 'B211.students' in 'on clause'. Which is true.
  6. Hello; The line 22 correspond to this line :while($row = mysql_fetch_assoc($results)) Here is a copy of my table, if you can test it in your machine.: -- Structure of the table `exam_marks`--CREATE TABLE IF NOT EXISTS `exam_marks` ( `id` int(45) NOT NULL DEFAULT '0', `student` varchar(45) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'the student\'s id', `mark` float NOT NULL COMMENT 'student \'s mark in the exam', `module` varchar(45) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'module of the exam') ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=u
  7. Hello;thanks for your help (boen_robot) Sure, I tested all the versions of code you proposed, but none works. I always got from mysql. In the last version you proposed, I got this error:Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/subuntug/file-test.php on line 22 Thanks again
  8. Hello,I noticed that early, I had already corrected that, but weirdly, nothing changes. Some marks for some students are missing. For instance, the student with the id ='ifattel' has 3 marks in my table, but only one mark is displayed even when I removed the WHERE clause (student='cbota').Thanks again for your help.
  9. Hello; Both solutions proposed by dsonesuk worked, but not properly. Because I got the HTML table, but not all marks are displayed. I got all the marks for the first student, but only some marks from the other students. This is weird ! I don't understand where is the problem. Why some marks are displayed some are not. I tried this too: $students_marks = mysql_query( "SELECT * FROM v_exam_marks"); $num_marks = mysql_num_rows($students_marks); if($num_marks > 0) { while($r = mysql_fetch_assoc($students_marks)) { $modules[$r['student']][$r['module']] = $r['mark']; }
  10. Hello,Thank you for your answer, but it doesn't work for me. I don't get anything from mysql table. In mysql table I have three columns "student" "module" and "mark". It's a view table which contain marks for students in differents exams (modules). Each student have one or several marks in the table.I don't understand where did come m.students column. Mysql tell me that the column m.students doesn't exist.It's easy to display my table in excel, but very difficult to do so dynamically with php.Thanks
  11. That's what I get when I use the for loop. There's no difference. Here's the content of $myArray:Array( [cbota] => Array ( [0] => Array ( [0] => B211 [1] => 16.5 ) [1] => Array ( [0] => C305 [1] => 16.5 ) ) [cmolina] => Array ( [2] => Array ( [0] => B211 [1] => 6 ) [3] => Array ( [0] => C305 [1] => 3 ) [4] => Array ( [0] => D318 [1] => 12.22 ) ) [ifattel] => Array ( [5] => Array ( [0] => B211 [1] => 6 ) [6] => Array ( [0
  12. Hello; I have a Multi-Dimensional Array from mysql table and need to display it as html table. here is the variable holding my array data: $students_marks = mysql_query("SELECT * FROM v_exam_marks); $num_marks = mysql_num_rows($students_marks); for($i=0; $i<$nbr_note; $i++) { $student = mysql_result($students_marks, $i, 'student'); $module = mysql_result($students_marks, $i, 'module'); $mark = mysql_result($students_marks, $i, 'mark'); $myArray[$student][$i] = array($module, $mark); } When I do echo $student. "|". $module. "|". "$mark"."<br />"; I
  13. Thank you so much Synook ! I just got rid of space after the semi colon, and now the problem is solved.Thank you again
  14. That's what I did. I added this line in my environment variable: C:\Program Files\wamp\bin\php\php5.3.1;But it still doesn't work at all ! So, when I type the command echo %path% it shows me this:c:\windows\system32; c:\program files\wamp\bin\php\php5.3.1;So, what's wrong with my path system variable ?Thank you in advance.
  15. Hello;I'm newbie in synfony framwork and PHP development. I use windows cammand line. The problem is: every time I run the command c:/ PHP /somethingthe command line tell me that; PHP is not recognized as internal or external command. So to run PHP I have each time put the full path toward php program in my computer. How can I fix it ?Thank you in advance for your help.
  • Create New...