Well i dont have any codes that i can put on the web, But i think the example below done using MySQL should give you an idea of how to do it ......
//========== Sample Code =============//
<html>
<title> Ldap testing </title>
<form name="form1" method="post">
<p> Name       <input type="text" name="txtcn">
<p>
<input type="submit" name="search" value="Search">
<!-- ******** php starting point ******** -->
<?php
if (isset($search)) {
// ** Connect to database
$link = mysql_connect("hostname", "user", "password");
// ** Run SQL query eg.
$result = mysql_query("select * from users where name = '$txtcn'");
// ** Retrive Data & Display
while ($row = mysql_fetch_object($result)) {
echo $row->user_id;
echo $row->name;
}
// ** Close DataBase Handle
mysql_close($link);
}
?>
</form>