Public Method Details |
connect |
public mixed connect( string $dbh, string $dbu, string $dbp )
|
|
Connect to MySQL database and return link.
|
Parameter |
|
string |
$dbh |
|
|
hostname of MySQL server |
|
|
string |
$dbu |
|
|
user name to logon to MySQL server |
|
|
string |
$dbp |
|
|
password to logon to MySQL server |
|
Returns |
mixed on successful connect, the DB link
on error, returns false |
|
sel_db |
public boolean sel_db( string $dbn, integer $dbl )
|
|
Select MySQL database.
|
Parameter |
|
string |
$dbn |
|
|
database name |
|
|
integer |
$dbl |
|
|
link to MySQL connection |
|
Returns |
boolean true if successful, otherwise false |
|
query_fetch |
public mixed query_fetch( string $query, integer $dbl )
|
|
Perform MySQL query and fetch result as array if SELECT query.
|
Parameter |
|
string |
$query |
|
|
database name |
|
|
integer |
$dbl |
|
|
link to MySQL connection |
|
Returns |
mixed if $query is a SELECT query, the resulting array,
otherwise true if successful, false if not |
|
query_fetch_all |
public mixed query_fetch_all( string $query, integer $dbl )
|
|
Perform MySQL query and fetch all results as array.
Note: use this method only for SELECT queries on the "items" table!
|
Parameter |
|
string |
$query |
|
|
database name |
|
|
integer |
$dbl |
|
|
link to MySQL connection |
|
Returns |
mixed if successful, the resulting array, as follows:
row["id"] = array(level, name, link, auth)
if unsuccessful, false |
Required global variables |
|
string $main_frame_name |
- name of the "main" frame |
|
|
ins_item |
public boolean ins_item( integer $id, integer $level, string $name, string $link, string $auth )
|
|
Insert a row in the "items" table safely.
Because the "items" table is reliant on the "id" field as a positional_parameter, you can't just do a "INSERT INTO" query, you have to make sure_the "id" field of the row already there and of the rows above are added by_one to make room for this row. This method does that.
|
Parameter |
|
integer |
$id |
|
|
ID of the item |
|
|
integer |
$level |
|
|
level of the item in the site map |
|
|
string |
$name |
|
|
name of the item |
|
|
string |
$link |
|
|
link to the page, or empty if only container
without its own link |
|
|
string |
$auth |
|
|
"true" or "false", whether this item is a link in
authorized mode or not |
|
Returns |
boolean true if successful, false if not |
Required global variables |
|
$db_host |
- hostname of the MySQL server |
|
|
$db_user |
- username to logon to MySQL server |
|
|
$db_pass |
- password to logon to MySQL server |
|
|
$db_name |
- name of the MySQL site map database |
|
|
del_item |
public boolean del_item( integer $id )
|
|
Delete a row from the "items" table safely.
Because the items table is reliant on the "id" field as a positional_parameter, you can't just do a "DELETE FROM" query, you have to make sure_the "id" field of the rows above the deleted row are subtracted by_one to remove the gap that deleting a row produces. This method does that.
|
Parameter |
|
integer |
$id |
|
|
ID of the item |
|
Returns |
boolean true if successful, false if not |
Required global variables |
|
$db_host |
- hostname of the MySQL server |
|
|
$db_user |
- username to logon to MySQL server |
|
|
$db_pass |
- password to logon to MySQL server |
|
|
$db_name |
- name of the MySQL site map database |
|
|
empty_items |
public boolean empty_items( )
|
|
Make a connection to the MySQL server and simply empty the "items" table.
|
Returns |
boolean true if successful, false if not |
Required global variables |
|
$db_host |
- hostname of the MySQL server |
|
|
$db_user |
- username to logon to the MySQL server |
|
|
$db_pass |
- password to logon to the MySQL server |
|
|
$db_name |
- name of the MySQL site map database |
|
|