FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
php-tool/SQL/MySQLi/MySQL.class.php at master · hyper-tool/php-tool · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
hyper-tool
/
php-tool
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
php-tool
/
SQL
/
MySQLi
/
MySQL.class.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (32 loc) · 895 Bytes
Breadcrumbs
php-tool
/
SQL
/
MySQLi
/
MySQL.class.php
Copy path
File metadata and controls
38 lines (32 loc) · 895 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
define
(
"
MYSQL_HOST
"
,
"
localhost
"
);
define
(
"
MYSQL_USER
"
,
"
root
"
);
define
(
"
MYSQL_PWD
"
,
"
***
"
);
define
(
"
MYSQL_DB
"
,
"
***
"
);
//数据库
define
(
"
MYSQL_CHARSET
"
,
"
UTF8
"
);
class
MySQL{
private
$
mysqli
;
public
function
__construct
(){
$
this
->
mysqli
=
new
MySQLi
(
MYSQL_HOST
,
MYSQL_USER
,
MYSQL_PWD
,
MYSQL_DB
);
$
this
->
mysqli
->
query
(
"
set names
"
.
MYSQL_CHARSET
);
}
public
function
execsql
(
$
sql
){
$
flag
=
$
this
->
mysqli
->
query
(
$
sql
);
if
(
$
flag
){
return
$
this
->
mysqli
->
affected_rows
;
//影响行数
}
else
{
return
$
flag
;
}
}
public
function
query
(
$
sql
){
$
res
=
$
this
->
mysqli
->
query
(
$
sql
);
$
data
=
array
();
while
(
$
row
=
$
res
->
fetch_assoc
()){
//结果
$
data
[] =
$
row
;
}
return
$
data
;
}
public
function
close
(){
$
this
->
mysqli
->
close
();
}
}
Back
|
FazBrowse Home
|
New Git URL