Replacing In Database
|
xdd_replace([DATABASE-FILE], [ENTRY-ID], {OPTION}, {OPTION})
|
[DATABASE-FILE]
Database File Path Location. This field should contain a relative path to either an existing database file, or one to be written. The name or extension of the file is a user choice. Many use .txt files or .db files.
[ENTRY-ID]
Entry identifier used to read, delete and replace entries. This string (text) can contain virtually any text.
{OPTION}
These are the locations of optional commands. They can be interchanged, and given in any order. Here is a list of optional commands for this function, and their properties.
"ID_OVERRIDE"
Stops the system from converting the specified ID to <!--ID-->. This is useful when searching for phrases or words instead of a default entry ID.
"NONCASE"
With NONCASE enabled the system will conduct a non-case sensitive search. Otherwise, "test", "TEST" and "tEsT" are seen as different words.
How It Works
xdd_replace() allows you to delete one or more entries and add a single entry with one function call. It is useful to note how this works. If you are using the ID_OVERRIDE command and deleting all previous entries with the word "test", the new entry will still be added with the default entry ID <!--test-->. Also, no matter the number of entries deleted, only one entry will be added to the database.
Example Usage:
These are some examples on the usage of this function. You can use these examples as templates for your own application, or in unison with the information above to learn more.
Delete all previous entries containing <!--Greeting--> and add "Hello How Are You Doing?" to "database.db" with the ID "Greeting"
|
<?php
xdd_replace("database.db", "Greeting", "Hello How Are You Doing?");
?>
|
Delete all previous entries containing the word "Greeting" (Non-Case Sensitive) and add "Hello How Are You Doing?" to "database.db" with the ID "Greeting"
|
<?php
xdd_replace("database.db", "Greeting", "Hello How Are You Doing?", "ID_OVERRIDE", "NONCASE");
?>
|
|