php fetching users from mysql related question?

Mit Chauhan

New member
JAI MATADI all ..

m trying to fetch the users from the mysql database using my php code ..

in which if the user only type the particular surname or name then also he/she can see the users if they are available ..

suppose my name -- (if you type "MIT" then also you can see me at fetching and if you type "CHAUHAN" then also you can fetch me)

but it seems to be not working for me in my code .. here is my code ..

------------------------------------------------------------
<form name="f1" method="post">
Enter the Name <input type="text" name="name" />
<br />
<input type="submit" name="submit" value="Search" />
</form>

<?php

if(isset($_POST["submit"]))
{
$users = $_POST["name"];
//echo "hello";
mysql_connect("localhost","root","");
mysql_select_db("alldatabase");
$qry = "select * from signup where pname='$users'";
$rs = mysql_query($qry);
while($rows = mysql_fetch_array($rs))
{
$users = $rows["pname"];
echo $users;
}

}

?>
---------------------------------------------------------

i know something will be changed here
-------------------------
$qry = "select * from signup where pname='$users'";
-------------------------
as i have to use something like INSTR but i dont know it ..

please the coding masters help me outt ..

thanks ..
i have to type the full name to find the user .. which i do not want ..
 
Back
Top