MārisL Posted December 15, 2007 Report Share Posted December 15, 2007 (edited) ir lapa lietotaji, kur man ir nepieciešami to avatari, kas glabājas 'avatari' mapē. if (substr($row[2], 0, 7) == 'avatari/') { echo "<a href='lietotajs.php?id=$row[0]' title='$row[1]' /><img class='avatars' src='avatari/".$row[2]."' alt='$row[1]' /></a>"; } else { echo " <a href='lietotajs.php?id=$row[0]' title='$row[1]' /><img class='avatars' src='http://.../dizains/nav_avatars.gif' alt='$row[1]' /></a>"; } mēģināju šādi, bet visi avatari ir img. Kas šiet būtu jāmaina? bet ja samaina uz if (substr($row[2] > 0') { un visiem uploadotajiem avatariem pieliek priekša kādu skaitli, tad avatars rādas Edited December 15, 2007 by MārisL Link to comment Share on other sites More sharing options...
andrisp Posted December 15, 2007 Report Share Posted December 15, 2007 if (substr($row[2] > 0') { Pie šāda koda nekas cits kā tikai sintakses kļūda varētu rādīties. Es ieteiktu kaut kā šādi: if (!empty($row[2]) && is_file($row[2])) { Link to comment Share on other sites More sharing options...
MārisL Posted December 15, 2007 Author Report Share Posted December 15, 2007 (edited) echo '<span class="lapas_nosaukums">Reģistrētie lietotāji</span><p></p>'; if($logged_in){ $result = mysql_query("SELECT id, lietotajvards, avatars FROM lietotaji"); while($row = mysql_fetch_array($result, MYSQL_NUM)) { if (!empty($row[2]) && is_file($row[2])) { echo "<a href='lietotajs.php?id=$row[0]' title='$row[1]' /><img class='avatars' src='avatari/".$row[2]."' alt='$row[1]' /></a>"; } else { echo " <a href='lietotajs.php?id=$row[0]' title='$row[1]' /><img class='avatars' src='http://www.mindtime.lv/nhl/das/dizains/nav_avatars.gif' alt='$row[1]' /></a>"; } } } else{ header("Location: http://..."); } nekas nemainas. Edited December 15, 2007 by MārisL Link to comment Share on other sites More sharing options...
andrisp Posted December 15, 2007 Report Share Posted December 15, 2007 if (!empty($row[2]) && is_file('avatars/'.$row[2])) { Link to comment Share on other sites More sharing options...
MārisL Posted December 15, 2007 Author Report Share Posted December 15, 2007 Jap, tagad iet. Link to comment Share on other sites More sharing options...
blackhalt Posted December 16, 2007 Report Share Posted December 16, 2007 Offt: Es tev ieteiktu palietot arī so tūli: http://validator.w3.org/ Link to comment Share on other sites More sharing options...
Recommended Posts