"; $draw_q = mysqli_query($conx, "SELECT id,location,collections FROM draw WHERE uid='$u_uid' ORDER BY id DESC"); while($draw_r = mysqli_fetch_assoc($draw_q)) { $i++; $draw_id = $draw_r['id']; $draw_url = $draw_r['location']; $draw_collections = $draw_r['collections']; //if this is first value in row, create new row if ($i % 4 == 1) { echo ""; } $usri_q = mysqli_query($conx, "SELECT username_color,text_color FROM user_theme_colors WHERE uid='$u_uid' && theme_id='$g_themeid'"); $usri_r = mysqli_fetch_assoc($usri_q); $username_color = $usri_r['username_color']; $username_tcolor = $usri_r['text_color']; echo ""; echo "\"\""; echo "
"; if($draw_collections == 'no') { echo ""; } else { echo ""; } echo "
"; //if this is third value in row, end row if ($i % 4 == 0) { echo ""; } } //if the counter is not divisible by 3, we have an open row $spacercells = 4 - ($i % 4); if ($spacercells < 4) { for ($j=1; $j<=$spacercells; $j++) { echo ""; } echo ""; } echo ""; ?>