Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. You could still use isset on the $_POST variables. if ($_POST['itemDescription'] AND $_POST['itemPrice'] AND $_POST['winningBidder'] AND $_POST['itemQty']) Could be: if (isset($_POST['itemDescription'], $_POST['itemPrice'], $_POST['winningBidder'], $_POST['itemQty'])) Optimally you shouldn't define all the variables at the top if you're not going to be using them every time the script runs. You should have them defined within the if statements that determine if they're going to be needed or not.
  2. For all your variables coming from outsides sources that are not guaranteed to be set, yes.
  3. When using it to the set the value of variables like this: $logUser= isset($_POST['logUser']) ? $_POST['logUser'] : ''; You wouldn't use multiple conditions. The purpose of that is to set $logUser to $_POST['logUser'] if it's set, otherwise set it equal to an empty string, ''. For using isset in other contexts it does support multiple parameters and returns true if they're all set. if(isset($_POST['something'], $_POST['somethingelse'])) { // ... }
  4. $row[] = "value"; Would add an element to the end of the $row array with the value of "value".
  5. You need to check if the variable is set or not before you use it using isset.
  6. Did you fix that HTML error I pointed out? If you're using multiple forms and all of those variables won't always be set than you'll always get those errors with your current code. You should be doing something like this for all your variables: $logUser= isset($_POST['logUser']) ? $_POST['logUser'] : ''; This probably isn't related to your current problem, but it is an issue with your code: $_SESSION['itemDescription']='$itemDescription'; That will set $_SESSION['itemDescription'] to th literal string '$itemDescription' and not the value that the variable holds. Instead it should be: $_SESSION['itemDescription'] = $itemDescription;
  7. Is that the right form? There's no field named deleteBidder on that form. This isn't valid either: <input type="submit" name="submit" value= "Save & Cont." " />
  8. Are you sure you're trying it with the exact example you provided us? Because it works for me. Note that you have a space on this line: <blockquote class="postcontent restore "> Within the class. You probably want to remove that from both the HTML and the pattern.
  9. You're close, you just need to add the m modifier to make the dot match newlines. /<blockquote class=\"postcontent restore \">(.*?)<\/blockquote>/m
  10. This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=308636.0
  11. You have an error in your PHP file. You're missing a ' on the second line. Try this: <?php if(isset($_GET['pid'])) { $pid = $_GET['pid']; } echo 'You wanted to show a PID of: '. $pid; ?> By the way, you're probably going to want the change the logic in that code, it's pretty flawed. The purpose of isset is to be able to check if a variable is set without having an undefined variable notice thrown, but in your case if $_GET['pid'] isn't set than $pid won't be set and you'll get an undefined variable notice for that.
  12. Having no defined constructor is the same as having an empty constructor. public function __construct() { } These objects obviously don't require anything to be done upon instantiation.
  13. Saying "it contains errors" isn't particularly useful to anyone trying to help you. What errors specifically, are you getting?
  14. What you're looking for is a wysiwyg editor. Here's a good one: http://tinymce.moxiecode.com/
  15. Yeah, that's what I meant, sorry.
  16. That's not adding 199 every loop, that's adding 200. for($i = 200, $x = 399;$x >= 1400;$i += 200, $x += 200) { }
  17. Not according to what he wants, in the first post he said he wants all 10 maps to be unique.
  18. Is there any particular reason you're attempting to import the SQL file this way as opposed to the more suitable method of utilizing a MySQL administration tool?
  19. The length's of the individual maps isn't being compared. The length of the array of maps is. For example say your array looks like this: array(1, 2, 3, 4); When you perform array_unique on it the result will still look like this: array(1, 2, 3, 4); Because there are no duplicates. But if we had an array like this: array(1, 1, 2, 3); The result from array_unique would look like this: array(1, 2, 3); The duplicates were removed and we can tell that there was a duplicate because the size of the array that we input is different from the size of the array that was output (meaning duplicates were stripped).
  20. Strings need quotes around them. This should work (assuming chatname is a string and number is numeric): setInterval("read_chat('" + chatname + "'," + number + ")", 500); [/code]
  21. You can create an array containing all the values of $_POST['mapx'], perform array_unique on the array and compare the length of the original array to the one returned by array_unique. If they are the same length then there were no duplicates, otherwise there were. $arr = array( $_POST['map1'], $_POST['map2'], ... ); if(sizeof($arr) != sizeof(array_unique($arr))) { // There was duplicates }
  22. This is no longer a PHP Coding problem so instead you should head over to this forum and create a topic about your problem describing what you've attempted to do and the errors you're receiving.
  23. I still have a game cube and tons of games for it, but I haven't touched it in a while. I got it about 7-8 years ago and loved it when it was new.
×
×
  • 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.