$sql="select * from a";
$res=mysql_query($sql,$link); // get a result; $link must be defined before;
$total_num=mysql_num_rows($res); // this fetchs the record count;
$rs=mysql_fetch_array($res);//get a result array;
$name=$rs['name']; //assign value to $name;