Home > php教程 > php手册 > 取得单条网站评论以数组形式进行输出,单条数组

取得单条网站评论以数组形式进行输出,单条数组

WBOY
Release: 2016-06-13 09:28:16
Original
927 people have browsed it

取得单条网站评论以数组形式进行输出,单条数组

原库函数中,没有获取单条评论显示的方法,增加如下

public static function single($id){
global $db;
return $db->query("SELECT * FROM `{$db->prefix}comment` WHERE `id` = '{$id}'",1);
}
Copy after login

输出数组,在模板里调用即可

先给a数组赋值然后以每行5个数据的形式输出所有数组中的元素

#include "stdio.h"
main()
{
int a[20],i;//这里假设数组是20个元素。
for(i=0;i scanf("%d",&a[i]);//这里数组的元素是键盘输入的。
for(i=0;i {
printf("%5d",a[i]);
if(i%5==0)
printf("/n");//够5个数就输出一个换行。

}
}
 

对于数组传递的问题,以及怎输出数组

require 函数,具体我不清楚了,不过用js也很简单吧
 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template