budimir Posted August 23, 2008 Share Posted August 23, 2008 Hey guys, How can I idnetify which row is which. I'm using this code: $upit = "SELECT * FROM opisi JOIN slike ON opisi.opis_id = slike.id ORDER BY datum DESC LIMIT 4"; $rezultat = mysql_query($upit,$veza) or die (mysql_error()); while($values = mysql_fetch_array($rezultat)){ How can I say.. Echo row1 Echo row2 ... Echo row4 Quote Link to comment https://forums.phpfreaks.com/topic/121024-solved-identifing-rows/ Share on other sites More sharing options...
DarkWater Posted August 23, 2008 Share Posted August 23, 2008 Use a counter? Quote Link to comment https://forums.phpfreaks.com/topic/121024-solved-identifing-rows/#findComment-623872 Share on other sites More sharing options...
ohdang888 Posted August 23, 2008 Share Posted August 23, 2008 what do you means.... you've got the while statement in place, that will echo all the rows... if you want a "This is row 1"; do this: $x=1; while statement{ echo "This is row $x"; $x++; } Quote Link to comment https://forums.phpfreaks.com/topic/121024-solved-identifing-rows/#findComment-623874 Share on other sites More sharing options...
budimir Posted August 23, 2008 Author Share Posted August 23, 2008 OK, to clarify a little bit more. I have 4 divs, and each one I want to put data I'm getting in this loop. while($row = mysql_fetch_array($rezultat)){ $opis_id = $row["opis_id"]; $opis = $row["opis"]; $datum = $row["datum"]; $unio = $row["unio"]; $lokacija = $row["lokacija"]; $zupanija = $row["zupanija"]; $drzava = $row["drzava"]; $kategorija = $row["kategorija"]; $link = $row["link"]; $naziv = $row["naziv"]; My problem is I wan't to put first row of DB to DIV1, second row of DB to DIV2, third row of DB to DIV3, fourth row of DB to DIV4. How can I tell the program which row need's to go where??? Quote Link to comment https://forums.phpfreaks.com/topic/121024-solved-identifing-rows/#findComment-623891 Share on other sites More sharing options...
DarkWater Posted August 23, 2008 Share Posted August 23, 2008 We told you to use a counter... o-O Quote Link to comment https://forums.phpfreaks.com/topic/121024-solved-identifing-rows/#findComment-623893 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.