DaveyK Posted May 27, 2013 Share Posted May 27, 2013 Hey freakers, I am using PDO and php 5. something. Regardless, I am craeting a tile like interface. These tiles are fetched from the database, but I need to define the order in which theyre displayed. So this is both a PHP/database question. Say I have 4 tiles, tile 1 till tile 4 and I wish to order them 3, 1, 4, 2. What tips do you guys have ? I can imagine a static order but thats not really ideal is it. I could set each tile to have a static position, so first second third and so forth, but I would really love to calculate this on the go since the design is fluid. I have no idea where to start on this :/ Do any of you guys know a solution to this? Share some wisdom! Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted May 27, 2013 Share Posted May 27, 2013 Why you should have 4 titles? A table should not have repeating values and columns itself! Google - "Database optimization" or EXPLAIN your table data here. Quote Link to comment Share on other sites More sharing options...
Solution Jessica Posted May 27, 2013 Solution Share Posted May 27, 2013 Why you should have 4 titles? A table should not have repeating values and columns itself! Google - "Database optimization" or EXPLAIN your table data here. Tiles. Not titles. OP: Your table that stores the information should have a column (called something like orderBy [but not order because thats reserved]) and you can order them in there, then ORDER BY in your clause. You can look at creating a nice interface for actually ordering them using jQuery's sortable plugin. Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted May 27, 2013 Share Posted May 27, 2013 lol, jazzman, you might need to test your vision too - tiles: 1.a thin slab or bent piece of baked clay, sometimes painted or glazed, used for various purposes, as to form one of the units of a roof covering, floor, or revetment. 2.any of various similar slabs or pieces, as of linoleum, stone, rubber, or metal. Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 27, 2013 Share Posted May 27, 2013 I think OP means more like just a box, like Windows calls their new interface "live tiles". Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted May 27, 2013 Share Posted May 27, 2013 (edited) Lol.....what a shame @mac_gyver I know what is a "tile" I've been working in construction areas when I came to Canada, but I really wanna thank you for this reply I cannot sleep well at last night. Edited May 27, 2013 by jazzman1 Quote Link to comment Share on other sites More sharing options...
DaveyK Posted May 27, 2013 Author Share Posted May 27, 2013 You guys all make cute couples. Lol. @Jessica, so what you are saying is: just store the position of every box and update them if you need to. I am not using jQuery, this project involves no JS. I thought of that, just wanted to check if that is in fact the best solution Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 27, 2013 Share Posted May 27, 2013 if you want each tile to be at a specific position, and there is no other criteria ordering them than your given order (ie, it's not by date, name, etc), then you must store the order that you want. Quote Link to comment Share on other sites More sharing options...
DaveyK Posted May 27, 2013 Author Share Posted May 27, 2013 yes, that makes perfect sense. Thank you! 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.