Jump to content

Selacius

Members
  • Posts

    134
  • Joined

  • Last visited

Posts posted by Selacius

  1. I am trying to figure out the best way to save my RPG object data in AS3. I would preferrably like it to be sent to a server and saved in a db, however I am struggling with how to send all of my data across to PHP. The objects are quite lengthy and have nested objects within them as well. Any suggestions would be greatly appreciated.

  2. I don't think its the code itself because it correctly displays the pop-up window, and withholds the text from being displayed until the proper selection is made. The code itself works exactly as I would like, but the problem is in the mysql_query updating the database regardless of the user's selection.

  3. With those changes, will it make it so that I only update the database when the player accepts the quest? Because it has no problem modifying the database, its just the fact that it does so regardless of the users selection.

  4. I am using the script which pops up a confirmation box to allow my users to select which quests they would like to partake in. Depending on what button is pressed, the user will either accept the quest, or decline it. If the user accepts the quest then I must modify the database with some new values to reflect the user accepting the quest. This doesn't work though because the values get updated in the database regardless of whether the user actually accepts the or declines the quest although the code for the mysql_query is found in the if ( confirm("Text Here") ) { portion of the script. This is how I have setup the confirmation script to work with the mysql_query, maybe I am somehow doing it wrong.

    <script>if ( confirm("Conditional Question To Start Quest") ) {document.write ("Comment about accepting quest.");document.write ("<font color=black><?=mysql_db_query ("$dbx", "UPDATE **** SET `*` = '*' WHERE * = '*'"); ?></font>");}else {document.write ("Comment about declining quest.");}</script>

    Now I have to use the font color command in the query because it will display a value of 1 which looks pretty unsightly. I'm sure that there is more likely a way to do this with AJAX but I am still trying to learn javascript. If someone could make me a script which will have the confirmation box, areas to modify for text depending on the action the user has taken and also the ability to properly modify the db when the quest is accepted, it would be much appreciated. Or at least show me how I would go about doing so.

  5. Ummm. In the members table in your database, do you have a column with the title delbox? Thats your first mistake, your asking the query to delete all rows where the column (delbox) is equal to 1, which has nothing to do with your checkboxes. My suggestion is to give each checkbox a dynamic name. Your already using a for loop which increments $i each time, well why not combine that with the name delbox and that will be your dynamic checkbox name. Then when you pass the form, also pass the max number of rows in your query, then on the action page have another for loop which goes from 0 to the max rows again. Then, all you do is if ($delbox.$i == "On") { $sql -> DELETE....}else { do nothing}THat would be the best way. Also, checkboxes as you have seen in my If statement, don't return a 0 or 1, but an on or off.

  6. Although While loops can do what your looking for, I believe it would be much easier for you to use for loops. It would lower the amount of coding you need to do.This is a for loop:for ($i=0;$i<$numsys;$i++) {content}Now the 0 should be replaced with your lower limit, its the value where $i will start the loop at.

  7. Fix this:$query = "INSERT INTO `members` VALUE ( NULL,".$name."NULL".$pwd.");Should be: $query = "INSERT INTO members VALUE (NULL, $name, NULL, $pwd)";That should work. Also, for this:echo "Thank you for registering echo ".$name."! Your account has been created. Please go back and log in.";You can make it just this:echo "Thank you for registering $name! Your account has been created. Please go back and log in.";No need for the second echo.

  8. Im assuming that since your posting this in the php forum, that your form is based inside a php page. If so, then the answer has two possibilities. a) You can insert the date on the form side of the page, or:) Insert the date on the submitted side of the form (page that the form sends you to).Either way the code will look like this:$today = date("Ymd"); Which will output it like 20060405If you want to add slashes to it you can do:$today = date("Y/m/d"); Now if you are going to put it on the form page then all you do is this:<INPUT name=startdate value=$today type=hidden> Assuming your form is in the <? ?>, but if its not then it will look like this:<INPUT name=startdate value=<?=$today;?> type=hidden>

  9. I do have cPanel, but I am setting up an auction house for my game. SO whenever a user posts a new item to be auctioned, I want it to create a cron job that expires in the time designated by the user.

  10. Just do I query to select from the database before hand with the name of the table your looking for. Then also do an if statement to see if its valid.The code:$result = mysql_query("SELECT * FROM <database>");if (!$result) {echo "Table doesn't exist";}else {echo "Table Exists already";}

×
×
  • Create New...