简体   繁体   English

使用PHP和MySQL的内容进行随机网格布局

[英]Random Grid Layout using PHP with content from MySQL

I have a grid layout designed. 我有设计的网格布局。 It's a full width fluid layout with no gaps in between. 这是全宽度的流体布局,两者之间没有间隙。 I need to randomise the content on each page load. 我需要将每个页面加载的内容随机化。 I have blocks of different sizes. 我有不同大小的积木。 They add up to 7. Some blocks take up two spaces of the row, others one. 它们加起来为7。某些块占据该行的两个空间,另一些占据一个。

I need a way to randomly output content from a database in each block of the grid. 我需要一种从网格的每个块中的数据库中随机输出内容的方法。 Currently I have set up php functions that randomise the blocks and content but I only have a preset number of blocks and content that are the same. 目前,我已经设置了php函数来随机化块和内容,但是我只有预设数量的块和内容相同。

What would be the best way to do this? 最好的方法是什么? I currently have repeating content. 我目前有重复的内容。

I think you're looking for ORDER BY rand() SQL query. 我认为您正在寻找ORDER BY rand()SQL查询。

This question will help you if so. 如果是这样, 这个问题会为您提供帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM