Home php教程 PHP源码 业务流 关联数据库 获取流程图

业务流 关联数据库 获取流程图

May 25, 2016 pm 05:10 PM

业务流  关联数据库  获取流程图

<?php
class dealEvent{
	private $host;
	private $user;        //mysql用户名 
	private $passWord;    //mysql密码 
	private $database;  //mysql数据库名 
	private $tables;  //表名 
	function __construct()
	{
		$this->host="localhost";
		$this->user="root";
		$this->passWord="sanyue@";
		$this->database="event";
		$this->tables="event";
		$conn=mysql_connect($this->host,$this->user,$this->passWord) or die("数据库打开出错"); 
	    mysql_select_db("event",$conn); 
		mysql_query(&#39;set names utf8&#39;);
	}
	//插入一个流程
	function insertProcess($arr,$proID)//将所选人员插入数据库
	{   
		for($m=0;$m<count($arr);$m++)
		{
			for($n=0;$n<count($arr[$m]);$n++)
			{
				$userName=$arr[$m][$n];
				$sql="Insert into event(proID,orderNum,userName,userOrder,dateTimes,status,memo)values($proID,$m,&#39;$userName&#39;,$n,NOW(),0,0)"; 
				$result=mysql_query($sql);
				$insert_num=mysql_affected_rows($result);
			}
		}
	}
	
	//proID事项ID
	function selectSameEvent($proID)
	{
		$sql = &#39;SELECT * FROM event where proID=&#39;.$proID." order by orderNum ASC"; 
		$result=mysql_query($sql);
		$array[] =mysql_fetch_assoc($result);
		while($row=mysql_fetch_assoc($result))
		{
			array_push($array,$row);
		}
		$array=$this->getArray($array,"userName");
		
		return $array;
		
	}
	
	function getDealStatus($proID)
	{
		$sql = &#39;SELECT * FROM event where proID=&#39;.$proID." order by orderNum ASC"; 
		$result=mysql_query($sql);
		$array[] =mysql_fetch_assoc($result);
		while($row=mysql_fetch_assoc($result))
		{
			array_push($array,$row);
		}
		$array=$this->getArray($array,"status");
		
		return $array;
	}
	
	//整理流程数组
	private function getArray($array,$fieldName)
	{
		for($i=0;$i<count($array);$i++)
		{
			$arr[$i]=$array[$i][&#39;orderNum&#39;];
		}

		sort($arr);//排序
		$cunt=array_count_values($arr);//计算数组中值出现的次数
		$index=0;
		for($n=0;$n<count($cunt);$n++)
		{
			for($m=0;$m<$cunt[$n];$m++)
			{
				$mode =$array[$index++][$fieldName]; 
				$array2[$n][$m]=$mode;
			}
		}
		return $array2;
	}
	
	function dealEvent($sqlWhere)
	{
		$sql="update event set status=$status where".$sqlWhere;
		$result=mysql_query($sql);
		if($result&&mysql_affected_rows()>0)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	
	
}

 ?>
Copy after login

2. [图片] 业务流.jpg

1206.jpg

 以上就是业务流  关联数据库  获取流程图的内容,更多相关内容请关注PHP中文网(www.php.cn)!


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)