- Luck Dragon: Asszociációs játék. :)
- ubyegon2: Airfryer XL XXL forrólevegős sütő gyakorlati tanácsok, ötletek, receptek
- Sub-ZeRo: Euro Truck Simulator 2 & American Truck Simulator 1 (esetleg 2 majd, ha lesz) :)
- eBay-es kütyük kis pénzért
- MasterDeeJay: RAM gondolatok: Mennyi a minimum? DDR3 is jó?
- sziku69: Fűzzük össze a szavakat :)
- sziku69: Szólánc.
- sh4d0w: Nyitlocker
- gerner1
- kraftxld: Diáklaptop - Dell Latitude 3140 - Királyunk ajándéka
Új hozzászólás Aktív témák
-
papa019
senior tag
válasz
fordfairlane
#10160
üzenetére
Igen, ez egy minták alapján alakítgatott kód. Próbálok egy használható alkalmazást összerakni és tudom, hogy ez egy hozzáértő számára gányolt kód.
A $DB változóhoz tartozó kód:
$config = array();
$config['host'] = '127.0.0.1';
$config['user'] = 'root';
$config['pass'] = '';
$config['table'] = 'onlab';
class DB
{
/**
* @desc Creates the MySQLi object for usage.
*
* @param $db required connection params.
*/
public function __construct($db) {
$this->mysqli = new mysqli($db['host'], $db['user'], $db['pass'], $db['table']);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
}
/**
* @desc Simple preparation to clean the SQL/Setup Result Object.
*
* @param SQL statement
* @return
*/
public function Query($SQL)
{
$this->SQL = $this->mysqli->real_escape_string($SQL);
$this->Result = $this->mysqli->query($SQL);
if ($this->Result == true)
return true;
else
die('Problem with Query: ' . $this->SQL);
}
/**
* @desc Get the results
*
* @param $field Select a single field, or leave blank to select all.
* @return
*/
public function Get($field = NULL)
{
if ($field == NULL)
{
$data = array();
while ($row = $this->Result->fetch_array(MYSQLI_BOTH))
{
$data[] = $row;
}
}
else
{
$row = $this->Result->fetch_array(MYSQLI_BOTH);
$data = $row[$field];
}
/** Make sure to close the Result Set */
$this->Result->close();
return $data;
}
/**
* @desc Automatically close the connection when finished with this object.
*/
public function __destruct()
{
$this->mysqli->close();
}
}
$DB = new DB($config);
Új hozzászólás Aktív témák
Hirdetés
- 176 - Lenovo Legion Pro 7 (16IAX10H) - Intel Core U9 275HX, RTX 5080 (ELKELT)
- ThinkPad T14s Gen 2 i5-1135G7 16GB 512GB FHD 1 év garancia
- BESZÁMÍTÁS! MSI B650 R7 7700 32GB DDR5 1TB SSD RX 9070XT 16GB LIAN LI LANCOOL 217 Wood 750W
- Csere-Beszámítás! Playstation 5 Digital Edition ( PS5 Digitális konzol!)
- Telefon felvásárlás!! iPhone 11/iPhone 11 Pro/iPhone 11 Pro Max
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest

