| <?php $con=mysql_connect("localhost","sharad","gupta"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("Employees", $con); print "<h2>MySQL: Simple Select statement</h2>"; $result = mysql_query("select * fromemp"); while($row = mysql_fetch_array($result)) { echo $row['id'] ."". $row['FirstName'] . "" . $row['LastName']; echo "<br/>"; } print "<h2>MySQL: Creating Stored Procedure</h2>"; $qry = mysql_query("create procedure user() select * from emp"); echo "Stored Procedure created."; mysql_query($qry,$con); print "<h2>MySQL: Calling Stored procedure</h2>"; $res = mysql_query("call user()"); while($row=mysql_fetch_array($res)) { echo $row['id'] ." ". $row['FirstName'] . " " . $row['LastName']; echo "<br/>"; } mysql_close($con); ?> |