Jump to content

kernelgpf

Members
  • Posts

    227
  • Joined

  • Last visited

Everything posted by kernelgpf

  1. Here's a working function.. add it into your script. =] function filterbadwords($str){ // words to filter $badwords=array( "â€","–","’"); // replace filtered words with $replacements=array("-"); $words = explode(" ", $str); $out_words = ""; for($i = 0; $i < count($words); $i++){ if(in_array(str_replace(".", "", $words[$i]), $badwords)){ $out_words[] = $replacements[0]; }else{ $out_words[] = $words[$i]; } } return implode(" ", $out_words); }
  2. I'm not sure I understand what you need- could you describe how the link exchange script should work?
  3. Hmm.. okay- what does the "tags" table do that's different from the "store_tags" table?
  4. Mm, I had problems with this awhile back- I found and edited some free code to fit my problem [if a dragon was chose, give breed dropdowns], and I don't have time to edit it to fit your DB, but it'll definitely set you on the right track. =] -Alyssa Feel free to message me with questions. <script name="Javascript"> function setOptions(chosen) { var selbox = document.myform.opttwo; selbox.options.length = 0; if(chosen == " "){ selbox.options[selbox.options.length] = new Option('Please select a creature above',' '); } if (chosen == " " || chosen == "fairies" || chosen == "hippogriffs" || chosen == "unicorns" || chosen == "pegasus") { selbox.options[selbox.options.length] = new Option('Ignore this box',' '); } if (chosen == "dragons") { selbox.options[selbox.options.length] = new Option('fire','fire'); selbox.options[selbox.options.length] = new Option('ice','ice'); selbox.options[selbox.options.length] = new Option('shade','shade'); selbox.options[selbox.options.length] = new Option('water','water'); selbox.options[selbox.options.length] = new Option('air','air'); selbox.options[selbox.options.length] = new Option('earth','earth'); selbox.options[selbox.options.length] = new Option('poison','poison'); selbox.options[selbox.options.length] = new Option('light','light'); } } </script> <form method=post name=myform action=file.php> Species: <select name="optone" size="1" onchange="setOptions(document.myform.optone.options[document.myform.optone.selectedIndex].value);"> <option value=" " selected="selected"> </option> <option value=dragons>dragon</option> <option value=fairies>fairy</option> <option value=hippogriffs>hippogriff</option> <option value=unicorns>unicorn</option> <option value=pegasus>pegasus</option> </select><br /> Breed: <select name="opttwo" size="1"> <option value=" " selected="selected"></option> </select></form>
  5. Try this- is this what you mean? $select_tags_query = mysql_query('SELECT * FROM `tag_category`'); while($tag_category = mysql_fetch_row($select_tags_query)) { $tags_query = mysql_query('SELECT * FROM `tags` WHERE `cat_id` = ' . $tag_category[0] . ''); if(mysql_num_rows($tags_query) == "0"){ continue; } echo '<div class="tag_cat">'; //renders out the category name echo '<h3>' . $tag_category[1] . '</h3>'; //renders out each tag in the category while($tags = mysql_fetch_row($tags_query)) { $tag_used = mysql_query('SELECT * FROM `store_tags` WHERE `tag_id` = ' . $tags[0] . ''); if(mysql_num_rows($tag_used) == 0){ //do nothing }else{ echo '<p class="tag_check"><a href="search.php?tag=' . $tags[0] . '">' . $tags[2] . '</a></p>'; } } echo '</div> <!-- tag_cat div -->'; }
  6. I figured it out- when I switched servers, the $onstatus variable didn't have the backslash in it. =S Thanks for your help though. =]
  7. I didn't paste that part, sorry. I don't have time.. I'll keep messing with it. Thanks for the help anywho.. =S
  8. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #6' at line 1ERROR:Resource id #6 What the heck is "resource ID #6"? O_o
  9. It works that way too. Two percent signs makes it so it searches all user IDs with a "1" in them, while my way only brings up account IDs that START with 1. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #6' at line 1Resource id #6
  10. -nods- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #6' at line 1
  11. Parse error, line 22... the first couple queries you have just the query's guts in the var. $query, but in others, you have the guts and the "mysql_query("");".. which is meant to be?
  12. As an extra helpful note, it's printing out "<a href='userprofiles.php?id='></a>".. no variables. =[
  13. Doesn't work either, darkfreaks. And Colin- it's getting there, I've printed some stuff out.
  14. Here's my entire script- it's worked previously, and is suddenly not working.. no errors, nothing being printed. That's the problem. <?php include "header.php"; print "Searching usernames is searching all player's BASIC names, not their display names.<p>"; if($_GET['action'] == "search"){ $name=$_POST['username']; $idnumber=$_POST['idnumber']; $acctkind=$_POST['acctkind']; $onstatus=$_POST['onstatus']; if($acctkind == "Premium"){ $acctkind=1; } if($acctkind == "normal"){ $acctkind=0; } if($acctkind == "Doesn\'t Matter"){ $acctkind=""; } if($onstatus == "Doesn\'t Matter"){ $query=mysql_query("select displayname,id from users where basicname LIKE '$name%' AND id LIKE '$idnumber%' AND acctkind LIKE '$acctkind%' ORDER BY id ASC")or die(mysql_error()); } if($onstatus == "Online"){ $query=mysql_query("select displayname,id from users where basicname LIKE '$name%' AND id LIKE '$idnumber%' AND acctkind LIKE '$acctkind%' AND lli > (NOW() - INTERVAL 2 MINUTE)")or die(mysql_error()); } if($onstatus == "Offline"){ $query=mysql_query("select displayname,id from users where basicname LIKE '$name%' AND id LIKE '$idnumber%' AND acctkind LIKE '$acctkind%' AND lli < (NOW() - INTERVAL 2 MINUTE)")or die(mysql_error()); } $num=mysql_num_rows($query); if($num == "0"){ print "No matches to your search query."; include "footer.php"; exit; } while($thing=mysql_fetch_array($query)){ print "<a href='userprofiles.php?id=$thing[id]'>$thing[displayname]</a><br>"; } include "footer.php"; exit; } ?> <form method=post action=searchusers.php?action=search> Username: <input type=text name=username><br> Player ID#: <input type=text name=idnumber><br> Account Type: <select name=acctkind> <option>Doesn't Matter</option> <option>Premium</option> <option>normal</option></select><br> Online/Offline: <select name=onstatus> <option>Doesn't Matter</option> <option>Online</option> <option>Offline</option> </select><br> <input type=submit name=submit value='Search Users'> </form> <?php include "footer.php"; ?>
  15. I did that, and it's what gave me "33019.54444" hours, or something. What column type should I change the column to? It's "timestamp" right now, and I don't see a UNIX option.
  16. ...now I'm confused. =/ What exactly do I need to do to fix it, then? Thanks alot for your help. =]
  17. I don't understand unix timestamps.. I'll have to look at that when I get a chance. I tried your code, and the result I got was "331009.52944444"... I can round it, but the timestamp in the DB for "$row[datetillcompletion]" is "2007-10-06 10:00:00"... that isn't right. Any other suggestions?
  18. Oh.. wait. I thought you were asking something else. Sorry, dunno how to do that. Good luck finding it, though. =P
  19. After you submit the form, set a variable with the information in each, and below in the form fields, add something similar to this: <form method=post action=school.php> Title: <input type=text name=title <?php if($titlepassed != ''){ print " value=$title"; } ?> > But for each field. Just test if it's already been submitted, if so, add the "value" part, and it'll fill in the text boxes.
  20. Oh.. well, how do I feed the "$row[datetillcompletion]" into it? Sorry- I'm still learning PHP time code.. it confuses me. =[
  21. The DB row "datetillcompletion" is a timestamp, and it's being inserted 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.