Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. Is the file in the same directory as the counter.txt?
  2. Try this: <?php while ($row = mysql_fetch_assoc($selectbadwords)){ $badwords[] = $row["filter_word"]; $replacements[] = $row["filter_replace"]; } foreach ($badwords AS $k=>$badword){ $str = str_replace($badword, $replacements[$k], $str); } echo $str; ?> I also changed the variable names to make more sense - an array is plural so it should be $badwords, not the other way round
  3. Yeah is there a reason you need to specify what bad word it was?
  4. You're replacing the string with a larger string that contains it. You'd have to replace it with something that doesn't contain itself. So replace [crap] with [was c_r_a_p] or something.
  5. Then you need to clean up your javascript, honestly. If your javascript files are so big that it slows down the site, you need to move all of your JS into one file, and possibly even compress it. The mootools framework is a very light one which is really great, so I think it could help with all your JS.
  6. You'll need to use a regular expression, likely. Or you can check if the first substring is http:// then just go to the next /, and that is http://www.domain.com/ If it's not, it's just www.domain.com
  7. SELECT * FROM table WHERE field LIKE ('begins'%);
  8. If by take-away you mean subtraction... $newStatp = $row['statp']-($_POST['str'] + $_POST['int'] + $_POST['con'] + $_POST['dex'])
  9. I third 7-zip, I love it.
  10. In addition, you could also use a switch or an array //Switch switch($row['vehicle']){ case 'ACR': print 'Acura'; break; default: break; } //Array $makes = array('ACR'=>'Acura', 'TOY'=>'Toyota'); print $makes[$row['vehicle']]; I prefer the array out of the three.
  11. Do you want to change the actual database, or just when it prints out?
  12. Maybe you need to simplify it and get it to work with the basics, then add more complex stuff. <?php session_start(); if(isset($_GET['x'])){ print 'GET x is set!'; } if(isset($_SESSION['x'])){ print 'SESSION x is set'; } $_SESSION['x'] = 'foo'; print '<a href="'.$_SERVER['PHP_SELF'].'">Refresh!</a>';
  13. That's similar to what I was suggesting, and I had a reason why it wouldn't work. But now I forgot.
  14. "and i see a few "else if" in your code, its elseif <<< no space, js has the space" PHP works fine with else if. http://us2.php.net/else%20if There may be several elseifs within the same if statement. The first elseif expression (if any) that evaluates to TRUE would be executed. In PHP, you can also write 'else if' (in two words) and the behavior would be identical to the one of 'elseif' (in a single word). The syntactic meaning is slightly different (if you're familiar with C, this is the same behavior) but the bottom line is that both would result in exactly the same behavior.
  15. $current = strtoupper($row['vehicle']); You need to use 'quotes' around your array keys which are strings like you did here, on the rest of them, like $row[disp]
  16. There is a lot of code there which doesn't seem relevant. Where did you incorporate what I posted?
  17. before you start: $date = ''; then in the loop get the date. $newDate = (date from db); if($newDate != $date){ print $newDate; $date = $newDate; }
  18. You didn't actually answer my question - and in the future when you post code use the code tags.
  19. You probably don't have PHP 3. Everyone's moved up to 4.1 at least, and many hosts are offering 5. If you installed it on your own computer, you should know what version you installed.
  20. You can leave out all the null columns.
×
×
  • 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.