Design and implementation of the inventory management system of PHP Small enterprise Code _php example

Source: Internet
Author: User

Double Professional graduation thesis made a small enterprise inventory management system, using PHP&MYSQL combination for development. The first time to develop something a little bigger, PHP is self-taught. I'd like to share it with you.

Check_login Module
Copy CodeThe code is as follows:

Session_Start ();
$workid =$_get[' wid '];//get work number
if ($workid!=$_session[' $workid ']| | $workid = = ") {
echo "";
}
?>

function.inc//mainly includes database connection module
Copy CodeThe 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 ());
}
Changing the client character set encoding to gb2312
mysql_query ("SET NAMES gb2312");
return $id;
}
?>

Warehouse Management Interface storage.php
Copy CodeThe code is as follows:

2 3 include "inc/check_login.php";
4 include "Inc/function.inc";
5 $id =mysql_link ("Storage", "storage");//Establish storage connection
6
7 $query = "SELECT * from admin where admin_id= ' $workid '";//Locate Warehouse
8 $result =mysql_query ($query, $id);
9 $info =mysql_fetch_array ($result, MYSQL_ASSOC);
$stoid = $info [' storage_id '];
?>





<title>Warehouse Management</title>





    • Log off

    • echo "
    • Finished
    • ";
      echo "
    • Out of the library
    • ";
      ?>











































































$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: ". $info [' Storage_tele '];if (!mysql_select_db ("Basicbase", $id)) {Die ("can\ ' t select_db:". Mysql_error ());}Build a warehouse cargo view, inbound view, and out-of-Library view in BasicbaseDetermine if there is a related view, and if not, create a new view$query = "SELECT * from". $stoid. " _inventory ";if (!mysql_query ($query, $id)) {Create a Inventory view$query = "CREATE View". $stoid. " _inventory asSelect 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 asSelect 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 an output view$query = "CREATE View". $stoid. " _output asSelect 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 in the warehouse." of goods. "; echo "per page". $pagesize. " Species, total ". $totalpage." Page. "; for ($j =1; $j <= $totalpage; $j + +) {echo "[". $j. "]";} echo ""; $query = "Select *from". $stoid. " _inventory ORDER BY goods_id limit $begin, $pagesize "; $result =mysql_query ($query, $id); $datanum =mysql_num_rows ($result); echo " "; echo " "; for ($i =1; $i <= $datanum; $i + +) {$info =mysql_fetch_array ($result, MYSQL_ASSOC);//echo " "; echo " "; } } } Mysql_close ($id);?>
Cargo ID Name of goods Quantity of goods
Cargo ID Name of goods Quantity of goods
". $info [' goods_id ']." ". $info [' name ']." ". $info [' number ']."
". $info [' goods_id ']." ". $info [' name ']." ". $info [' number ']."



All rights reserved: Freeze&zhaol
E-mail:zhoujiebin15@qq.com



Code too many do not post, first write encountered a lot of problems, but anyway, the program is still running up
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.