Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. you are trying to open a file that doesn't exist in the directory. are you sure your file paths are set correctly? also I believe that the file structure in unix based systems are different than windows in that they use a backslash instead of a forward slash, but that could be entirely wrong, and I could have just made that up
  2. what table? where is a table involved in this script? echo both post['month'] and post['year'] and make sure they are populated with the correct data. I just tested this and it worked as indicated on my machine
  3. $getnumber2=date("m/Y",strtotime($_POST['month'].' '.$_POST['year'])); echo $getnumber2; try that, you example didnt really make much sense. you are telling it to convert your string, which may look like march/2009 to the format of a 2 digit representation of a month. the following outputs $getnumber2=date("m/Y",strtotime("March 2009")); echo $getnumber2; 03/2009
  4. Are you asking how to do it, or do you want to know if there are other methods of doing it? Define "better" the logic behind "deffering" javascript is to only load the javascript that doesn't need to be loaded before the page is loaded, thus making rendering time faster. I'm not quite sure what you are asking
  5. function changePic(){ var pic = getPic(); document.getElementById("Visual").style.background = "url("+ pic +")"; return true; } you were just writing the string pic inside the url instead of concatenating the value of the pic variable.
  6. Why would you want to have a user with a constant connection to the database anyways? It would probably be nicer to your servers if they were only connected when they needed to be, and otherwise they were disconnected
  7. make sure you include the page where your class is defined before session_start() also. post the relevant code. also what exactly is your problem? is your class not being transferred between pages, or is it a different problem
  8. ..... ..... // get last ID in 'pictures' table $result = mysql_query("SELECT * FROM pictures ORDER BY ID desc limit 1") or die('order images error'); $row = mysql_fetch_array($result); $newID = $row['ID'] + 1; // insert new image into 'pictures' table $insert = "INSERT INTO pictures (ID, Description, Path) VALUES ($newID, '{$_POST['imageDescription']}', '{$_POST['path']}')"; mysql_query($insert) or die(mysql_error()); // insert record into 'pics_in_albums' table $insert2 = "INSERT INTO pics_in_album (PicID, AlbumID) " . "VALUES ($newID, '{$_POST['albumMenu']}')"; mysql_query($insert2) or die('insert into pics_in_album errors'); header("Location: mypage.php");//this redirects
  9. $time = date("H:i:s"); $newtime = date("H:i:s", strtotime("+15 minute")); echo $time."<br />".$newtime; returns the following (eastern standard time) 16:36:37 16:51:37 that is the time now, 15 minutes from now is that what you want?
  10. you can use array_unique on your array of random numbers. Random number generators will run into duplicate entries at some point, so perhaps randomly generated numbers isn't what you want. also uniqueid() seems to be exactly what you want as people have said.. why dont you use that?
  11. if you are I thought when you said Creating Object, you meant that you were instantiating the object outside of the class. not to mention that I don't see any characters attribute in your character class itself. and if that is inside the character class, than why does the class instantiate objects of itself and store them in a seemingly non-existant class variable? sorry if I misread what you posted, but the little that was posted didn't make much sense in the context it was in. perhaps post what is above or below the Object creation code you posted so I can get a better idea of why you are why that particular snippet is there.
  12. well for one this is the wrong forum but if you want those elements to be hidden by default, you must hide them when the page loads, IE make a function that hides everything, and then in the body tag, for the onload attribute, call that function.
  13. if ($_POST['name']=="") { Print("Please fill in all fields!<br>"); } elseif ($_POST['email']=="") { Print("Please fill in all fields!!<br>"); } elseif ($_POST['comment']=="") { Print("Please fill in all fields!!!<br>"); } else { //do the query here //then output the stuff below echo "Successful"; echo "<BR>"; echo "<a href='viewguestbook.php'>View guestbook</a>"; }
  14. this line $this->characters[] = $character; you only use the this symbol inside the class itself. when you want to call a method of a class you instantiated inside a variable, you use the variable name $character->characters[] = $character; should help you out
  15. you have to exit() after one of the validation ifs or the script will just spit out the error message, but keep running. for example if ($_POST['name']=="") { Print("Please fill in all fields!<br>"); exit(); } you can also have the query execute in the else statement if you dont want to use exit
  16. whats it displaying
  17. perhaps you meant emails.email='$email' in any case you have to wrap varchars with single quotes
  18. you never close the first if's code block if ((isset($_GET['train'])) && ($_GET['train'] == 'test1')) { $display_block = "<h3>Train Your Character To Level Up</h3> <h4>Choose a different <a href=choose_train.php>character</a> to train?</h4> <table cellpadding=3 cellspacing=3> <tr>"; $get_player_info = "select * from training WHERE identity = '$_GET[identity]'"; $get_player_info_res = mysql_query($get_player_info, $conn) or die(mysql_error()); while ($player_info = mysql_fetch_array($get_player_info_res)) { $id = $player_info['id']; $identity = $player_info['identity']; $level = $player_info['level']; $energy = $player_info['energy']; $experience = $player_info['experience']; $update_energy = ($energy - 2); $update_experience = ($experience + 50); $lose_energy = mysql_query("UPDATE training SET energy ='$update_energy' WHERE identity = '$identity'"); $gain_experience = mysql_query("UPDATE training SET experience ='$update_experience' WHERE identity = '$identity'"); $display_block .= " <td valign=top> <form action=train.php> <select name=train> <option>test1</option> <option>test2</option> </select> <input type=submit name=submit value=Train> <input type='hidden' name='identity' value='$identity' /> </form> </td> <td valign=top>Player: $identity<br /> Level: $level<br /> Energy: $energy<br> Current Experience: $experience<br /> Experience To Next Level:<br /> </td> </tr>"; }//end while }//end if elseif ((isset($_GET['train'])) && ($_GET['train'] == 'test2')) { $display_block = "<h3>Train Your Character To Level Up</h3> <h4>Choose a different <a href=choose_train.php>character</a> to train?</h4> <table cellpadding=3 cellspacing=3> <tr>"; $get_player_info = "select * from training WHERE identity = '$_GET[identity]'"; $get_player_info_res = mysql_query($get_player_info, $conn) or die(mysql_error()); while ($player_info = mysql_fetch_array($get_player_info_res)) { $id = $player_info['id']; $identity = $player_info['identity']; $level = $player_info['level']; $energy = $player_info['energy']; $experience = $player_info['experience']; $update_energy = ($energy - 10); $update_experience = ($experience + 100); $lose_energy = mysql_query("UPDATE training SET energy ='$update_energy' WHERE identity = '$identity'"); $gain_experience = mysql_query("UPDATE training SET experience ='$update_experience' WHERE identity = '$identity'"); $display_block .= " <td valign=top> <form action=train.php> <select name=train> <option>test1</option> <option>test2</option> </select> <input type=submit name=submit value=Train> <input type='hidden' name='identity' value='$identity' /> </form> </td> <td valign=top>Player: $identity<br /> Level: $level<br /> Energy: $energy<br> Current Experience: $experience<br /> Experience To Next Level:<br /> </td> </tr>"; } $display_block .= "</table>"; } else { print "Your character did not train."; } ?> see if that helps
  19. curious. thats because of this particular snippet of code from the functin // check for a difference like between one MIN and one HOUR if ( ($difference >= $min) && ($difference < $hour)) $c = 'n'; // check for a difference like between one HOUR and one DAY elseif ( ($difference >= $hour) && ($difference < $day)) $c = 'h'; // check for a difference like between one DAY and one WEEK elseif ( ($difference >= $day) && ($difference < $week)) $c = 'd'; // check for a difference like between one WEEK and one MONTH elseif ( ($difference >= $week) && ($difference < $month)) $c = 'ww'; // check for a difference like between one MONTH and one YEAR elseif ( ($difference >= $month) && ($difference < $year)) $c = 'm'; else $c = 'y'; it seems that all the checks are running false on the first run, and then running fine on the second. I don't really know why it does that, but I can't think of a quick fix off the top of my head. If it works on the second time around but not the first, i'm not sure why it would do that.
  20. Oh ok, that was your only problem then. forget what i was saying after the code then haha. glad I could help
  21. create a hidden field with the value of the identity, than using the get value, assign identity. like $display_block .= " <td valign=top> <form action=train.php> <select name=train> <option>test1</option> <option>test2</option> </select> <input type=submit name=submit value=Train> <input type='hidden' name='id' value='$indentity' /> </form> </td> <td valign=top>Player: $identity<br /> Level: $level<br /> Energy: $energy<br> Current Experience: $experience<br /> Experience To Next Level:<br /> </td> </tr>";
  22. if you don't want all the echos, condense what you are echoing into 1 or 2 lines... but it doesn't matter really...
  23. hmm, well whats happening is that when the function subtracts your input date from the value of time() it returns a negative number. whoever wrote this function didn't do it right I think (well the logic anyways) but try this $times = $class->timeAgo(time(), $date); and see what happens
  24. well firstly, that echo must be inside the option tags, like <option value="2"><?php echo ($_GET['name'] == 2) ? "Selected='selected'" : ""; ?>Lily Clark</option> should be <option value="2" <?php echo ($_GET['name'] == 2) ? "Selected='selected'" : ""; ?>>Lily Clark</option> secondly, I don't really see where that switch gets used for anything... nor the variable $emailTo, or why that forms action is set to contactengine.php.... what page sets the get variable 'name'?
  25. ahh ok this code looks much better. one thing $get_player_info = "select * from training where identity = '$_GET[identity]'"; should be $get_player_info = "select * from training where identity = '".$_GET['identity']."'"; you have to surround associative array keys with single quotes. also in train.php I dont see anywhere where $identity is set before this line $get_player_info = "select * from training WHERE identity = '$identity'"; which needs identity to be set for the query to run correctly
×
×
  • 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.