Skip to content
Advertisement

How to display each row from sql in a table in php

I have a table within a modal. I want the table to display the top 3 goalscorers from a football game. The following code is not returning the table. Any help greatly appreciated!. At present I am trying to echo the table within the php tags but I am not sure if this is the best way to do this I took this approach as I am expecting three rows to be returned from the database.

Advertisement

Answer

Noticed you define $goalsresult to store the result set from your mysql_query call and think you’d want to pass that instead of $result – unless $result is something you have defined elsewhere and are using intentionally.

Here’s an example with your code:

Hope this gets you what you need.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement