Jump to content

Need help!


david212

Recommended Posts

Hello. Im creating a search function, im getting data from MySQL. I want all found words to be written in red. Here is the code:

 

<?php


mysql_connect("localhost","root","");
mysql_select_db("my_db");

if(isset($_POST["xd"])){


$sql="SELECT * FROM nb WHERE msg LIKE \"%".$_POST["xDDDD"]."%\"";
$r=mysql_query($sql);
$s=mysql_num_rows($r);
for($i=0;$i<$s;$i++){

	$ret=mysql_result($r,$i,"msg");

	echo($ret."<br>......");


}

}



?>

 

i tried in this mode,

if($n=$_POST["xDDDD"]){

	echo("<font color='ff0000'>".$n."</font><br>......");
}

 

but it only shows the search word in red. Can anyone help me? :) Thanx

Link to comment
https://forums.phpfreaks.com/topic/158944-need-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.