Para declarar una function, tomando en cuenta ese codigo yo haria esto
Código PHP:
Ver original<?php
function tufuncion($num_socio, $monto){
$reg=mysql_query("select sum(monto) as can from ahorros where num_socio = '".$num_socio."' and proceso ='DEPOSITO'") or
die("Problemas en el select:".mysql_error());
$r=mysql_query("select sum(monto) as c from ahorros where num_socio = '".$num_socio."' and proceso ='RETIRO'") or
die("Problemas en el select:".mysql_error());
$total= $regi['can']-$reg['c'];
$tot= $total;
if ($monto > $tot) {
echo "ERRORRRRRRRRRRR";
echo '<br>';
}
}
?>
Si necesitas imprimir, el numero de socio 5 con el monto 20 haces esto