1 Star 0 Fork 1

yihoc/WEBWMS

forked from gujiejing/WEBWMS 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
modcust.php 3.04 KB
一键复制 编辑 原始数据 按行查看 历史
<?php
require_once('connDB.php');
$id = " ";
$custidt=" ";
$custcnt=" ";
$custent= " ";
$addrt=" ";
$telt=" ";
$contactt=" ";
$typet = " ";
if(isset($_POST['custid'])){
//echo $_POST['custid'];
$id = $_POST['id'];
//echo $id;
$custidt = $_POST['custid'];
$custcnt = $_POST['custcn'];
$custent = $_POST['custen'];
$addrt = $_POST['addr'];
$telt = $_POST['tel'];
$contactt = $_POST['contact'];
$typet = $_POST['type'];
$sql="UPDATE cust SET custid = '$custidt', ".
"custcn = '$custcnt', ".
"custen = '$custent', ".
"addr = '$addrt', ".
"tel = '$telt', ".
"contact = '$contactt', ".
"type = '$typet' ".
"WHERE cust.id = $id ";
//$sql="UPDATE cust SET custid = '$_POST['custid']', custcn = '$_POST['custcn']', custen = '$_POST['custen']', addr = '$_POST['addr']', tel = '$_POST['tel']', contact = '$_POST['contact']' WHERE cust.id = $id ";
echo $sql;
mysql_query($sql,$dbc);
mysql_close($dbc);
header("Location: " ."cust.php" );
/*
UPDATE cust SET custid = 'Test5',
custcn = '测试客户5',
custen = 'Test5 Customer',
addr = 'wuwuwuwuw',
tel = '1123400234',
contact = 'woziji' WHERE cust.id =2;
*/
}
if(isset($_GET['id'])){
$id = $_GET['id'];
$dbc = mysql_connect("localhost","root","root");
mysql_select_db("webwms",$dbc);
mysql_query("set names utf8");
$sql="SELECT * FROM cust WHERE id = $id;";
$result = mysql_query($sql,$dbc);
$row_Rec = mysql_fetch_assoc($result);
echo json_encode($row_Rec);
return;
}
/*
if(isset($_GET['id'])){
//echo $_GET['id'];
$id = $_GET['id'];
$dbc = mysql_connect("localhost","root","root");
mysql_select_db("webwms",$dbc);
mysql_query("set names utf8");
$sql="SELECT * FROM cust WHERE id = $id;";
$result = mysql_query($sql,$dbc);
$row_Rec = mysql_fetch_assoc($result);
echo '<form action="modcust.php" method="POST">';
echo '<input name="id" type="hidden" id="id" value="'.
$id .'"/>';
echo '<label>客户ID</label>';
echo '<input type="text" id="custid" = name="custid" value="'.$row_Rec['custid'].'" /><br>(*只可英文字符,不可为空*)<br>';
echo '<label>客户中文名</label>';
echo '<input type="text" id="custcn" = name="custcn" value="'.$row_Rec['custcn'].'" /><br>';
echo '<label>客户英文名</label>';
echo '<input type="text" id="custen" = name="custen" value="'.$row_Rec['custen'].'" /><br>';
echo '<label>客户地址</label>';
echo '<input type="text" id="addr" = name="addr" value="'.$row_Rec['addr'].'" /><br>';
echo '<label>客户电话</label>';
echo '<input type="text" id="tel" = name="tel" value="'.$row_Rec['tel'].'" /><br>';
echo '<label>客户联系人</label>';
echo '<input type="text" id="contact" = name="contact" value="'.$row_Rec['contact'].'" /><br>';
echo '<input type="submit" value="Update" name="submit" />';
echo '</form>';
mysql_free_result($result);
mysql_close($dbc);
}
*/
//SELECT * FROM cust WHERE id =2
?>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/yihoc/WEBWMS.git
git@gitee.com:yihoc/WEBWMS.git
yihoc
WEBWMS
WEBWMS
master

搜索帮助