Skip to main content
2 of 5
added 1 characters in body
mheinzerling
  • 2.7k
  • 14
  • 17

SQL:

This is just a simple join.

SELECT e.Votes, e.Views, e.id, u.username 
FROM election as e, userinfo as u 
WHERE e.ElectionId = u.id WHERE e.ElectionId=? 
ORDER BY e.id ASC

Now you can iterate over all lines and every time e.id is changing you know that you have to display a new group.

PHP:

  • usually classes are starting with a capital letter.
  • usually method are starting with a lower case letter.
  • there is something missing in your output, some echos?
mheinzerling
  • 2.7k
  • 14
  • 17