in gender you can use
echo '<table><tbody><tr><td>'.substr($row['gender'],0,1).'</td></tr></tbody></table>';
instead of echo '<table><tbody><tr><td>'.$row['gender'].'</td></tr></tbody></table>';
and you don't have to change it to number or double. php will auto convert it