i am working with php and trying something new that if user inputs "a" than all the records of name starting with "a" in employee table should be displayed...

$letter=$_POST["letter"];
sql="select * from emp where emp_name='".$letter."'* "

//is above query write and the wild character to be used is write or not
pls reply.....

Member Avatar for diafol

Maybe:

$letter=mysql_real_escape_string($_POST["letter"]);
$sql="select * from emp where emp_name LIKE '$letter%'";

i wl try it and thn reply u again....thnx for replyng...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.