//************************************** // Name: Calling a Stored Procedure in PHP and MySQL // Description:In this article I would like to share with you a code that I wrote to call a stored procedure in PHP and MySQL. I am a beginner in writing store procedures in MySQL using PHP I am still learning on it. I would like to thank my professor Sir Jeffric So Pisuena for teaching us how to create stored procedure in PHP and MySQL. I am currently accepting programming work, it projects, school programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you. My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360. My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675. My personal website is http://www.jakerpomperada.com // By: Jake R. Pomperada // // // Inputs:None // // Returns:None // //Assumes:None // //Side Effects:None //************************************** <?php //including the database connection file include_once("classes/Crud.php"); $crud = new Crud(); //fetching data in descending order (lastest entry first) // Calling the Stored Procedure display_users() $query = "CALL display_users()"; //$query = "SELECT * FROM users ORDER BY id DESC"; $result = $crud->getData($query); //echo '<pre>'; print_r($result); exit; ?> <html> <head> <title>Homepage</title> </head> <body> <a href="add.html">Add New Data</a><br/><br/> <table width='80%' border=0> <tr bgcolor='#CCCCCC'> <td>Name</td> <td>Age</td> <td>Email</td> <td>Update</td> </tr> <?php foreach ($result as $key => $res) { //while($res = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>".$res['name']."</td>"; echo "<td>".$res['age']."</td>"; echo "<td>".$res['email']."</td>"; echo "<td><a href=\"edit.php?id=$res[id]\">Edit</a> | <a href=\"delete.php?id=$res[id]\" onClick=\"return confirm('Are you sure you want to delete?')\">Delete</a></td>"; } ?> </table> </body> </html>