Hello,
I am writing a data retrieval script, printing the data found on a DB. For some reason the script does not work..
More details..
the HTML form that calls the initiator..
<form method='get' action="init.Get.php">
<div><input type="submit" name="get" value="See Data"></div>
</form>
the initiator script..
<?php
include 'dataGet.class.php';
$data= new getData();
$data= retrData($name, $email, $text);
?>
and my class
<?php
class getData {
private $name;
private $email;
private $text;
function getData(){
$this->host = 'localhost';
$this->uname = 'root';
$this->pword = '9189';
$this->dbname = 'teststorage';
$this->dbtable = 'userData';
}
function retrData($name, $email, $text){
$this->dbconnect = mysql_connect($this->host, $this->uname, $this->pword);
if (!$this->dbconnect) die("Connection Unable " . mysql_error());
mysql_select_db($this->dbname);
$sql_query = "SELECT * FROM $this->dbtable ";//WHERE name = '$name' , email = '$email' AND text = '$text'";
$result = mysql_query($sql_query);
if ($result){
echo $result;
}
else{
echo "Retrieval Unsuccesful";
}
mysql_close($sql_query);
}
}
?>
Can someone please what is wrong in this picture? Why doesn't it work?
Thank you in advance.