PHP MySQL Query class <?php
Class ring{
var $q _uid;
var $q _name;
var $q _type;
var $q _head;
var $q _sex;
var $q _reg;
Public Check_user ($id) {
$sql = "SELECT * from Gx_member where id= ' $id '";
$result =mysql_query ($sql) or Die (Mysql_error ());
if (mysql_num_rows ($result)) {
$rs =mysql_fetch_object ($result);
if ($rs->m_lock== ' 1 ') {
Exit (' Sorry, you have been locked by the Administrator ');
}elseif ($rs->m_del = = ' 1 ') {
Exit (' This user has already been deleted ');
}else{
$this->q_uid = $id;
$this->q_name= $rs->m_name;
$this->q_head= $rs->m_head
$this->q_sex = $rs->sex = = ' 1 '? ' Male ': ' Female ';
$this->q_reg = $rs->m_time;
$this->q_type= $rs->type;
}
}else{
Exit (' User not saved. <a href=# onclick= ' history.back (); ' > Click Back </a> ');
}
}
Public Member_article () {
$article _list = "SELECT * from Gx_q where member_id= ' $this->q_uid";
if (' 0 ' = = $this->query ($article _list)) {
Echo ' temporarily without information ';
}else{
foreach ($this->result as $list) {
$size =sizeof ($list);
for ($i =0; $i <= $size; $i + +) {
/* 222*/
}
}
}
Public query ($sql) {
if (empty ($sql)) {
Return ' 0 ';
}else{
$result =mysql_query ($sql) or Die (Mysql_error ());
if (mysql_num_rows ($result)) {
$array =array ();
while ($rs =mysql_fetch_array ($result))
$array []= $rs;
}
$this->result= $array;
}else{
Return ' 0 ';
}
Mysql_free_result ($result);
}
}
}
?>
Note: Original reprint of this site annotated: www.111cn.net