DELIMITER $$ CREATE TRIGGER custLevel BEFORE INSERT ON customer FOR EACH ROW BEGIN DECLARE creditlim int; SET creditlim=_____; IF creditlim > 50000 THEN SET NEW.customerLevel = '1st Level '; _______(creditlim <= 50000 && creditlim >= 10000) THEN SET NEW.customerLevel = '2nd Level '; ELSEIF creditlim < 10000 THEN SET NEW.customerLevel = '3rd Level'; END _______ ; END $$ DELIMITER ;
DELIMITER $$ CREATE _______ priceIncrementByCat(in p_catname CHAR(20), in p_increment decimal(10,2)) BEGIN UPDATE product p,category c SET p.price=p.price*(1+p_increment) WHERE p.cid=c.cid AND c.cname=________; IF(ROW_COUNT()=0) THEN SELECT '类别名称不存在、或者该类别中无商品!' AS Result; ELSE SELECT CONCAT('类别:"',p_catname,'"中,有', ________,'件商品价格已被更新!') AS Result; END IF; END $$ DELIMITER ;
<?php $con=mysql_connect("localhost:3306","root","") or die("数据库服务器连接失败!<br>"); //**********found********** mysql_select_db("mysqltest", ________) or die( "数据库选择失败!<br>"); if(isset($_GET['del'])) { $sid=$_GET['del']; $delstudent='delete from student where sid='.$sid; //**********found********** _________($delstudent,$con); } $sql_student="SELECT sid,sname,score,deptname FROM student s,dept d where s.deptno=d.deptno"; $result_student=mysql_query($sql_student,$con); ?> <!-- **********found********** --> <_______ border='1px'> <tr> <td>结果序号</td> <td>学号</td> <td>姓名</td> <td>成绩</td> <td>系别名称</td> <td>操作</td> </tr> <?php //**********found********** $counter=_______; while($rows_student=mysql_fetch_array($result_student)){ $counter++; ?> <tr> <td><?php echo $counter; ?></td> <td><?php echo $rows_student[0];?></td> <td><?php echo $rows_student[1];?></td> <td><?php echo $rows_student[2];?></td> <td><?php echo $rows_student[3];?></td> <td><a href='sj3.php?del=<?php echo $rows_student[0];?>' onclick='return confirm("确定要删除吗")'>删除</a></td> </tr> <?php } mysql_close($con); ?> </table> <!-- **********found********** --> <br/>所有学生的信息(共有 <?php echo ____ ?> 人):<br/>
我们多看一些语法就知道PHP的语法知识套路了,你并且也可以熟悉PHP在操作MySQL的时候的一些套路了。