
techiefreak05
Members-
Posts
494 -
Joined
-
Last visited
Never
About techiefreak05
- Birthday 03/24/1990
Contact Methods
-
Website URL
http://tyny.us
Profile Information
-
Gender
Male
-
Location
ER, MN
techiefreak05's Achievements

Advanced Member (4/5)
0
Reputation
-
how to BOLD search terms in results??
techiefreak05 replied to techiefreak05's topic in PHP Coding Help
haha i know. i put something.. im fixing it now -
how to BOLD search terms in results??
techiefreak05 replied to techiefreak05's topic in PHP Coding Help
yeah, i was gonna say :P lol.. ill try it. so.. what do you think of my site so far? not to get off topic -
how to BOLD search terms in results??
techiefreak05 replied to techiefreak05's topic in PHP Coding Help
heres the code i have .. [code]<?php if($_POST[queryBtn]){ $sql = "SELECT * FROM users WHERE username LIKE '%$_POST[query]%'"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { $searchword = "$_POST[query]"; $searchresult = $row['username']; $formattedresult = eregi_replace($searchword, '<b>'.$searchword.'</b>', $searchresult); echo "Username: <a href='getInfo.php?user=" .$formattedresult. "'>".$formattedresult."</a><hr width=50%><br>"; } } if($_POST[queryBtnEM]){ $sql = "SELECT * FROM users WHERE email LIKE '%$_POST[queryEM]%'"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo "Email: " .$row[email]. "<br>"; echo "Username: <a href='getInfo.php?user=" .$row[username]. "'>".$row[username]."</a><hr width=50%><br>"; } } if($_POST[queryBtnFN]){ $sql = "SELECT * FROM users WHERE fname LIKE '%$_POST[queryFN]%'"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo "First Name:" .$row[fname]. "<br>"; echo "Username: <a href='getInfo.php?user=" .$row[username]. "'>" .$row[username]. "</a><hr width=50%><br>"; } } ?>[/code] or you could click my giant green logo and register(its a whole 5 fields! lol) quick on my site and go to search and search for "bren" or "br" or something in "brenden" -
how to BOLD search terms in results??
techiefreak05 replied to techiefreak05's topic in PHP Coding Help
i still have the code you posted that DID get rid of showing the br tags in the results.. i hacent chnged anything in the code u gave me. -
how to BOLD search terms in results??
techiefreak05 replied to techiefreak05's topic in PHP Coding Help
haha crayonviolet, i was just gonna say that!! .. so, do you know ho to stop it from putting the b tags in the link.. lets say i searched for "bren".. that would display one result.. as <b>bren</b>den .. ok good, BUT the link will be: [code]getInfo.php?user=<b>bren</b>den[/code] where its supposed to be: [code]getInfo.php?user=brenden[/code] -
how to BOLD search terms in results??
techiefreak05 replied to techiefreak05's topic in PHP Coding Help
CrayonViolet: it 50% works! it doesnt display my br tags.. BUT it still has the b tags in the url .. which brings up a PAGE CANNOT BE DISPLAYED browser error... -
how to BOLD search terms in results??
techiefreak05 replied to techiefreak05's topic in PHP Coding Help
...crap.. when i echo the following: [code]Username: <a href='getInfo.php?user=" .$row[username]. "'>".$row[username]."</a>[/code] and the search terms are bolded .. the link is: [code][color=red]getInfo.php?user=<b>searchtermhere</b>[/color][/code] [code]and thats a BAD thing! cuz the "<b>" and "</b>" are included in the url[/code] -
how to BOLD search terms in results??
techiefreak05 replied to techiefreak05's topic in PHP Coding Help
yeah, but ididnt post the form.. cuz i didnt change it.. [code]<?php if($_POST[queryBtn]){ $sql = "SELECT * FROM users WHERE username LIKE '%$_POST[query]%'"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { $searchword = "$_POST[query]"; $searchresult = "Username: <a href='getInfo.php?user=" .$row[username]. "'>".$row[username]."</a><hr width=50%><br>"; $formattedresult = eregi_replace($searchword, '<b>'.$searchword.'</b>', $searchresult); echo $formattedresult; } } if($_POST[queryBtnEM]){ $sql = "SELECT * FROM users WHERE email LIKE '%$_POST[queryEM]%'"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { $searchword = "$_POST[queryEM]"; $searchresult = "Email: " .$row[email]. "<br>Username: <a href='getInfo.php?user=" .$row[username]. "'>".$row[username]."</a><hr width=50%><br>"; $formattedresult = eregi_replace($searchword, '<b>'.$searchword.'</b>', $searchresult); echo $formattedresult; } } if($_POST[queryBtnFN]){ $sql = "SELECT * FROM users WHERE fname LIKE '%$_POST[queryFN]%'"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo "First Name:" .$row[fname]. "<br>"; echo "Username: <a href='getInfo.php?user=" .$row[username]. "'>" .$row[username]. "</a><hr width=50%><br>"; } } ?>[/code] it works yes .. but when i search for "b" .. it shows my <br> tags .. and i know why.. cuz its included in the $searchresult echo .. but idk how to fix it. there is asimple way to fix it.. stop the user from searching for less than 3 charaters.. and im about to try that. -
yep. np. if you need any help understading it more.. email me: techiefreak05@gmail.com .. or IM me
-
how to BOLD search terms in results??
techiefreak05 replied to techiefreak05's topic in PHP Coding Help
well wait! when i search for anything that has a "b" in it.. it shows my <br> tags .. and its not supposed to. -
how to BOLD search terms in results??
techiefreak05 replied to techiefreak05's topic in PHP Coding Help
thanks, i got it -
how to BOLD search terms in results??
techiefreak05 replied to techiefreak05's topic in PHP Coding Help
... thanks .. but idk how to incorporate that into my code.. -
oh, and to call the function, put this on any page you want to use the function on: [code]<?php yourInfo() ?>[/code] if you in clude all your functions in a seperate file than what your displaying them in.. you have to put [code] <?php include("file.php"); ?>[/code] at the top of the page u wish to use the functon. "file.php" is the filename that has the function
-
yes. heres a function that uses SQL code.. i use this on my site [code] <?php function yourInfo(){ $sql = "SELECT * FROM users WHERE username = '$_SESSION[username]' LIMIT 1"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo "<center><b>Getting Info for: " .$row[username]. "</b></center>"; echo "<b>First Name: <u>".$row['fname']."</u><p>"; echo "Username: <u>".$row['username']."</u><p>"; echo "zyPoints: <u>".$row['zypoints']."</u><p>"; echo "E-mail: <u>".$row['email']."</u><p></b>"; echo "<center><a href='editAccnt.php'>Edit Account</a></center>"; } } ?> [/code]
-
you know google does it. but how to do it. when you search .. in your results.. it makes your search terms bold within the results.. how do i do that? oh, heres my search script: [code]<b>Search by Username:</b> <form action="" method="post"> <table align="center" border="0" cellspacing="0" cellpadding="3"> <tr><td bgcolor="#3399CC"><font color="black">Username:</font></td></tr> <tr><td bgcolor="#3399CC"><input type="input" name="query"></td></tr> <tr><td colspan="2" align="right"><input type="submit" name="queryBtn" value="-Search-"></td></tr> </table> </form><br> <b>Search by Email:</b> <form action="" method="post"> <table align="center" border="0" cellspacing="0" cellpadding="3"> <tr><td bgcolor="#3399CC"><font color="black">Email:</font></td></tr> <tr><td bgcolor="#3399CC"><input type="input" name="queryEM"></td></tr> <tr><td colspan="2" align="right"><input type="submit" name="queryBtnEM" value="-Search-"></td></tr> </table> </form> <b>Search by First Name:</b> <form action="" method="post"> <table align="center" border="0" cellspacing="0" cellpadding="3"> <tr><td bgcolor="#3399CC"><font color="black">First Name:</font></td></tr> <tr><td bgcolor="#3399CC"><input type="input" name="queryFN"></td></tr> <tr><td colspan="2" align="right"><input type="submit" name="queryBtnFN" value="-Search-"></td></tr> </table> </form> <br> <br><hr><br> <b><u><font color=red>Your Results:</font></u></b><br> <? $end = round(microtime(true) - $start, 3); echo 'Query completed in <b>' . $end . '</b> seconds'; ?> <center> <?php if($_POST[queryBtn]){ $sql = "SELECT * FROM users WHERE username LIKE '%$_POST[query]%'"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo "Username: <a href='getInfo.php?user=" .$row[username]. "'>".$row[username]."</a><hr width=50%><br>"; } } if($_POST[queryBtnEM]){ $sql = "SELECT * FROM users WHERE email LIKE '%$_POST[queryEM]%'"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo "Email: " .$row[email]. "<br>"; echo "Username: <a href='getInfo.php?user=" .$row[username]. "'>".$row[username]."</a><hr width=50%><br>"; } } if($_POST[queryBtnFN]){ $sql = "SELECT * FROM users WHERE fname LIKE '%$_POST[queryFN]%'"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { echo "First Name:" .$row[fname]. "<br>"; echo "Username: <a href='getInfo.php?user=" .$row[username]. "'>" .$row[username]. "</a><hr width=50%><br>"; } } ?>[/code]