You can use this function for populate single field from table of spacific record
function GetField($TableName,$InputFieldName,$InputFieldValue,$OutputFieldName)
{
$sql= "Select ".$OutputFieldName." from ".$TableName ." Where ". $InputFieldName."='".$InputFieldValue."'";
$res=mysql_query($sql) or die(mysql_error()) ;
$str="";
if (mysql_num_rows($res) > 0 )
{
$res_arr=mysql_fetch_array($res);
$str=$res_arr[0];
}
//echo $str;
return $str;
}
-------------------------------------------------------------
Another is, using this you will get two dimensional array.
like if you pass
$arr = select_row("select * from employee");
you can retrieve the fields like
1st record == $arr[0]['name']
2nd record == $arr[1]['name']
Please check it, if you have any problem, please let me know..
function select_row($sql)
{
if ($sql!="")
{
$result = mysql_query($sql) or die(mysql_error()) ;
if ($result)
{
while($row = mysql_fetch_array($result))
$data[] = $row;
}
return $data;
}
}