- Home
- Categorie
- Coding e Sistemistica
- PHP
- While in while che genera id assurdi??!!
-
While in while che genera id assurdi??!!
Allora...
Ho un while che estrae il messaggio, il testo e il nome dell'utente.
All'interno di quest'ultimo c'è n'è un'altro che a seconda del nome utente ne ricava l'id.
Ma come id ottengo completamente altri valori.questo è il codice
[php]
while ($valori = mysql_fetch_array ($query))
{......
......//Ricavo avatar e id $query_sql = mysql_query ("SELECT id,avatar FROM answer_utenti WHERE nome='$user_ask'"); while ($valori_user = mysql_fetch_array($query_sql)) { $avatar_url = $valori_user['avatar']; $id_user = $valori['id']; }
echo"$id_user";
....
}[/php]
-
ciao..che tipo di valori ricevi??
controlla qui
[php]
$avatar_url = $valori_user['avatar'];
$id_user = $valori['id'];
[/php]
in id_user hai preso i valori del mysql_fetch della prima query..
[php]
$avatar_url = $valori_user['avatar'];
$id_user = $valori_user['id'];
[/php]
..ora li prende dalla seconda e dovrebbe stamparti l'id corretto
-
Oddio!Che imbranato!
Grazie!