Home >Backend Development >PHP Tutorial >PHP operation MySql database_PHP tutorial
//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