I have a HTML form (Datadisplay.html) which uses the POST method to give (datadisplay.php) variables name and model, which are integrated into the SQL query ($sql). The problem is that php doesn't display any errors, but my query displays just blank, in the HTML.
I know for a fact the rest works since when I replace $this->name
and $this->model
for strings it does pull up the info. any help would be appreciated.
MYSQL TABLE AS
id int(11)
nombre varchar(100)
fecha_remision date
modelo varchar(100)
serial varchar(100)
numero_arraigo varchar(100)
DATA DISPLAY PHP
<?php
//ERROR_REPORTING( E_ALL | E_STRICT );
if(isset($_POST['type'])){
class DataDisplay
{
//Variable for MySql connection
private $hookup;
private $sql;
private $tableMaster;
private $name;
private $model;
public function __construct()
{
//Get table name and make connection
$this->table=$_POST['type'];
$this->hookup=UniversalConnect::doConnect();
$this->doDisplay();
$this->hookup->close();
$this->name=$_POST['name'];
$this->model=$_POST['model'];
}
private function doDisplay()
{
//Create Query Statement
$this->sql ="SELECT * FROM $this->table WHERE modelo='$this->model' AND
nombre='$this->name'";
try
{
$result = $this->hookup->query($this->sql);
while ($row = $result->fetch_assoc())
{
echo "<tr>";
echo "<td>id " . $row['id'] . "</td></br>";
echo "<td>Nombre " . $row['nombre'] . "</td></br>";
echo "<td>fecha de remision " . $row['fecha_remision'] . "</td></br>";
echo "<td>serial " . $row['serial'] . "</td></br>";
echo "<td>modelo " . $row['modelo'] . "</td></br>";
echo "<td>numero de arraigo " . $row['numero_arraigo'] . "</td></br>";
echo "</tr></br>";
}
$result->close();
}
catch(Exception $e)
{
echo "Here's what went wrong: " . $e->getMessage();
}
}
}
}
else
{
echo"<script>alert('selecciona tipo de activo');</script>";
}
?>
data display html
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/easy.css">
<meta charset="UTF-8">
<title>SCAF</title>
</head>
<body>
<header>
</header>
<div>
<h2>Consulta</h2>
</div>
<form action="Client.php" method="post" target="feedback">
<div><strong>informacion del activo:</strong><br />
<label for="name">Name:</label>
<input type="text" name="name" id="name">
<br />
<!--cambiar modelo por proyecto(propiedad de tabla), tambien cambiar por radios de
nombre de proyectos-->
<label for="model">modelo:</label>
<input type="text" name="model" id="model">
<br />
<p />
</div>
<div><strong>categoria</strong><br />
<label for="cs2">transporte:</label>
<input type="radio" name="type" id="cs2" value="transporte">
<br/>
<label for="cs1">maquinaria:</label>
<input type="radio" name="type" id="cs1" value="maquinaria">
<br/>
<label for="cs">maquinaria pesada:</label>
<input type="radio" name="type" id="cs" value="maquinaria pesada">
<br />
</div>
<br />
<div>
<input type="submit" name="all" value="buscar">
</div>
</form>
<p />
<div><strong></strong>
<p />
</div>
<iframe name="feedback" seamless width="300" height="200">PHP</iframe>
<div>
<p>
<a href="EasyUpdateOOP.html">Update and Drop Files</a>
</p>
</div>
</body>
</html>