简体   繁体   English

PHP显示Mysqli数据

[英]PHP Display Mysqli data

I need some advice. 我需要一些建议。 I am creating a PHP website which has like 20 table to show from the database. 我正在创建一个PHP网站,其中有20个表要从数据库中显示。

I using while loop to generate 20 table and populate the data inside and no problem. 我使用while循环生成20个表并填充其中的数据,没有问题。

But what I want to do is create a specific size div1 lets say 520 wx 520px h. 但是我想做的是创建一个特定的尺寸div1,比如说520 wx 520px h。 Then using loop I generate first table with data and display then that table moving up slowly until it disappear from div1 and i continue this for rest of the table. 然后使用循环,我生成包含数据的第一个表并显示,然后该表缓慢向上移动,直到它从div1中消失为止,然后我继续执行此操作以处理表的其余部分。

Anyone can help on logic here or point me to a resource which can help me do it. 任何人都可以在这里提供逻辑帮助,或者将我指向可以帮助我完成工作的资源。

You mean an animation? 你是说动画吗? Then it is a JS/CSS job. 然后,这是一个JS / CSS作业。 PHP is server-side, and the elements that you see in a webpage are downloaded from the server. PHP是服务器端的,您在网页中看到的元素是从服务器下载的。 JS and CSS work on client-side,as well as HTML. JS和CSS可以在客户端以及HTML上运行。 So if you want to make an animation, you should start by making a JS function that repeats itself for n times. 因此,如果要制作动画,则应首先制作一个可重复执行n次的JS函数。 In that loop, just edit the divs' styles and that's it. 在该循环中,只需编辑div的样式即可。

If you don't know how to do that, here is the code: 如果您不知道该怎么做,请使用以下代码:

var inter = setInterval(animate,20);
var i = 0;
function animate(){
    document.getElementById("div1").style.marginBottom = i+"px";//This will make the div go up if your div id is div1. If not, just change div1 for your id. If you want to move it down, you would have to replace marginBottom for marginTop(this will only work if your div's position is relative).
    i++;
    if(i==200){//When it has moved 200px, it will stop
        clearInterval(inter);
    }
}

NOTE: the code above is an example. 注意:上面的代码是一个示例。 If you want it to move left/right/down or that it moves 500px instead of 200px, you would have to change it. 如果您希望它向左/向右/向下移动,或者它要移动500px而不是200px,则必须对其进行更改。 Guide yourself with the comments 用评论指导自己

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

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