Class Database

Documentation of includes/core/database.class.php

This Class extends the Class mysqli, so all the Properties and Methods this Class provides are available too.

Methods

select_one

Returns the first row of the results from your SQL query.

Description

mixed = select_one ( string $sql )

If null is returned and $aseco->db->errno is not 0, then your SQL query was wrong. Otherwise your SQL query does not match anything.

Parameters

  • $sql

    A sql select query

Example

$query = "
SELECT
    `PlayerId`,
    `Donations`
FROM `player_extra`
WHERE `Login` = 'puennt_ennel'
LIMIT 1;
";

$row = $aseco->db->select_one($query);

echo $row['PlayerId'];

Return Values

1188

select_all

Returns the all rows of the results from your SQL query.

Description

mixed = select_all ( string $sql )

If null is returned and $aseco->db->errno is not 0, then your SQL query was wrong. Otherwise your SQL query does not match anything.

Parameters

  • $sql

    A sql select query

Example

$query = "
SELECT
    `PlayerId`,
    `Donations`
FROM `player_extra`
WHERE `Login` NOT ''
LIMIT 100;
";

$row = $aseco->db->select_all($query);

foreach ($row as $item) {
    echo $item['PlayerId'];
}

Return Values

1188
147
247
6465
8721
6467
...

quote

Returns the escaped and quoted given string with '

Description

string = quote ( string $string )

Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and Control-Z.

Parameters

  • $string

    A string to be escaped and quoted with '

Example

$string = "Tricky Nickname '''";
$quoted = $aseco->db->quote($string);

Return Values

'Tricky Nickname \'\'\''

escape

Returns the escaped given string, this is an alias of $aseco->db->real_escape_string().

Description

string = escape ( string $string )

Characters encoded are NUL (ASCII 0), \n, \r, \, ', ", and Control-Z.

Parameters

  • $string

    A string to be escaped

Example

$string = "Tricky Nickname '''";
$escaped = $aseco->db->escape($string);

Return Values

Tricky Nickname \'\'\'

list_table_columns

Returns an array of table columns from the given table.

Description

array = list_table_columns ( string $table )

If the given table does not exists, a empty array is returned.

Parameters

  • $table

    A string of the wanted table

Example

$columns = $aseco->db->list_table_columns('players_extra');

Return Values

array(
  'PlayerId',
  'Cps',
  'DediCps',
  'Donations',
  'Style',
  'Panels',
  'PanelBG',
);

lastid

Returns the last inserted id, this is an alias of $aseco->db->insert_id.

Description

mixed = lastid ( void )

Example

$id = $aseco->db->lastid();

Return Values

1547

errmsg

Returns a formated and concated version of $aseco->db->errno and $aseco->db->error.

Description

string = errmsg ( void )

Example

$errmsg = $aseco->db->errmsg();

Return Values

(1193) Unknown system variable 'a'

disconnect

Calls mysqli->close(), but checks the connection first.

Description

void = disconnect ( void )

Example

$aseco->db->connection();

Class Database

Documentation of includes/core/database.class.php

This Class extends the Class mysqli, so all the Properties and Methods this Class provides are available too.

Properties

Members Description
$aseco->db->debug Holds the boolean debug status from connection
$aseco->db->settings Holds what the database has returned with the query SHOW VARIABLES
$aseco->db->table_prefix Holds the default table prefix uaseco_
$aseco->db->type Holds the current database type, possible values are MySQL or MariaDB
$aseco->db->version Holds the current database version (short), e.g. 5.7.16
$aseco->db->version_full Holds the current database version (full), e.g. 10.0.27-MariaDB-0ubuntu0.16.04.1

This is a private enthusiast Website. Maniaplanet, Trackmania, Shootmania, Nadeo are trademarks of Ubisoft Entertainment.
Windows is a registered trademark of Microsoft Corporation.

Last modified: Thu, 04 May 2017 21:03:12 +0200