glug: help PHP
Ivan Porro
pivan@bio.dist.unige.it
Gio 13 Gen 2005 09:50:11 CET
ok. c provo (a spiegarmi)
Allora. Faccio una doverosa premessa: con mysql_fetch_array si puo' risolvere
il problema (credo, sto per provare :) e questo rende il topic puramente
"stilistico" ma cio' non elimina il problema nel caso uno si trovi a partire
da oggetti. Se nessuno si scandalizza per il pessimo inglese (o italiese),
questo e' quanto ho postato anche su altre ML.... :)
i've an $object coming out from a mysql_fetch_object.
SQL ok, result ok..: everything okay when print_r($obj).
next, I loop through $obj because I need to rework some fields (cut date,
strings, so on)
If I comment one (RANDOMLY!!!!) line where I do a substr() the code work...
commented out, the server doesn't return anything
it's a memory leak? error in my code? I'm going crazy....
this is the code snippet:
while($obj = mysql_fetch_object($result)) {
/* convert obj to array... */
$obj_array[$rowIndex] = get_object_vars($obj);
/* just print out first record only for debug */
if($rowIndex == 0) {
echo "<pre>";
var_dump($obj);
echo "</pre>";
}
/* this doesn't work too!! */
//$obj_array[$rowIndex] = (array)$obj;
/* this doesn't work too!!
$tmp = (string)$obj_array[$rowIndex][paz_Sex];
$tmp2 = substr($tmp,0,1);
$obj_array[$rowIndex][paz_Sex] = $tmp2;
*/
$obj_array[$rowIndex][pr_Data_Pren] = substr($obj->pr_Data_Pren,0,10);
$obj_array[$rowIndex][pr_Ora_Pren] = substr($obj->pr_Ora_Pren,11,5);
$obj_array[$rowIndex][pr_Data_Reg] = substr($obj->pr_Data_Reg,0,10);
$obj_array[$rowIndex][paz_Com_res] = "?".$obj->paz_Com_res;
$obj_array[$rowIndex][paz_Com_nasc] = "?".$obj->paz_Com_nasc;
$obj_array[$rowIndex][pr_Prest_ICD9] = "?".$obj->pr_Prest_ICD9;
$rowIndex++;
}
> >ciao a tutti,
> >
> > c'e' qualcuno bravo in php a cui posso fare una domanda?
>
> prova con la domanda...
>
> ciaz
> paolino
>
--
______________________
www.bio.dist.unige.it
+39 010 353.2789 (tel)
+39 010 353.2948 (fax)
Maggiori informazioni sulla lista
glug