skyleft.com
域名年龄: 17年1个月18天HTTP/1.1 403 Forbidden 服务器:Beaver 缓存控制:不缓存 类型:text/html 文件大小:594 连接:关闭
北京php培训讲师方龙的博客专注于php培训及相关技术的学习和研究关于VIM中方向键不可用出现A,B,C,D怎么办?fanglor | 六月 4, 2014 | Leave your comment在VIM中,方向键不能使用,会出现A,B,C,D字符怎么设 ?Read more »Tags: set nocompatible, vim方向键不可用Posted in linux学习笔记 | Leave your commentphp如何用curl抓取远程图片并保存到本地?php培训讲师 | 二月 21, 2014 | Leave your comment用curl抓取远程图片并保存到本地, 关键是设置curl 的CURLOPT_FILE 参数,注意它的值为一个文件资源对象哦.Read more »Tags: curl, CURLOPT_FILE, phpPosted in php学习笔记 | Leave your comment如何设置apache的默认字符编码php培训讲师 | 二月 19, 2014 | Leave your comment教你如何通过AddDefaultCharset设置apache的默认字符编码Read more »Tags: AddDefaultCharsetPosted in linux学习笔记 | Leave your commentlinux中如何批量重命名文件?php培训讲师 | 二月 12, 2014 | Leave your commentlinux 批量重命名文件名Read more »Posted in linux学习笔记 | Leave your commentphp操作多数据库php培训讲师 | 五月 24, 2013 | Leave your comment以前写代码比较简单,还没有涉及到用PHP操作几个数据库的情况 。有次被人问到,请了半天,发现只要是连接了第二个数据库后面的操作都是针对第二个库的,第一个库的链接丢失了。这是怎么回事呢?今天有时候,特意看了下,原来 我用的是 mysql_connect ($host,$user,$password)直接链接的 .其它 mysql_connect 还有第四个参数 ,表示 是不是开启一个新连接。下面是测试代码 ,大家可以 参考 一下 。<!--?php /* * * Author : Fanglor * Email : Fanlor@163.com * @url : $Url$ * @date : $Date$ * @version : $Id$ */ class DB { protected $link = null; function __construct ($localhost,$user,$password,$db){ $this--->link = mysql_connect($localhost,$user,$password,<span style="color: #ff0000;">true</span>) or die('Could not connect to MySQL: ' . mysql_error());mysql_select_db ($db,<span style="color: #ff0000;">$this->link</span>);}function query ($sql) {var_dump ($this->link);return mysql_query ($sql,<span style="color: #ff0000;">$this->link</span>);}function findOne ($sql) {$rs = $this->query ($sql);if ($rs){return mysql_fetch_assoc ($rs);}return arary ();}function findAll ($sql) {$result = array ();$rs = $this->query ($sql);while ($row = mysql_fetch_assoc ($rs)){$result[] = $row;}return $result;}function close () {mysql_close (<span style="color: #ff0000;">$this->link</span>);}}$localhost = "localhost:3306";$localhost1 = "localhost:3307";$user = 'root';$password = '';$db1 = 'test';$db2 = 'test';$link1 = new DB($localhost,$user,$password,$db1); //连接第一个数据库$link2 = new DB($localhost1,$user,$password,$db2); //连接第二个数据库$rs1 = $link1->findOne("select * from user "); //从第一个库里查数据print_r ($rs1);$rs2 = $link2->findAll("select * from user "); //从第二个库里查数据print_r ($rs2);$rs1 = $link1->findOne("select * from user order by id desc limit 1 ");//再从第一个库里查数据print_r ($rs1);$rs2 = $link2->findOne("select * from user where id= 4
© 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询
2025-06-10 03:52, Process in 0.0094 second.