- Poco F8 Ultra – forrónaci
- Xiaomi 17 Ultra - jó az optikája
- iPhone topik
- Redmi Note 9 Pro [joyeuse]
- Android alkalmazások - szoftver kibeszélő topik
- Samsung Galaxy S24 Ultra - ha működik, ne változtass!
- Google Pixel topik
- Samsung Galaxy S21 FE 5G - utóirat
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Itt a Galaxy S26 széria: az Ultra fejlődött, a másik kettő alig
Ú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
- Új Lenovo Thinkbook 14 G7 WUXGA IPS Ultra7 155H 16mag 32GB 1TB SSD Intel Arc Win11 Pro Garancia
- Új HP 16 Victus FHD IPS 144Hz Ryzen7 8845HS 5.1Ghz 16GB 1TB SSD Nvidia RTX 4060 8GB Win11 Garancia
- Új Asus Zenbook S14 WQXGA OLED 120Hz Ultra7 258V 32GB 1TB SSD Intel Arc 140V 16GB Win11 Garancia
- Asus 17 TUF Gaming FHD IPS 144Hz G-Sync Ryzen7 7435HS 16GB 512GB Nvidia RTX 4060 8GB Win11 Garancia
- Új Acer Nitro V15 FHD IPS 144Hz Ryzen7 7735HS 16GB DDR5 512GB SSD Nvidia RTX 4060 8GB Win11 Garancia
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest

