Skip to content
Advertisement

Positioning of arrays

Is it possible to position an array value depending on a specific numerical array? I have this table:

JavaScript

and this is what I have so far: https://shizen.hakumei.org/test.php

It shows only User7’s name and image link where I plan to show box 01 for User1’s name and image link then box 16 for User2’s name and image link. So basically like:

JavaScript

This is the code I currently have to display the table from the given link:

JavaScript

Many thanks in advance! If it’s not possible or if there’s any better way to do it, I’m open to ideas as well. 🙂

Advertisement

Answer

A tip: You don’t pay rent for space in your code, so you should use it for better scanability.

I have put your usernames and your images in a key based array, so you can just look up, if that key is existing, if not you don’t need a username or an image. Problem here is your storing in the table, that you use numbers with 0 at the begin.

You should also think about this: Delete the columns card, images, donator and put all values in a different table for example:

deck: prejoin, card_id: 16, user: 17, image: img12.jpg

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