>  기사  >  백엔드 개발  >  类写错了,如何只读一组数据

类写错了,如何只读一组数据

WBOY
WBOY원래의
2016-06-13 11:10:021036검색

类写错了,怎么只读一组数据
class_img.php

<br>	<?php <br /><br><br><br>class PicInfo<br>{ <br>	       // $sql= "select * from userinfo where username='$name' "; //书写sql <br>	public function PicInfo($sql)<br>	{<br>            require_once("db_config.php"); //包含配置信息. <br>	        $result= mysql_query($sql, $conn); // 执行查询语句<br>	        $this->picInfo = mysql_fetch_array($result); //返回查询结果到数组<br>		    $num_rows = mysql_num_rows($result);<br>			mysql_query("set names UTF8");<br>	        mysql_close($conn); //关闭数据库连接 <br>	        $this->getInfo($num_rows); //调用传递信息的方法.<br>	    } <br>	    // 获取信息传递给属性的方法<br>	<br>	    private function getInfo($num_rows){ <br>	        $this->pid = $this->picInfo["PID"]; <br>	        $this->b_img = $this->picInfo["B_img"];	<br>	        $this->m_img = $this->picInfo["M_img"];<br>			$this->s_img = $this->picInfo["S_img"];<br>			$this->indicate = $this->picInfo["Indicate"];<br>			$this->type = $this->picInfo["type"];<br>		   	$this->row = $this->picInfo['row']=$num_rows;<br>	    } <br>	      <br>	    //返回每个属性的public 方法. <br>		   public function getRow(){ <br>		<br>	        return $this->row; <br>	    } <br>	    public function getPid(){ <br>		<br>	        return $this->pid; <br>	    } <br>	      <br>	    public function getB_img(){ <br>	        return $this->b_img; <br>	    } <br>	       <br>	    public function getM_img(){ <br>	        return$this->m_img; <br>	    } <br>		  public function getS_img(){ <br>	        return$this->s_img; <br>	    } <br>		  public function getIndicate(){ <br>	        return$this->indicate; <br>	    } <br>		  public function getType(){ <br>	        return$this->type; <br>	    } <br>	<br>	}<br>	<br>	class edit_img<br>	{<br>	public function edit_img($sql)<br>	{<br>          require_once("db_config.php"); //包含配置信息. <br><br>	        $result= mysql_query($sql,$conn); // 执行查询语句<br>	     	$row=mysql_affected_rows(); //返回查询结果到数组<br>			if($row			{<br>				echo "<script>alert('没插入数据!')</script>";<br>				}<br>				else{<br>					echo "有".$row."组数据受到影响";<div class="clear">
                 
              
              
        
            </div>
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.