tinh_lib
<?php
function init(){
$connect=mysql_connect('localhost','root','1');
mysql_select_db('test',$connect);
mysql_query("create table if not exists tinh1( id char(2) not null, name char(64), primary key (id))");
}
function add($ma, $name){
mysql_query("insert into tinh1 values('$ma','$name')");
}
function update($key, $ma,$name){
mysql_query("update tinh1 set id = '$ma', name = '$name' where id = '$key'");
}
function del($ma){
mysql_query("delete from tinh1 where id = '$ma'");
}
function find_one ($ma=''){
return mysql_query("select * from tinh1 where id='$ma'");
}
function find_some($ma='',$name=''){
return mysql_query("select * from tinh1 where id like '%$ma%' and name like '%$name%'");
}
?>
Bạn đang đọc truyện trên: truyentop.pro