Jump to content

taith

Members
  • Posts

    1,514
  • Joined

  • Last visited

Everything posted by taith

  1. here you be <? function filter_charlimit($string, $length="50"){ if(strlen($string)<$length) return $string; else return trim(substr($string, 0, $length)).'...'; } echo filter_charlimit($row[text],200); ?>
  2. a) distinct also should use group by b) you need to "distinct(name), news"
  3. i made this a while ago... maybe ya can find it useful to look at... $query=db_query("SELECT * FROM `categories` WHERE `sub`='' ORDER BY `name`"); $categories=array(); while($row=mysql_fetch_array($query)){ if(!empty($row[secure])) if(!secure($row[secure])) continue; if($_GET[cat]==$row[id]){ $categories[]='<a href="?op=products&cat='.$row[id].'" class=title>'.ucwords($row[name]); $query2=db_query("SELECT * FROM `categories` WHERE `sub`='$row[id]' ORDER BY `name`"); while($row2=mysql_fetch_array($query2)){ if(!empty($row2[secure])) if(!secure($row2[secure])) continue; if($_GET[sub]==$row2[id]) $categories[]='<a href="?op=products&cat='.$row[id].'&sub='.$row2[id].'" class=subtitle><span class=subcat>'.ucwords($row2[name]).'</span></a>'; else $categories[]='<a href="?op=products&cat='.$row[id].'&sub='.$row2[id].'"><span class=subcat>'.ucwords($row2[name]).'</span></a>'; } }else $categories[]='<a href="?op=products&cat='.$row[id].'">'.ucwords($row[name]).'</a>'; } sort($categories); $left=implode("<br>",$categories);
  4. <? function db_query($query){ global $dbdisable; if($dbdisable==1) return; $result=mysql_query($query) or $dbdisable=1; return $result; } ?>
  5. mysql can access information to more then one computer at the same time... besides... mysql's connections can take litterally milliseconds to finish... the chance of 2 computers connecting at the same time would be a once in a lifetime fluke...
  6. you'd need to use group by and distinct()... i'd explain it... but i'm a bit rushed at the moment :-)
  7. which would just be a logic issue... first one grabs limits by type... second one doesnt...
  8. no... javascript only has access to the standard buttons... you cant access F1-12 through document.onkeydown...
  9. <?php $query="SELECT * FROM business_info WHERE ((make='$make' AND type='$type') AND Categories like '%$Categories%') || (make ='$make' AND Categories like '%$Categories%'))"; nope... the first categories had 2 )'s... where it only shoulda had one, and should be at the end
  10. i want to be able to disable the highlighting of text everywhere, which works... i also want to be able to activate certain tags... in that example... the div... any other ideas how i could do this?
  11. somin like this... $query="SELECT * FROM business_info WHERE ((make=\"$make\" AND type=\"$type\") ||(make =\"$make\" AND Categories like \"%$Categories%\"))AND Categories LIKE \"%$Categories%\" ";
  12. ya... it does return false on error... that should work nicely :-)
  13. yup... works fine :-) i personally wouldnt suggest a book for tiny things like these... just go try em... see if they work...
  14. agreed... addslashes isnt very useful much of the time... however, on certain things like... installing programs, where you may or may not be able to connect to the database yet, having a single function that covers both grounds, may be helpful... but ya... i agree that its rarely helpful, but why not use a function that makes the correct choice, no matter what situation your database may be in...
  15. true... i'm just trying to make addslashes() more obsolete... lol so you can add_slashes() to any string, and it automatically decide the best route...
  16. to expand on red bull, from what i've noticed/read... mysql_real_escape_string() requires a connection to a database to work...? so use this instead... just direct your $dblink to your var you set your mysql_connect() to... <? function add_slashes($string){ global $dblink; if(!$dblink) return addslashes($string); $string=get_magic_quotes_gpc() ? stripslashes($string) : $string; return mysql_real_escape_string($string); } ?> i think thats right...?
  17. strip_tags(); will take out any junk tags someone might try to enter... but if you want to try and catch em in their stupidity... use htmlentities();... LOL
  18. $to='first'; $cc=''; $cc2='second'; if(empty($cc)){ $cc=$cc2; unset($cc2); } //$to=first //$cc=second
×
×
  • 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.