Jump to content

Pentacore

New Members
  • Posts

    5
  • Joined

  • Last visited

Pentacore's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. oh srry i forgot to include this part, the array's exists and is created through PHP $counters; $mysqli = new mysqli($host, $sqluser, $sqlpass, "counters"); foreach (glob("img/champions/*.jpg") as $filename) { if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } $path = $filename; $file = basename($path); $file = basename($path, ".jpg"); $search = "SELECT * FROM counters WHERE `IMG_Name`='".$file."'"; if ($searchresult = mysqli_query($mysqli, $search)) { /* fetch associative array */ while ($row = mysqli_fetch_assoc($searchresult)) { ${$file}["1"] = $row["Counter 1"]; ${$file}["2"] = $row["Counter 2"]; ${$file}["3"] = $row["Counter 3"]; ${$file}["4"] = $row["Counter 4"]; ${$file}["5"] = $row["Counter 5"]; ${$file}["6"] = $row["Counter 1"]; ${$file}["7"] = $row["Counter 2"]; ${$file}["8"] = $row["Counter 3"]; ${$file}["9"] = $row["Counter 4"]; ${$file}["10"] = $row["Counter 5"]; ${$file}["11"] = $row["Good With 1"]; ${$file}["12"] = $row["Good With 2"]; ${$file}["13"] = $row["Good With 3"]; ${$file}["14"] = $row["Good With 4"]; ${$file}["15"] = $row["Good With 5"]; } } echo $file." = ".json_encode(${$file})." ,"; } ?> And an example of an array that gets created: var ahri = {"1":"ryze","2":"fizz","3":"Akali","4":"LeBlanc","5":"Diana","6":"ryze","7":"fizz","8":"Akali","9":"LeBlanc","10":"Diana","11":"Jax","12":"Irelia","13":"Shen","14":"Ezreal","15":"Amumu"}
  2. ya i just read that through.. sorry about that what i mean is i want to get the name of the array that the function use, by using the Fucntion input, is there a way to do that?
  3. so is there any way to fetch what array to fetch the data from in the Function input? this is what i got so far function onHoverCounter( ChampID ) { var show1 = ChampID[1]; $("#"+show1).addClass('counter'); } ChampID is fetched from <a href="?champion=ahri"><div class="champion apcarry mid" id="ahri" onmouseover="onHoverCounter(this.id);" onmouseout="onmouseoutCounter(this.id);"><img src="img/champions/ahri.jpg"> Ahri </div></a>
  4. i apologize if it was hard to understand. So there isnt really much other ways to do it than to simply have all champions as classes at each champion picture? i got a half-done version here: http://pentacore.se/fun/lol/index.php (this doesnt work fully since its not connected to the correct DB) But simply put, when i hover over for example "Ahri" i want like "Fizz" to get a red border around him and "Brand" to get a green one (just examples)
  5. *I wasnt quite sure what forum to put this at, so since im coding in PHP i posted it here* I am currently creating a League of Legends Champion site where i want it to when i hover over a Champion (Character) i want its counters to get a red/green border (depending on if the champion is good against it or the champion itself is good vs it) So i started using the CSS:hover way, but looking at this i cant help but to notice that it will require a whole lot of code, so im kinda wondering if theres another way of doing it with like Jquery or plain javascript (Maybe even a PHP Function?) I got all the counters stored in a Database Built up as following: CREATE TABLE `counters` ( `Name` TEXT NULL, `Counter 1` TEXT NULL, `Counter 2` TEXT NULL, `Counter 3` TEXT NULL, `Counter 4` TEXT NULL, `Counter 5` TEXT NULL, `Counters 1` TEXT NULL, `Counters 2` TEXT NULL, `Counters 3` TEXT NULL, `Counters 4` TEXT NULL, `Counters 5` TEXT NULL, `Good With 1` TEXT NULL, `Good With 2` TEXT NULL, `Good With 3` TEXT NULL, `Good With 4` TEXT NULL, `Good With 5` TEXT NULL ) i already know how to fetch the data and such, so thats not the problem (just included this if it would be usefull in anyway) But ye, to summarize it im asking if theres another way to do it with Javascript/PHP or anything like that, and also if you would be kind enough to give me a hint about how to do that (i dont need you to write the whole code since i enjoy that myself) but simply a hint on how to do it. And also once again i apologize if this is the wrong part of the forum to put it (move it if needed)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.