/    Sign up×
Community /Pin to ProfileBookmark

Javascript HEX map. Text inside hexagon from database.

Hi, I have already got a hex map working in JS and it writes the coordinates into the hexagons.

[CODE] if (isDebug) {
debugText = col + “,” + row;
}

this.drawHex(currentHexX, currentHexY, “#ddd”, debugText);
[/CODE]

What I’m wanting to do is have a MySQL database with the columns, ID, col, row and name. Then instead of having just col and row numbers show inside the hexagons, I would like the name to display from the database if the col + row exist. If no entry with the correct col + row are present in the database then it should just input the col and row numbers as it does now.

Id | Col | Row | Name
1 | 0 | 0 | Bob
2 | 0 | 1 | Fred
3 | 5 | 3 | John

Column 5, Row 3 would display John inside the hexagon. Column 3, Row 5 would display 3,5 inside the hexagon.

Any help in regards to achieving this would be greatly appreciated. My knowledge in JS is quite limited but I do believe it’s not possible to directly interface with MySQL, so I’m stuck.

Cheers

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@rootJul 07.2017 — What you posted doesn't make much sense as much as what you posted for code. I haven't heard of a javascript .drawHex method, so I am guessing that you are using a Library / Framework, those types of questions have their own forum called the JavaScript Frameworks forum (see my signature)
Copy linkTweet thisAlerts:
@king0rauthorJul 07.2017 — Thanks, I've posted there now and hopefully it's clearer.

MOD please remove thread.
×

Success!

Help @king0r spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...