Home > Article > Backend Development > php mysql query database_PHP tutorial
php mysql query database The article provides a simple mysql code to query database data, which can query all data in the blog and display it.
php tutorial mysql tutorial query database tutorial
The article provides a simple mysql code to query database data, which can query all data in the blog and display it.
session_start();
$conn=mysql_connect('localhost','root','root')or die('Database connection error');
mysql_select_db('demo',$conn);
mysql_query("set names 'gbk'");
$us=$_session['username'];
$selequery=mysql_query("select * from blog where author='$us' order by id desc")or die("Query failed");
?>
?>