Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. A quick and dirty test on my server, 100,000 tests of each: for($i=0;$i<100000;$i++) $x = str_replace(' x ','', $string); And for($i=0;$i<100000;$i++) $x = preg_replace('~ x ~','', $string); Showed 0.157774925232 seconds and 0.217579841614 seconds, respectively. Tried about 10 times, about the same results each time.
  2. I think someone (*caugh*Maq*cough*) is just jealous they aren't a top 10 poster. As the others said, it's better to use str_replace, it's going to be a bit faster since it doesnt have to parse the regex
  3. I'm going to guess and say you want the w3 validators? I use the web developer add-on for firefox that allows for "local css/html validation" https://addons.mozilla.org/en-US/firefox/addon/60
  4. It is not possible to get the mac address.
  5. No matter what the OP does there will be a work around, as with well, pretty much everything in the programming world it seems. Cookies - you can clear them Sessions - destroyed when the browser closes IP - Dynamic IPs etc
  6. You can use cookies
  7. from is a reserved keyword, you'll need to enclose it with backticks. $sql = "INSERT INTO testimonials (testimonials, from) VALUES ($testimonials, $from)"; should be: $sql = "INSERT INTO `testimonials` (`testimonials`, `from`) VALUES ('$testimonials', '$from')";
  8. Try running your query like: SELECT `id`, `username`, COUNT(*) as count FROM `online` GROUP BY `username` <?php $result = mysql_query("SELECT `id`, `username`, COUNT(*) as count FROM `online` WHERE GROUP BY `username`")or die(mysql_error()); while($row = mysql_fetch_array($result)){ $distanceInSeconds = round(abs($row['timeout'] - time())); $distanceInMinutes = round($distanceInSeconds / 60); if ( $distanceInMinutes <= 15 ) { if ( $row['username'] == 'Guest' ) { echo '<li class="link"><a href="#">Guest ('.$row['count'].')</a></li>'; } if ( $row['username'] != 'Guest' ) { echo '<li class="link"><a href="?page=profile&id=' . $row['id'] . '">' . $row['username'] . '</a></li>'; } } } ?> Also, I would consider checking the time in the query instead outside in PHP. You'll get less results and won't have to check them all for times, which result in a faster operation
  9. Change: echo "did not INSERT"; to: echo "did not INSERT", mysql_error();
  10. That sounds like its pretty server intensive. May I ask why you want to do that?
  11. echo date('n/j/Y', strtotime('2009-02-25 00:29:55'));
  12. Offtopic: Isn't it against ICANN rules to do that though? I thought it was against the rules to hold a domain to resell at a higher value. I know people do it all the time, but I thought I read somewhere it was a no-no. (Found it: here - but it is only against trademarks and such) I think: dontationcrew.com
  13. Did you try: foreach($hparts as $key=>$value) { $_SESSION[$key] = $value; } <?php session_start(); $username = $_POST["username"]; $hiscores = file_get_contents('http://hiscore.runescape.com/index_lite.ws?player=' . $username); $hparts = explode(',', $hiscores); // Max $hparts should be 82 (0 is first) foreach($hparts as $key=>$value) { $_SESSION[$key] = $value; } echo $_SESSION[1]; echo '<script type="text/javascript">'; echo 'window.location="hiscores_out.php";'; echo '</script>'; ?>
  14. You can pass them as arguments in the PHP file. Here's a good example: http://web.jaypedia.com/web/cron/how-to-pass-php-cron-job-parameters-arguments-or-variables.htm
  15. //... session start at top foreach($hparts as $key=>$value) { $_SESSION[$key] = $value; } print_r($_SESSION); // just to print what was placed in session
  16. Hmm... Try: $net = $facebook->api_client->fql_query("SELECT affiliations FROM user WHERE uid ='$id' "); $network = array(); $network = $net[0]['affiliations']; foreach($network as $info){
  17. Or... dirname(__FILE__);
  18. Have you thought about using SimpleXML - good for smaller files Otherwise... take a look at http://www.codehelp.co.uk/php/xmlparse1.php
  19. Well, if it is redirecting it means: if(siteStat() == "Basketball" && $basketReg == 0) is failing A few things I would do. Check to see if those variables are coming out to what they should - if not (which they aren't) find the source. Also, add in error_reporting(E_ALL); to the top of the script to see if something is causing a warning/error.
  20. Are you using the variable $network anywhere else in the script?
  21. $contentmarker = array('$para1exploded', '$para2exploded', '$para3exploded', '$para4exploded'); Single quotes do not execute variables and such. $contentmarker = array($para1exploded, $para2exploded, $para3exploded, $para4exploded); or $contentmarker = array("$para1exploded", "$para2exploded", "$para3exploded", "$para4exploded");
  22. It most likely means you're missing a } before the end of your script. Proper indenting would make it easier to spot this
  23. Yeah, well it really won't do anything except take an hour away from me being on the computer. I understand the seriousness of the situation, but what's the point of me thinking about this? What can I do? I'm not an engineer. Turn off stuff you don't need, open a window from time to time instead of running the AC, blah blah blah
  24. Well, it fixed your PHP error - now we have to look at your MySQL error. After this line: $sql .= ") GROUP BY title, summary, uploadBy ORDER BY occurrences DESC"; put: echo $sql; and copy/paste what you see.
  25. Missing a semicolon on that first line
×
×
  • 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.