algo así?
Código PHP:
function get_foto() {
global $id,$postdata,$tableposts;
$foto = $postdata['Foto'];
if {
$query="SELECT * FROM $tablepost WHERE post_foto = '$foto'";
$result=mysql_query($query);
$querycount++;
$myrow = mysql_fetch_array($result);
$post_foto= $myrow[0];
}
return($foto);
}