Home > Backend Development > PHP Tutorial > PHP operation MySql database_PHP tutorial

PHP operation MySql database_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:51:00
Original
794 people have browsed it

//Link database

$conn = @mysql_connect("localhost","root","88888888") or die ("Link Error");
//Solve Chinese garbled characters

mysql_query("set names 'GBK'");

//Open database
mysql_select_db("wordpress",$conn) or die("Open failed");
$sql = "select * from wp_posts";

//Execute sql statement
$result = mysql_query($sql,$conn);

//Loop to print the required parameters
while($row = mysql_fetch_array($result))
{
echo $row[4]."
";//Tested many times, $row[4] can only be an index, not a column name, I am depressed
}

Excerpted from Candle Shadow under the Lamp

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478232.htmlTechArticle//Link database $conn = @mysql_connect(localhost,root,88888888) or die (link error); / /Solve Chinese garbled characters mysql_query(set names GBK); //Open the database mysql_select_db(wordpres...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template