Hirdetés
- Apple asztali gépek
- Apple MacBook
- Csak a Battlefield 6-ra gyúr az új AMD Software
- Jövőre ígéri a combosabb AI gyorsítóját az Intel
- SSD kibeszélő
- AMD Ryzen 9 / 7 / 5 9***(X) "Zen 5" (AM5)
- Szünetmentes tápegységek (UPS)
- ROG Xbox Ally X: Összefogás
- Nikon Z MILC fényképezőgépcsalád
- Vezeték nélküli fülhallgatók
Ú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
- HP 14 Elitebook 640 G9 FHD IPS i5-1235U 4.4Ghz 10mag 16GB 256GB Intel Iris XE Win11 Pro Garancia
- Új Lenovo E14 Thinkpad WUXGA IPS Ryzen7 7730U 16GB 512GB SSD Radeon RX Vega8 Win11 Pro Garancia
- HP Z240 Komplett asztali pc, garanciával, 1050ti 4GB Videóval!
- i3 8100 és i5-9400 processzorok
- 6 és 7. generációs i3 és i5 procik
- GYÖNYÖRŰ iPhone 11 Pro 256GB Midnight Green -1 ÉV GARANCIA -Kártyafüggetlen, MS3370,94% Akkumulátor
- RÉSZLETRE . OPCIONÁLIS. HP EliteBook 840 G11 üzleti prémium laptop számlával és garanciával
- Lenovo ThinkPad X13 Gen 2 i5-1145G7 16GB 512GB FHD+ Érintőkijelző 100% sRGB - 1 év garancia
- Honor Magic5 Lite 128GB, Kártyafüggetlen, 1 Év Garanciával
- Update 10.08. Lenovo ThinkPad, X1 carbon, X1 Yoga 5-13. gen 12,5-15" all-in-one, Workstation
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Promenade Publishing House Kft.
Város: Budapest