Search User - Please help!!!
Posted: Tue Jul 17, 2012 3:43 am
Hi,
I'm trying to modify the script to search for user base on their Name, not their username. I'm not familiar with php.
Please help. Thanks!
Thanks!
I'm trying to modify the script to search for user base on their Name, not their username. I'm not familiar with php.
Please help. Thanks!
Thanks!
Code: Select all
<?php
// This will allow to use the css inside includes if editing this file directly... probably
$visitingfiledirectly = false;
if($visitingfiledirectly)
{
?>
<link rel="stylesheet" type="text/css" media="screen" href="../stylus.css">
<?php
}
?>
<b>Search Result</b><br />
<div class="searchlist">
<?php
$uname = "";
if(isset($_POST["u"]) && !empty($_POST["u"]) && strlen($_POST["u"]) > 0)
{
$uname = PHP_slashes($_POST["u"]);
}
$result2 = mysql_query("SELECT Avatar, Name, Username, LastLoginDate, Email FROM users where Username Like '%".$uname."%'");
if(mysql_num_rows($result2) > 0)
{
?>
<table border = "1" width="100%">
<tr>
<td></td>
<td><b><p align="center">Name</b></td>
<?php
if($admin >= 1)
{
?>
<td><b><p align="center"><p align="center">Email Address</b></td>
<?php
}
?>
<td><b><p align="center">Last Login</b></td>
</tr>
<?php
while ($row2 = mysql_fetch_row($result2)){
?>
<tr>
<td><p align="center"><?php useLightbox($row2[0],$row2[1],50,50);?></td>
<td><p align="center"><a href="index.php?section=profile&uid=<?php echo getUserId($row2[2]);?>"><b><?php echo $row2[1];?></b></a></td>
<?php
if($admin >= 1)
{
?><td><p align="center"><?php echo $row2[4];?></td><?php
}
?><td><p align="center"><?php echo referencialHour($row2[3]);?></td>
</tr><?php
}
?>
</table>
</div>
<?php
}
else
{
?>
<font color="#FF0000">No user found!</b></font>
<?php
}
?>