removed bck files and imporved passowrd on env
This commit is contained in:
@@ -1,84 +0,0 @@
|
||||
<?php
|
||||
|
||||
Class Dropdown
|
||||
{
|
||||
|
||||
private $host = 'localhost';
|
||||
private $username = 'u00wiumd4xnrd';
|
||||
private $password = 'ukowysga7w5x';
|
||||
private $dbname = 'dbcov4clvrmrzn';
|
||||
private $connection;
|
||||
|
||||
//establish connection
|
||||
public function __construct()
|
||||
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
$this->connection = new mysqli($this->host, $this->username, $this->password, $this->dbname);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
echo "Connection error " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//fetch all country records from database
|
||||
public function fetchCountry()
|
||||
{
|
||||
$data = null;
|
||||
|
||||
$query = "SELECT * FROM article_type ORDER BY article_type.name_articletype";
|
||||
|
||||
if ($sql = $this->connection->query($query))
|
||||
{
|
||||
while ($rows = mysqli_fetch_assoc($sql))
|
||||
{
|
||||
$data[] = $rows;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
//fetch model records from database depend upon country id
|
||||
public function fetchModel($idarticletype)
|
||||
{
|
||||
$data = null;
|
||||
|
||||
$query = "SELECT * FROM modelarticle WHERE idarticletype='".$idarticletype."' ";
|
||||
|
||||
if ($sql = $this->connection->query($query))
|
||||
{
|
||||
while ($rows = mysqli_fetch_assoc($sql))
|
||||
{
|
||||
$data[] = $rows;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
//fetch Charact records from database depend on article type
|
||||
public function fetchCharact($idarticletype)
|
||||
{
|
||||
$data = null;
|
||||
|
||||
$query = "SELECT * FROM article_characteristic WHERE idarticletype='".$idarticletype."' ";
|
||||
|
||||
if ($sql = $this->connection->query($query))
|
||||
{
|
||||
while ($rows = mysqli_fetch_assoc($sql))
|
||||
{
|
||||
$data[] = $rows;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
+73
-58
@@ -1,96 +1,111 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
Class Dropdown
|
||||
class Dropdown
|
||||
{
|
||||
|
||||
private $host = 'localhost';
|
||||
private $username = 'u00wiumd4xnrd';
|
||||
private $password = 'ukowysga7w5x';
|
||||
private $dbname = 'dbcov4clvrmrzn';
|
||||
private $host;
|
||||
private $username;
|
||||
private $password;
|
||||
private $dbname;
|
||||
private $connection;
|
||||
|
||||
//establish connection
|
||||
// Establish connection
|
||||
public function __construct()
|
||||
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
$this->connection = new mysqli($this->host, $this->username, $this->password, $this->dbname);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Load Composer and .env
|
||||
|--------------------------------------------------------------------------
|
||||
| This file is inside: cmccopiaoriginale/public/ddown/
|
||||
| vendor and .env are inside: cmccopiaoriginale/
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/../../');
|
||||
$dotenv->safeLoad();
|
||||
|
||||
$this->host = $_ENV['DB_HOST'] ?? getenv('DB_HOST') ?? 'localhost';
|
||||
$this->username = $_ENV['DB_USERNAME'] ?? getenv('DB_USERNAME') ?? '';
|
||||
$this->password = $_ENV['DB_PASSWORD'] ?? getenv('DB_PASSWORD') ?? '';
|
||||
$this->dbname = $_ENV['DB_DATABASE'] ?? getenv('DB_DATABASE') ?? '';
|
||||
|
||||
try {
|
||||
$this->connection = new mysqli(
|
||||
$this->host,
|
||||
$this->username,
|
||||
$this->password,
|
||||
$this->dbname
|
||||
);
|
||||
|
||||
if ($this->connection->connect_error) {
|
||||
throw new Exception($this->connection->connect_error);
|
||||
}
|
||||
|
||||
$this->connection->set_charset("utf8mb4");
|
||||
} catch (Exception $e) {
|
||||
echo "Connection error " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//fetch all country records from database
|
||||
// Fetch all article type records from database
|
||||
public function fetchCountry()
|
||||
{
|
||||
$data = null;
|
||||
|
||||
$query = "SELECT * FROM article_type ORDER BY article_type.name_articletype";
|
||||
|
||||
if ($sql = $this->connection->query($query))
|
||||
{
|
||||
while ($rows = mysqli_fetch_assoc($sql))
|
||||
{
|
||||
if ($sql = $this->connection->query($query)) {
|
||||
while ($rows = mysqli_fetch_assoc($sql)) {
|
||||
$data[] = $rows;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
//fetch model records from database depend upon country id
|
||||
|
||||
// Fetch model records from database depending on article type id
|
||||
public function fetchModel($idarticletype)
|
||||
{
|
||||
$data = null;
|
||||
|
||||
$query = "SELECT * FROM modelarticle WHERE idarticletype='".$idarticletype."' ";
|
||||
$idarticletype = (int)$idarticletype;
|
||||
|
||||
if ($sql = $this->connection->query($query))
|
||||
{
|
||||
while ($rows = mysqli_fetch_assoc($sql))
|
||||
{
|
||||
$query = "SELECT * FROM modelarticle WHERE idarticletype = $idarticletype";
|
||||
|
||||
if ($sql = $this->connection->query($query)) {
|
||||
while ($rows = mysqli_fetch_assoc($sql)) {
|
||||
$data[] = $rows;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
//fetch Charact records from database depend on article type
|
||||
public function fetchCharact($idarticletype)
|
||||
{
|
||||
$data = null;
|
||||
|
||||
$idarticletype = (int)$idarticletype;
|
||||
// Fetch characteristic records from database depending on article type
|
||||
public function fetchCharact($idarticletype)
|
||||
{
|
||||
$data = null;
|
||||
|
||||
$query = "
|
||||
SELECT DISTINCT
|
||||
ac.*
|
||||
FROM article_characteristic ac
|
||||
INNER JOIN standards s
|
||||
ON s.idarticlecharacteristic = ac.idarticlecharacteristic
|
||||
AND s.idarticletype = ac.idarticletype
|
||||
WHERE ac.idarticletype = $idarticletype
|
||||
AND s.active = 'Y'
|
||||
ORDER BY ac.name_articlecharacteristic
|
||||
";
|
||||
$idarticletype = (int)$idarticletype;
|
||||
|
||||
if ($sql = $this->connection->query($query))
|
||||
{
|
||||
while ($rows = mysqli_fetch_assoc($sql))
|
||||
{
|
||||
$data[] = $rows;
|
||||
}
|
||||
}
|
||||
$query = "
|
||||
SELECT DISTINCT
|
||||
ac.*
|
||||
FROM article_characteristic ac
|
||||
INNER JOIN standards s
|
||||
ON s.idarticlecharacteristic = ac.idarticlecharacteristic
|
||||
AND s.idarticletype = ac.idarticletype
|
||||
WHERE ac.idarticletype = $idarticletype
|
||||
AND s.active = 'Y'
|
||||
ORDER BY ac.name_articlecharacteristic
|
||||
";
|
||||
|
||||
return $data;
|
||||
if ($sql = $this->connection->query($query)) {
|
||||
while ($rows = mysqli_fetch_assoc($sql)) {
|
||||
$data[] = $rows;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,84 +0,0 @@
|
||||
<?php
|
||||
|
||||
Class Dropdown
|
||||
{
|
||||
|
||||
private $host = 'localhost';
|
||||
private $username = 'u00wiumd4xnrd';
|
||||
private $password = 'ukowysga7w5x';
|
||||
private $dbname = 'dbcov4clvrmrzn';
|
||||
private $connection;
|
||||
|
||||
//establish connection
|
||||
public function __construct()
|
||||
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
$this->connection = new mysqli($this->host, $this->username, $this->password, $this->dbname);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
echo "Connection error " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//fetch all country records from database
|
||||
public function fetchCountry()
|
||||
{
|
||||
$data = null;
|
||||
|
||||
$query = "SELECT * FROM article_type ORDER BY article_type.name_articletype";
|
||||
|
||||
if ($sql = $this->connection->query($query))
|
||||
{
|
||||
while ($rows = mysqli_fetch_assoc($sql))
|
||||
{
|
||||
$data[] = $rows;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
//fetch model records from database depend upon country id
|
||||
public function fetchModel($idarticletype)
|
||||
{
|
||||
$data = null;
|
||||
|
||||
$query = "SELECT * FROM modelarticle WHERE idarticletype='".$idarticletype."' ";
|
||||
|
||||
if ($sql = $this->connection->query($query))
|
||||
{
|
||||
while ($rows = mysqli_fetch_assoc($sql))
|
||||
{
|
||||
$data[] = $rows;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
//fetch Charact records from database depend on article type
|
||||
public function fetchCharact($idarticletype)
|
||||
{
|
||||
$data = null;
|
||||
|
||||
$query = "SELECT * FROM article_characteristic WHERE idarticletype='".$idarticletype."' ";
|
||||
|
||||
if ($sql = $this->connection->query($query))
|
||||
{
|
||||
while ($rows = mysqli_fetch_assoc($sql))
|
||||
{
|
||||
$data[] = $rows;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user