php - Cannot echo database items -
i trying echo out database items in php nothing seems coming out. initialize php required calls out database.php stores configurations show below.what doing wrong?
sql statement:
<?php require_once("includes/initialize.php"); $username = $_post["name"]; $useremail = $_post["email"]; $sqlname = "select name individual"; $sqlemail = "select email individual"; if ($sqlemail == $useremail || $sqlname == $username){ $message = "hi " + $username + "this new password."; echo $message; } ?>
the database configurations in php file called database.php.
database.php:
<?php require_once ("config.php"); class mysqldatabase { private $connection; function __construct() { $this->connection = mysqli_connect(db_server, db_user, db_pass, db_name) or die ("database connection failed: " . mysqli_connect_error() . " (" . mysqli_connect_errno() . ")" ); $db_select = mysqli_select_db($this->connection, db_name); } public function close_connection() { if (isset($this->connection)) { mysqli_close($this->connnection); unset($this->connection); } } public function query($sql) { $result = mysqli_query($this->connection, $sql); $this->confirm_query($result); return $result; } private function confirm_query($result) { if (!$result) { die("database query failed."); } } public function escape_value($string) { $escaped_string = mysqli_real_escape_string($this->connection, $string); return $escaped_string; } public function fetch_array($id){ if (mysqli_fetch_array($id)) { return true; } } } $database = new mysqldatabase(); $db = & $database; ?>
your not running query.. ..or getting results..
$sqlemail = "select email individual"; $query = $db->query($sqlemail); $user = $db->fetch_array($query); var_dumpr($user);
hope helps..
Comments
Post a Comment