eg
SELECT * FROM tb WHERE fieldname LIKE N'%avec%' ;
prefix 'N' in after like in sql query as The N stands for National language character set.
SELECT * FROM tb WHERE fieldname LIKE N'%avec%' ;
prefix 'N' in after like in sql query as The N stands for National language character set.
<?php
$search=$_POST['search'];
$search=mysql_escape_string($q);
$search_rep=str_replace(" ","%",$search); // Space replacing with %
$sql=mysql_query("SELECT * FROM tb WHERE fieldname LIKE N'%$search_rep%'");
?>
<html>
<body>
<form method="post" action="">
<input type="text" name="q" /> <input type="submit" value=" Search " />
</form>
<?php
while($row=mysql_fetch_array($sql))
{
$title=$row['fieldname'];
echo '<div>'.$title.'</div>';
}
?>
</body>
</html>
$search=$_POST['search'];
$search=mysql_escape_string($q);
$search_rep=str_replace(" ","%",$search); // Space replacing with %
$sql=mysql_query("SELECT * FROM tb WHERE fieldname LIKE N'%$search_rep%'");
?>
<html>
<body>
<form method="post" action="">
<input type="text" name="q" /> <input type="submit" value=" Search " />
</form>
<?php
while($row=mysql_fetch_array($sql))
{
$title=$row['fieldname'];
echo '<div>'.$title.'</div>';
}
?>
</body>
</html>
No comments:
Post a Comment