欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-05-21 16:31:41
...
类写错了,怎么只读一组数据
class_img.php




class PicInfo
{
// $sql= "select * from userinfo where username='$name' "; //书写sql
public function PicInfo($sql)
{
require_once("db_config.php"); //包含配置信息.
$result= mysql_query($sql, $conn); // 执行查询语句
$this->picInfo = mysql_fetch_array($result); //返回查询结果到数组
$num_rows = mysql_num_rows($result);
mysql_query("set names UTF8");
mysql_close($conn); //关闭数据库连接
$this->getInfo($num_rows); //调用传递信息的方法.
}
// 获取信息传递给属性的方法

private function getInfo($num_rows){
$this->pid = $this->picInfo["PID"];
$this->b_img = $this->picInfo["B_img"];
$this->m_img = $this->picInfo["M_img"];
$this->s_img = $this->picInfo["S_img"];
$this->indicate = $this->picInfo["Indicate"];
$this->type = $this->picInfo["type"];
$this->row = $this->picInfo['row']=$num_rows;
}

//返回每个属性的public 方法.
public function getRow(){

return $this->row;
}
public function getPid(){

return $this->pid;
}

public function getB_img(){
return $this->b_img;
}

public function getM_img(){
return$this->m_img;
}
public function getS_img(){
return$this->s_img;
}
public function getIndicate(){
return$this->indicate;
}
public function getType(){
return$this->type;
}

}

class edit_img
{
public function edit_img($sql)
{
require_once("db_config.php"); //包含配置信息.

$result= mysql_query($sql,$conn); // 执行查询语句
$row=mysql_affected_rows(); //返回查询结果到数组
if($row {
echo "";
}
else{
echo "有".$row."组数据受到影响";
类写错了,如何只读一组数据

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频