MYSQL オペレーション クラス
Jun 13, 2016 pm 12:37 PM
复制代码代码如下:
<?php
class DB{
var $host_addr = "localhost";
var $host_user = "root";
var $host_psw = "123";
var $db_name = 「テスト」;
var $link_id;
var $query_id;
var $numRow;
function DB(){
$this->link_id = @mysql_connect($this->host_addr,$this->host_user,$this->host_psw);
if($this->link_id){
@mysql_select_db($this->db_name,$this->link_id) または $this->halt("数架连接失败!");
}else{
$this->halt("连接服务器失败!");
falseを返します。
}
return $this->link_id;
}
function query($sql){
$this->query_id = @mysql_query($sql,$this->link_id);
if($this->query_id){
return $this->query_id;
}else{
$this->halt("SQL Error::");
falseを返します。
}
}
function numRow(){
return $this->numRow = @mysql_num_rows($this->query_id);
}
function close(){
return @mysql_close($this->link_id);
}
function halt($msg){
echo "<font color="#FF0000">".$msg."</font>";
}
}
?>

人気の記事

人気の記事

ホットな記事タグ

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック











Ubuntu および Debian 用の PHP 8.4 インストールおよびアップグレード ガイド

MySQL 8.4 で mysql_native_password がロードされていないエラーを修正する方法

PHP 開発用に Visual Studio Code (VS Code) をセットアップする方法
