Devils666 Posted November 13, 2009 Report Share Posted November 13, 2009 Esmu uztaisījis albūmu, un, piemēram, atveru vienu bildi... kā es var iegūt iepriekšējo bildi, pec id un nākošo? Piemēram: Datubāze ir ierkasti: 1,2,3,4,5,6,7,8,9,10... atveru 6 bildi un kā varu iegūt tos id, kas blakus? ( 5 un 7 ) Lai ar vienu funkciju dabutu 5 un ar otru 7 Quote Link to comment Share on other sites More sharing options...
false Posted November 13, 2009 Report Share Posted November 13, 2009 (edited) Varbūt šadi :D <? $one = "6"; $two = "1"; $plus = $one+$two; $minus = $one-$two; echo $minus; echo $plus; ?> Edited November 13, 2009 by false Quote Link to comment Share on other sites More sharing options...
Devils666 Posted November 13, 2009 Author Report Share Posted November 13, 2009 (edited) Varbūt šadi :D <? $one = "6"; $two = "1"; $plus = $one+$two; $minus = $one-$two; echo $minus; echo $plus; ?> Nu jā... :D liekas loģiski, bet ja man tikai sākuma ir pēc kārtas, bet pēctam 10,12,15,16,18,21,22,27,40....? Edited November 13, 2009 by Devils666 Quote Link to comment Share on other sites More sharing options...
false Posted November 13, 2009 Report Share Posted November 13, 2009 Nu <? $one = //Te kaut ka izvelc to skaitli; $two = "1"; $plus = $one+$two; $minus = $one-$two; echo $minus; echo $plus; ?> Quote Link to comment Share on other sites More sharing options...
Devils666 Posted November 13, 2009 Author Report Share Posted November 13, 2009 (edited) Nu <? $one = //Te kaut ka izvelc to skaitli; $two = "1"; $plus = $one+$two; $minus = $one-$two; echo $minus; echo $plus; ?> Jā, bet man dažiem tas -1 +1 neder, jo neko ar tādu ID neatrod, jo datubāze nav tāda id, man vaig dabūt tikai eksistējošus Piemēram, id ir: 22,27,31,40,55,58,61... Piemēram man id ir 31, un ka man no datubāzes dabūt 27 un 40? un lai tas ne tikai vienam darboties, bet ari automatiski visam pārējam... ja butu,27,40 utt id numuri... Edited November 13, 2009 by Devils666 Quote Link to comment Share on other sites More sharing options...
waplet Posted November 13, 2009 Report Share Posted November 13, 2009 nav ar kkādiem limitiem iespējams un tātalāk? varbūt ir iespējams 2 ailēm , viena aile ar auto incrementu un otra ar tādiem id, so auto incrementu select ou nizvada šo id Quote Link to comment Share on other sites More sharing options...
Devils666 Posted November 13, 2009 Author Report Share Posted November 13, 2009 nav ar kkādiem limitiem iespējams un tātalāk? varbūt ir iespējams 2 ailēm , viena aile ar auto incrementu un otra ar tādiem id, so auto incrementu select ou nizvada šo id Nu jā, tapēc prasu, jo pašam īsti nesanāk līdz galam... Quote Link to comment Share on other sites More sharing options...
Devils666 Posted November 13, 2009 Author Report Share Posted November 13, 2009 Paldies, izdomaju, un pavisam vienkāršu risinajumu un viss iet.. :) Quote Link to comment Share on other sites More sharing options...
marcis Posted November 13, 2009 Report Share Posted November 13, 2009 Kārto pēc kaut kāda parametra un attiecīgi velc ārā ierakstus, kur kārtošanas parametrs ir mazāks un kur lielāks. Quote Link to comment Share on other sites More sharing options...
waplet Posted November 13, 2009 Report Share Posted November 13, 2009 Vai padalīsies? Quote Link to comment Share on other sites More sharing options...
Devils666 Posted November 14, 2009 Author Report Share Posted November 14, 2009 (edited) Vai padalīsies? Nu jā, tātad vienkārsi no datubāzes izvadot: "SELECT id FROM savas_tabulas WHERE id < $pasreizejais_id ORDER BY id DESC LIMIT 1" un "SELECT id FROM savas_tabulas WHERE id > $pasreizejais_id ORDER BY id DESC LIMIT 1" varbūt kādam noderēs! ;) Edited November 14, 2009 by Devils666 Quote Link to comment Share on other sites More sharing options...
waplet Posted November 14, 2009 Report Share Posted November 14, 2009 Ir teiciens, "Viss vienkāršais, ir viss labākais" Quote Link to comment Share on other sites More sharing options...
2easy Posted November 14, 2009 Report Share Posted November 14, 2009 Ir teiciens, "Viss vienkāršais, ir viss labākais" viss ģeniālais ir vienkāršs ;) Quote Link to comment 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.