Home > Backend Development > PHP Tutorial > Get a single website comment and output it in the form of an array, single array_PHP tutorial

Get a single website comment and output it in the form of an array, single array_PHP tutorial

WBOY
Release: 2016-07-13 10:22:07
Original
852 people have browsed it

Get a single website comment and output it in array form, single array

In the original library function, there is no method to obtain the display of a single comment. The following is added

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

Output the array and call it in the template

First assign a value to an array and then output all the elements in the array in the form of 5 data per row

#include "stdio.h"
main()
{
int a[20],i;//Here it is assumed that the array has 20 elements.
for(i=0;i<20;i++)
scanf("%d",&a[i]);//The elements of the array here are entered from the keyboard.
for(i=0;i<20;i++)
{
printf("%5d",a[i]);
if(i%5==0)
printf("/n");//Output a newline if it reaches 5 numbers.

}
}

Regarding the issue of array transfer and how to output the array

require function, I don’t know the details, but it’s very simple to use js

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/851335.htmlTechArticleGet a single website comment and output it in the form of an array. In the original library function of a single array, there is no method to get a single comment to display. , add the following public static function single($id){globa...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template