![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
taith
Members-
Posts
1,514 -
Joined
-
Last visited
Everything posted by taith
-
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); ?>
-
i highly doubt it...
-
A little mySQL hustle here, cant figure something out!!!
taith replied to npsari's topic in PHP Coding Help
-
A little mySQL hustle here, cant figure something out!!!
taith replied to npsari's topic in PHP Coding Help
a) distinct also should use group by b) you need to "distinct(name), news" -
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);
-
that works too... lol...
-
<? function db_query($query){ global $dbdisable; if($dbdisable==1) return; $result=mysql_query($query) or $dbdisable=1; return $result; } ?>
-
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...
-
you'd need to use group by and distinct()... i'd explain it... but i'm a bit rushed at the moment :-)
-
didja check your antispam?
-
$_GET[pick]
-
which would just be a logic issue... first one grabs limits by type... second one doesnt...
-
no... javascript only has access to the standard buttons... you cant access F1-12 through document.onkeydown...
-
[SOLVED] for loop within a for loop please help cheers
taith replied to redarrow's topic in PHP Coding Help
switch($i+$a){ -
<?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
-
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?
-
somin like this... $query="SELECT * FROM business_info WHERE ((make=\"$make\" AND type=\"$type\") ||(make =\"$make\" AND Categories like \"%$Categories%\"))AND Categories LIKE \"%$Categories%\" ";
-
ya... it does return false on error... that should work nicely :-)
-
yup... works fine :-) i personally wouldnt suggest a book for tiny things like these... just go try em... see if they work...
-
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...
-
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...
-
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...?
-
cheers mate
-
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
-
$to='first'; $cc=''; $cc2='second'; if(empty($cc)){ $cc=$cc2; unset($cc2); } //$to=first //$cc=second