现在的位置: 首页 > 综合 > 正文

PHP、MySQL选择数据库 —————- 002

2017年10月13日 ⁄ 综合 ⁄ 共 297字 ⁄ 字号 评论关闭
<?php
	print "Opening the connection to the database server<br />";
	mysql_connect("localhost","root","password");
	print "Select a database<br />";
	$result = mysql_select_db("phpweb");
	if( $result)
	{
		print "Database selected successfully";
	}
	else
	{
		print "There was problem with the database selection<br />";
	}
?>

一旦选择成功,全部查询都是针对这个数据库进行的。

抱歉!评论已关闭.