php 根据url传来参数查询数据库指定记录

php mysql查询类?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(‘对不起,你己被管理员锁定了’卡塔尔国;}elseif( $rs-m_del ==’1’卡塔尔{exit(‘此顾客己被删除’卡塔尔国;}else{$this-q_uid
=$id;$this-q_name=$rs-m_name;$this-q_head=$rs-m_head$this-q_sex
=$rs-sex == ‘1’? ‘男’:’女’;$this-q_reg
=$rs-m_time;$this-q_type=$rs-type;}}else{exit(‘客户不存了..a href=#
onclick=’history.back(卡塔尔国;’点击重临/a’卡塔尔;}}public
member_article(){$article_list =Select * from gx_q where
member_id=’$this-q_uid;if( ‘0’ == $this-query($article_list卡塔尔 卡塔尔国{echo
‘临时无新闻’;}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($resultState of Qatar;}}}?注:本站原创转发注脚:

$id =isset($_GET[‘id’])?$_GET[‘id’]:”;
if(!is_numeric($id) ){
 exit(“<script>alert(‘对不起,你所访谈的顾客不存了!’);history.back();</script>”);
}else{

 

 $sql =”select * from wk_member where id=’$id’ “;
 mysql教程_query(“update
wk_member set m_hit=m_hit+1 where id=’$id'”);
 mysql_query(“update wk_works set w_browse=w_browse+1 where
m_id=’$id'”);

 $result =mysql_query($sql) or die(mysql_error());
 if( mysql_num_rows($result) ){
  $rs =mysql_fetch_array($result);
  $no =$rs[‘m_uid’];
  $hit=$rs[‘m_hit’];
  mysql_free_result($result);
  $sql =”select * from wk_works where m_id=’$id'”;  
  $result =mysql_query($sql) or die(mysql_error().$sql);
  $w_dec    =’未写宣言’;
  $w_head    =’images/head.gif’;
  $w_support =0;
  $w_blog =’小编还未有上传小说’;

  
  
  if(mysql_num_rows($result)){
   $rs =mysql_fetch_array($result);
   $w_support =$rs[‘w_support’];
   $w_browse  =$rs[‘w_browse’];
   $w_dec    =$rs[‘w_dec’];
   $w_head    =$rs[‘w_lt’];
   $w_blog    =$rs[‘w_blog’];
  }
  
 }else{
  exit(“<script>alert(‘对不起,你所寻访的顾客不存了!’);history.back();</script>”);
 }
}

 

数据库教程一而再程序

mysql_connect(‘localhost’,’root’,’1******’) or die(‘database
server no exists!’);
 mysql_select_db(‘wk’) or die(‘database error!’); 
 mysql_query(“SET NAMES ‘gbk'”);//set document charset encode

站长钦点,那款没什么好钦赐的嘞,是大旨的mysql查询,然后拿走结果赋值给了相呼应的变量了。

本站原创转发注脚 www.111cn.net

发表评论

电子邮件地址不会被公开。 必填项已用*标注