<?php
header("content-type:application/vnd.ms-excel; charset=gbk");
header("content-disposition:attachment;filename=test_data.xls");
$link=mysql教程_connect('localhost','root','hhhkkk');
if($link){
<?php
header("content-type:application/vnd.ms-excel; charset=gbk");
header("content-disposition:attachment;filename=test_data.xls");
$link=mysql教程_connect('localhost','root','hhhkkk');
if($link){
session_start();
$conn=mysql_connect('localhost','root','root')or die('数据库连接错误');
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("查询失败");
?>
class mysql{
private $db_host; //数据库主机
private $db_user; //数据库用户名
private $db_pwd; //数据库密码
private $db_database; //数据库名
private $conn; //数据库连接标识;
private $sql; //sql执行的语句
private $result; //query的资源标识符
private $coding; //数据库编码,gbk,utf8,gb2312
private $show_error = true; //本地调试使用,打印错误
//mssql server与php连接
//mysql数据库连接
$host = 'localhost';
$user_name = 'root';
$password = 'admin';
$conn = mysql_connect($host,$user_name,$password);
if(!$conn)
{
die('数据库连接失败:<br/>'.mysql_error());
}
echo '数据库连接成功!继续操作...';
$host = 'localhost';
$user_name = 'root';
$password = 'admin';
$id = $_get['id'];
$conn = mysql教程_connect($host,$user_name,$password);
if(!$conn)
{
die('数据库连接失败:'.mysql_error());
}
mysql_select_db('test');
?>
<b>提交用户信息</b>
$host = 'localhost';
$user_name = 'root';
$password = 'admin';
$conn = mysql_connect($host,$user_name,$password);
if(!$conn)
{
die('数据库连接失败:'.mysql_error());
}
mysql_select_db('test');
//链接数据库
/*
注意事项
/*
* created on 2010-4-21
*
* the class for control mysql
*
* made by s71ence
*
* @$host
* @$user_name
* @$user_pwd
* @$data_base
* @$coding
*/
class mysql
{
private $host;//主机名
private $user_name;//用户名
private $user_pwd;//密码
private $data_base;//数据库名
private $coding;//编码