Eroare Non-object, Undefined offset la parcurgere date mysql
Scris: Lun Iul 28, 2014
Salut,
Imi spune si mie cineva unde gresesc?
Imi preia bine avatarul atat pentru linia 0 si pt linia 1 dar primesc doua erori la inceputul pagini
Trying to get property of non-object si Undefined offset: 1
in linia
Multumesc
Imi spune si mie cineva unde gresesc?
Cod: Selectaţi tot
$query="SELECT * FROM users where genul='m' AND username!='$username' AND participa_la_vot=1 ORDER BY RAND() LIMIT 0,2";
$result = @mysqli_query($db_conx,$query);
while($row = mysqli_fetch_object($result)) {
$users[] = (object) $row;
$av= 'user/'.$users[0]->username.'/'.$users[0]->avatar.'';
$av1= 'user/'.$users[1]->username.'/'.$users[1]->avatar.'';
if (!file_exists($av)) {
$av = 'images/avatardefault.jpg';
}
if (!file_exists($av1)) {
$av1 = 'images/avatardefault.jpg';
}
}
Trying to get property of non-object si Undefined offset: 1
in linia
Cod: Selectaţi tot
$av1= 'user/'.$users[1]->username.'/'.$users[1]->avatar.'';