用mysql建一张名为Employee的表,ID、NAME、DISPLAY_NAME
答案:1 悬赏:20 手机版
解决时间 2021-03-11 03:57
- 提问者网友:辞取
- 2021-03-10 22:39
并拿一个字段为例,写好增、删、改、查的语句,谢谢
最佳答案
- 五星知识达人网友:独钓一江月
- 2021-03-10 23:42
CREATE TABLE `Employee` ( `ID` int( 10 ) unsigned NOT NULL auto_increment ,
`NAME` varchar( 32 ) NOT NULL ,
`DISPLAY_NAME` varchar( 32 ) NOT NULL ,
PRIMARY KEY ( `ID` ) )
//add
$name=$_POST['name'];
$displayname=$_POST['displayname'];
mysql_query("INSERT INTO Employee SET NAME='$name',DISPLAY_NAME='$displayname'");
//remove
$id=intval($_REQUEST['ID']);
mysql_query("DELETe FROM Employee WHERe ID='$id'");
//UPDATe
mysql_query("UPDATE Employee SET NAME='$name',DISPLAY_NAME='$displayname' WHERe ID='$id'");
//select
$res=mysql_query("select 8 from Employee");
while($row=mysql_fetch_array($res))
{
echo "ID=".$row['ID']." NAME=".$row['NAME']." DISPLAY=".$row['DISPLAY_NAME']."<br>";
}
`NAME` varchar( 32 ) NOT NULL ,
`DISPLAY_NAME` varchar( 32 ) NOT NULL ,
PRIMARY KEY ( `ID` ) )
//add
$name=$_POST['name'];
$displayname=$_POST['displayname'];
mysql_query("INSERT INTO Employee SET NAME='$name',DISPLAY_NAME='$displayname'");
//remove
$id=intval($_REQUEST['ID']);
mysql_query("DELETe FROM Employee WHERe ID='$id'");
//UPDATe
mysql_query("UPDATE Employee SET NAME='$name',DISPLAY_NAME='$displayname' WHERe ID='$id'");
//select
$res=mysql_query("select 8 from Employee");
while($row=mysql_fetch_array($res))
{
echo "ID=".$row['ID']." NAME=".$row['NAME']." DISPLAY=".$row['DISPLAY_NAME']."<br>";
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯