Jump to content

djfox

Members
  • Posts

    327
  • Joined

  • Last visited

    Never

Everything posted by djfox

  1. I had looked at those and read through the comments on those pages but could not see any way that those could be used in editing the colour of the image. They all talked about greyscaling, resizing and flipping, not recolouring. For the image, here is the image:
  2. All right, am I to assume that there is another way to accomplish a similar task in saving myself from creating millions of images?
  3. I`ve seen another site that does this so I know it can be done, I just don`t know how and I want to use a similar thing for my site. How would someone use php to change the colour of an image? Details: My new system I`d like to put in uses virtual pets. The virtual pets can be of different colours via RBG code (ie, 255|000|000) which will be different for each pet. However, I do not want to create an image for each and every colour, it`s just not possible, especially when there will be a similar system for different eye colours, body colours, secondary body colour, and halo colour. There are no basic shapes (ie, squares, rectangles, etc). These are oblong shapes. I just want the code to change the colour of the image that I input. The image will be a flat colour, with a transparent background (one image for eyes, one image for body, one image for halo, etc). How can I accomplish this via PHP and not make 16777216 images for each element to get the different colours?
  4. I`m building this browser php based game on my website. Characters will be continuously added on and the user can choose which character they want to work with at any given time (like they will "unlock" characters and will have access to all of them). A function I`d like to have setup is that user can have their unlocked characters interact with one another (by either giving gifts or asking questions, etc) and how the interaction goes will determine whether or not one character likes the other and how much they like/dislike the other character would determine what the response is and based on which character (aka, different personalities). What would be the simplest and easiest way to code for this? I already have a form set where the user would select which two characters would interact with one another, and I have a field in the database for each character to record their like value for the other characters.
  5. Wait, wait, I got it. <?php $pieces = explode(",", $pokemon[1]); foreach ($pieces as $evo) { $res3b = mysql_query("SELECT id, name FROM pokedex WHERE name='$evo'"); $e2 = mysql_fetch_row($res3b); mysql_free_result($res3b); if ($e2[1]) { echo "<input type='radio' name='ev' value='$e2[0]'> $e2[1] <br>"; } ?> I should`ve seen this sooner. XD This works for both single choices and multiple choices.
  6. No one has any idea, huh? XD It is a bit of a stumper.
  7. <?php $res = mysql_query("SELECT id, species, level FROM pokemon_owned WHERE id='$p'"); $poke = mysql_fetch_row($res); mysql_free_result($res); $res2 = mysql_query("SELECT id, evolve_next, evolve_level, name FROM pokedex WHERE id='$poke[1]'"); $pokemon = mysql_fetch_row($res2); mysql_free_result($res2); $res3 = mysql_query("SELECT id, name FROM pokedex WHERE name='$pokemon[1]'"); $e = mysql_fetch_row($res3); mysql_free_result($res3); echo "You can evolve your pokemon into a different pokemon in which it could gain new strengths. However, this cannot be undone."; echo " Make certain that you are absolutely sure that you want to evolve this pokemon before clicking the button below. If you"; echo " would to know what kind of pokemon yours will change into from evolving, you can view the pokedex. If your"; echo " pokemon is not a high enough level to evolve, you will see what level your pokemon needs to be before it can evolve.<p>"; if ($pokemon[1]) { if ($poke[2] >= $pokemon[2]) { echo "You can evolve your $pokemon[3] into $e[1]. Click the button below to evolve it."; echo "<form action='evolve.php' method='post'>"; echo "<input type='hidden' name='pok' value='$p'><input type='hidden' name='ev' value='$e[0]'>"; echo "<p><input type='image' src='$butnext' name='submit'></form>"; } else { echo "Your pokemon is not a high enough level. Your pokemon must be at level $pokemon[2] before it can evolve."; } } elseif (!$pokemon[1]) { echo "This pokemon does not evolve."; } ?> This is how it is currently, where right now it only works if the pokemon has just one form to evolve into (it does not work for multiple forms). (Example - It will work for Pikachu because Pikachu`s only choice is Raichu. But it won`t work for Eevee because has 7 forms to choose from.)
  8. You sure? What this is addressing is the evolution stages that the pokemon would take place. Some pokemon have multiple others they can evolve into while others have just one. I can do one where it`s just the single choice, but the multiple choices I can`t figure out how to work it into a simple not-spend-a-year-coding-for-it code because there are so many of them.
  9. Wouldn`t this mean I would have to make several $pokemon statements for it to check for each and every pokemon name that might be in the list? That would be extremely time consuming to setup, not to mention make the file huge since we`re looking at over 550 names to work with. isn`t there a tweaking to that code we could do to remove the massive workload?
  10. Let`s say I have: $res2 = mysql_query("SELECT id, evolve_next, evolve_level, name FROM pokedex WHERE id='$poke[1]'"); $pokemon = mysql_fetch_row($res2); mysql_free_result($res2); And I want PHP to check to see if , exists in $pokemon[1]. If it does, do one thing. If not, do something else. If it does exist, how it could separate the elements that are between the commas (there may just one or more than one comma) and have an option for each of those. Example: If $pokemon[1] has "Vaporeon,Jolteon,Flareon", then be like: Vaporeon: Do whatever Jolteon: Do whatever else Flareon: Do something different or if $pokemon[1] has "Pikachu", then do other stuff. How could this be accomplished?
  11. Oh my lord, I should`ve known that from the time using desc was an issue with the database. x.x Glad you picked up on that. It seems to have gotten this thing to work. I`m so glad, been fighting with it for hours.
  12. Now we get: ID NUMBER: 6 --- QUERY: UPDATE `beloved_sonic_charac` SET `like`=like+1 WHERE `id`='6'; ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'like+1 WHERE `id`='6'' at line 1UPDATE `beloved_sonic_charac` SET `like`=like+1 WHERE `id`='6'; (I used the same two items I tested last time with.)
  13. We want to add 1 to the items that are checked. The results of the echo: ID NUMBER: 6 --- QUERY: UPDATE `beloved_sonic_charac` SET `like`='(beloved_sonic_charac.like + 1)' WHERE `id`='6'; ID NUMBER: 1 --- QUERY: UPDATE `beloved_sonic_charac` SET `like`='(beloved_sonic_charac.like + 1)' WHERE `id`='1'; So the id numbers are going through fine. (I only chose two for this test.)
  14. I`m not sure if I got it all understood. It still doesn`t want to add the 1 to the field for the items that are checked off. Am I to do something with the KEY => VALUE code you entered?
  15. Ok, we`re getting closer. Now we just need to get it to add 1 to whatever value is already in the database.
  16. Ok, I get this error: Parse error: syntax error, unexpected T_VARIABLE in /home/secrett1/public_html/beloveddoll/sth_poll_1_vote.php on line 46 Which is this: foreach($_POST['POLL'] As $PollItem=>$PollValue){ mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='$PollValue' LIMIT 1'); } Which is odd because I use the same updating code for a different part of the site and it works fine.
  17. <?php if (isset($_POST['1'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='1' LIMIT 1'); } if (isset($_POST['2'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='2' LIMIT 1'); } if (isset($_POST['3'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='3' LIMIT 1'); } if (isset($_POST['5'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='5' LIMIT 1'); } if (isset($_POST['6'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='6' LIMIT 1'); } if (isset($_POST['7'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='7' LIMIT 1'); } if (isset($_POST['8'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='8' LIMIT 1'); } if (isset($_POST['9'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='9' LIMIT 1'); } if (isset($_POST['10'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='10' LIMIT 1'); } if (isset($_POST['11'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='11' LIMIT 1'); } if (isset($_POST['12'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='12' LIMIT 1'); } if (isset($_POST['13'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='13' LIMIT 1'); } if (isset($_POST['14'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='14' LIMIT 1'); } if (isset($_POST['15'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='15' LIMIT 1'); } if (isset($_POST['16'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='16' LIMIT 1'); } if (isset($_POST['17'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='17' LIMIT 1'); } if (isset($_POST['18'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='18' LIMIT 1'); } if (isset($_POST['19'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='19' LIMIT 1'); } if (isset($_POST['20'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='20' LIMIT 1'); } if (isset($_POST['21'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='21' LIMIT 1'); } if (isset($_POST['22'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='22' LIMIT 1'); } if (isset($_POST['23'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='23' LIMIT 1'); } if (isset($_POST['24'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='24' LIMIT 1'); } if (isset($_POST['25'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='25' LIMIT 1'); } if (isset($_POST['26'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='26' LIMIT 1'); } if (isset($_POST['27'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='27' LIMIT 1'); } if (isset($_POST['28'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='28' LIMIT 1'); } if (isset($_POST['29'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='29' LIMIT 1'); } if (isset($_POST['30'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='30' LIMIT 1'); } if (isset($_POST['31'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='31' LIMIT 1'); } if (isset($_POST['32'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='32' LIMIT 1'); } mysql_close($con); header("Location: sth_polls.php"); ?>
  18. I want check because that way people can select more than one option (I`m sure I said that in the first post). The form does work, it`s the resulting page that grabs the information from the form that is being the problem.
  19. It`s not the form itself I`m having a problem with, it`s the page that the form submits the info to. I can`t get the code to pick up the submitted info unless I do something like this: if (isset($_POST['1'])) { mysql_query('UPDATE `secrett1_artgallery`.`beloved_sonic_charac` SET `like` = like +1 WHERE `beloved_sonic_charac`.`id` ='1' LIMIT 1'); } for each and every single entry in the database. This is not efficient or practical, and a pain to deal with later as more stuff gets added to the database. I`ve been trying many different ways to get it to go on it`s own so I don`t have to hand enter stuff like that but nothing is working.
  20. I updated the one line to echo "<input type='checkbox' name='$chara[0]' value='$chara[0]'> $chara[1] <br>"; But I still need some way where the resulting page could grab the information sent from the form.
  21. I have a sort of survey-ish poll created using database entries. Here`s the code: <form action="sth_poll_1_vote.php" method="post"> <?php $recentchara = 0; $reschara = mysql_query("SELECT id, nme, approv FROM beloved_sonic_charac WHERE approv='1' ORDER BY nme ASC")or die( mysql_error() ); while( ($chara = mysql_fetch_row($reschara)) && $recentchara < 100 ){ $recentchara = $recentchara + 1; echo "<input type='checkbox' name='$chara[0]'> $chara[1] <br>"; } ?> <p> <input type="submit" value="Cast Your Vote" name="submit"> </form> Here`s a link if you want to see the end result of the forum: http://secrettrance.net/beloveddoll/sth_poll_1.php How would I get the code to process the entries (because there would be more than one being sent) so that a vote could be added to the table for each entry that is voted for?
  22. I guess pop-up is the wrong term. x.x Alert box?
×
×
  • 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.