Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. Have you tried dumping the data to see what's in there? var_dump($row4); Put that within the while loop and check there's actually data in there. If not it's likely the query's running successfully but not returning any results. You can check the number of records returned with: echo mysql_num_rows($query4);
  2. ... and the problem is?
  3. Adam

    Date Help

    $days_since = floor((time() - strtotime("04/04/2009"))/(60*60*24)); Just replace "04/04/2009" with the date you pull from the database.
  4. Converting them to HTML entities should work: <input type="text" name="name" value="<?php echo htmlentities($name); ?>">
  5. No, title values aren't passed through the form. You could create a hidden input and pass it through that way, or read the file contents into a variable and use regex to select the title.
  6. Just do the smart thing and put... "You are using an outdated browser, upgrade to a much better one like Firefox or Chrome"
  7. HTML <pre> tags..
  8. Most likely here: $arr[$row['error_text']] = $row['correct_id']; You'll want to replace the data stored within $row['correct_id'] before storing within your array - though I'm totally guessing as you've not supplied much information as to what you're trying to replace. However, as there's no braces {} after the while loop you can only run one statement, which depending how you've done the str_replace()'s may cause a problem. Change it to this to avoid any confusion: while($row = mysql_fetch_array($result)) { $arr[$row['error_text']] = $row['correct_id']; }
  9. Yeah I agree, the text is definitely too plain compared to the background and border. I'd also make that border even width all the way round, looks a bit odd being wider on the sides. By the way the border also breaks in IE7! Border. I have no idea what the purpose of that GIF is but it drags the page down IMO. Glad to see the XHTML validated! The <center> tag is deprecated by the way... Not bad! I like orange...
  10. Pardon me I see now. Replace this: [^.part] With this: (?!\.part)$
  11. That doesn't make sense. But, the regex to match .part on the end of a string/filename would look like: if(!eregi("\.part$", $file)) It's possible there's syntax problems with that regex when used with eregi as I don't use it very much, I personally prefer using preg_match: if (!preg_match('/\.part$/', $file))
  12. What were you searching for?? http://www.w3schools.com/media/media_browsersounds.asp
  13. The default maximum file size for uploads is about 5MB; which is probably the reason why only some are failling. You are using the "MAX_FILE_SIZE" HTML attribute but this isn't always guaranteed to work. Take a look at this; has some suggestions on how to increase your max. file upload size.
  14. Or you could validate on the 'onblur' event. I'd probably just use one of the many custom trim functions/prototypes available online, something like this (found here): <script type="text/javascript"> String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } </script> <input type="text" name="..." onblur="this.value = this.value.trim();" /> You may wish to switch to the 'onkeyup' event if it needs to be validated after every character is input. There's load of other ways you could do it as well...
  15. You can do this easily with PEAR: <?php require_once 'Net/URL.php'; $dirtyurl = 'domain.com/index.php?PHPSESSID=12345&area=home'; $url = new Net_URL($dirtyurl); unset($url->querystring['PHPSESSID']); $cleanurl = $url->getURL(); ?> Although you may want to add "http://" to the start of your URLs to stop PEAR automatically adding the current domain you're on...
  16. Sorry my mistake, I think you are getting the error because $_GET['cid'] and $_GET['pid'] aren't actually set. Try this, which will validate they are set before trying to use them: if (isset($_GET['cid'])) { $cid = (int) $_GET['cid']; } if (isset($_GET['pid'])) { $pid = (int) $_GET['pid']; }
  17. Try using this instead: $cid = (int) $_GET['cid']; $pid = (int) $_GET['pid'];
  18. It's a lot simpler than you might think with the substr_replace() function. Try this: function cleanurl($word, $toclean) { $pos = strpos($word, $toclean); if ($pos !== false) { return substr_replace($word, '', $pos); } return $word; }
  19. After a quick check I realised the regex is wrong, though this seems to work: \b[\d]{15}\b\.ask
  20. You could use the following code to determine they have a valid filename: if (!preg_match('/[\d]{15}\.ask/', $_FILES['input_name']['name'])) { // invalid } else { // valid } Not tested but should work no problems. I'm assuming you know how to do the rest?
  21. The PHP appears to be fine, but the regex probably isn't. What exactly are you trying to do? What errors do you get, or what currently happens when you run the code?
  22. I don't thik he was asking for the HTML side of things...
  23. You want to just change the order round slightly for part of your IF statement: else if($H == 1){ echo "$H hour "; } else if($H > 0){ echo "$H hours "; } Before, $H > 0 would always be matched before $H == 1 as obviously 1 is still more than 0.
  24. If you don't want the user to change the value from "EUF" at all, perhaps you shouldn't be using an input..? If the input's there for some design reasoning, perhaps use the disabled attribute, or, you could use a hidden input and just write the text "EUF" normally?
  25. It's just my personal opinion. No one can tell you what tools someone's used to create a website unless there's some form of mark left. Apart from YUI, I cannot find a reference to any other software or tool on there (in development context). Maybe someone else can. As for suggestions though, I can give you loads. My personal opinion is that you can't beat Photoshop for graphics. GUI editors for HTML/CSS I prefer to stay away from. I write all the code / scripting / programming myself in a simple editor like Notepad++ when using Windows, and with Vim through the CLI on Linux. I don't know what you want tools for though?
×
×
  • 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.