Hello everyone,

Im new at this site, and I hope I can get some help for my assignment.

I have been asked to do the following:
Build a pyramid using PHP and MySQL and depends on how many rows. For now I have made the following in my mysql:

- id (unique ID)
- position (a number that grows higher for every new data)

Lets say I put 6 data in the MySQL then I would like the pyramid to look like this:


And if I add a new row:


And lets make another one:


And so on... The data with highest "position" will always be on top. I have looked for answers making a for loop, but I simply can't figure this out :/

Anyone that can help me? Would really appreciate it! Thanks in advance

We generally expect some work on your part to develop some code. If it's a programming course, then it makes sense that you would do the programming (and design) before you come here to ask a specific question. In this case you have basically defined a user requirement. Now you need to define how you are going to store it in the database (e.g. are you just storing the numbers or will you store a row or position for each number) and how you are going to generate the pyramid based on the number of rows that you need. If someone else were to hand you some code to create the pyramid, would you really deserve to get a passing mark for the assignment? I think that would normally be called cheating. You need to put some time in to do the work. If you aren't that comfortable with PHP syntax yet, then start with some pseudo-code to figure out the logic and then go from there.