<html>
<head>
<title>Test MySql Stored Procedure SQL Code via PHP Results</title>
</head>
<body style='background-color:pink;'>
<?php

 if (isset($_POST['host'])) {
   $ourhost=$_POST['host'];
 } else {
   $ourhost="localhost:8889";
 }
 if (isset($_POST['user'])) {
   $ouruser=$_POST['user'];
 } else {
   $ouruser="root";
 }
 if (isset($_POST['password'])) {
   $ourpassword=$_POST['password'];
 } else {
   $ourpassword="amnotsure";
 }


 mysql_connect($ourhost, $ouruser, $ourpassword);
 mysql_select_db($_POST['db']);
 if (isset($_POST['spqy'])) {
  if (strlen($_POST['spqy']) > 0) {
   $rspes = stripSlashes($_POST['spqy']);
   $spres = mysql_query($_POST['spqy']);
  }
 }
 if (isset($_POST['spqy2'])) {
  if (strlen($_POST['spqy2']) > 0) {
   $rspes = stripSlashes($_POST['spqy2']);
   $spres = mysql_query($_POST['spqy2']);
  }
 }
 if (isset($_POST['spqy3'])) {
  if (strlen($_POST['spqy3']) > 0) {
   $rspes = stripSlashes($_POST['spqy3']);
   $spres = mysql_query($_POST['spqy3']);
  }
 }
 if (isset($_POST['spqy4'])) {
  if (strlen($_POST['spqy4']) > 0) {
   $rspes = stripSlashes($_POST['spqy4']);
   $spres = mysql_query($_POST['spqy4']);
  }
 }
 $res = stripSlashes($_POST['qy']);
 $res = mysql_query($_POST['qy']);
?>

Query results <b><?php echo($_POST['qy']); ?></b><hr>

<?php
if ($res == 0):
  echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");
elseif (mysql_num_rows($res) == 0):
  echo("<b>Query executed successfully</b>");
else:
?>
<table border=1>
<thead>
<tr>
<?php
for ($ii = 0; $ii < mysql_num_fields($res); $ii++) {
 echo("<th>" . mysql_field_name($res,$ii) . "</th>");
}
?>
</tr>
</thead>
<tbody>
<?php
for ($ii = 0; $ii < mysql_num_rows($res); $ii++) {
 echo("<tr>");
 $r_array = mysql_fetch_row($res);
 for ($jj = 0; $jj < mysql_num_fields($res); $jj++) {
 echo("<td>" . $r_array[$jj] . "</td>");
 }
 echo("</tr>");
}
?>
</tbody>
</table>
<?php
endif
//mysql_close();
?>
<hr><br>
<a target=_blank href="./ourmysql_storedprocedure.php" title="Back">Back for more</a>
</body>
</html>

