Home >
Article > Backend Development > Design and implementation code of PHP small business inventory management system_PHP tutorial
Design and implementation code of PHP small business inventory management system_PHP tutorial
WBOYOriginal
2016-07-21 15:29:49890browse
Double major graduation thesis is a small business inventory management system, developed using a combination of PHP & mysql. This is my first time to develop something a little larger, and I also learned PHP by myself. Here I want to share it with you
check_login module
Copy code The code is as follows:
session_start(); $workid=$_GET['wid'];//Get the work ID if($workid!=$_SESSION['$workid'] ||$workid==''){ echo "} ?>
function.inc//Mainly includes the database connection module
Copy code The code is as follows:
function mysql_link($user="admin",$password="admin",$database="systembase"){ $ id=mysql_connect("localhost",$user,$password); if(!$id){ die('Could not connect: ' . mysql_error()); } if (!mysql_select_db($database,$id)){ die ("Can't select_db : " . mysql_error()); } //Change the client character set encoding to gb2312 mysql_query("SET NAMES gb2312"); return $id; } ?>
Warehouse management interface storage.php
Copy code The code is as follows:
2 3 include "inc/check_login.php"; 4 include "inc/function.inc"; 5 $id=mysql_link("storage","storage");//建立storage连接 6 7 $query="select * from admin where admin_id='$workid'";//定位仓库 8 $result=mysql_query($query,$id); 9 $info=mysql_fetch_array($result,MYSQL_ASSOC); $stoid=$info['storage_id']; ?>
$query="select * from storage where storage_id='$stoid'";//Locate warehouse information $result =mysql_query($query,$id); if(mysql_num_rows($result)<1){ echo "No warehouse".$stoid; }else{ $info=mysql_fetch_array ($result,MYSQL_ASSOC); echo "Warehouse number:".$stoid." Total capacity: ".$info['storage_cap']." Remaining capacity: ".$info['storage_lcap']." Warehouse address: ".$info['storage_add']." Warehouse phone number: ".$info['storage_tele']; if (!mysql_select_db("basicbase",$id)){ die ("Can't select_db : " . mysql_error()); } //Establish the corresponding warehouse cargo view, inbound view and outbound view in basicbase //Determine whether there are related views, If not, create a new view $query="select * from ".$stoid."_inventory"; if(!mysql_query($query,$id)){ //Create inventory view $query="create view ".$stoid."_inventory as select inventory.goods_id,name,number from inventory,systembase.goods where storage_id=".$stoid." and inventory.goods_id=systembase.goods. goods_id"; if(!mysql_query($query,$id)){ die ("Can't create_view_inventory : " . mysql_error()); } //Create input view $query="create view ".$stoid."_input as select input_id,goods_id,number,time from input where admin_id=".$workid; if(!mysql_query($query,$id )){ die ("Can't create_view_input : " . mysql_error()); } //Create output view $query="create view ".$stoid."_output as select output_id,goods_id,number,time from output where admin_id=".$workid; if(!mysql_query($query,$id)){ die ("Can't create_view_output : " . mysql_error()); } } $query="select * from ".$stoid."_inventory"; $result=mysql_query($query,$id); if(mysql_num_rows($result)<1){ echo " The warehouse is currently empty"; }else{ $totalnum=mysql_num_rows($result); $pagesize=7; $page=$_GET["page"]; if(""==$page){ $page=1; } $begin= ($page-1)*$pagesize; $totalpage=ceil($totalnum/$pagesize);
echo "
There are ".$totalnum." kinds of goods in the warehouse. "; echo "Each page".$pagesize." type, total ".$totalpage." pages.
There are too many codes to post one by one. I encountered many problems when writing it for the first time, but the program still ran anyway
http://www.bkjia.com/PHPjc/323335.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323335.htmlTechArticleDual major graduation thesis made a small business inventory management system, using PHPlt;!--User login inspection module- - ?php session_start(); $workid=$_GET['wid'];//Get the work ID if($workid!...
Statement:
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