Jump to Navigation

064 - Connecting to Multiple Database within Drupal

In the settings.php file, $db_url can be either a string (as it usually is) or an array composed of multiple
database connection strings.

Here's the default syntax, specifying a single connection string :

$db_url = 'mysql://username:password@localhost/databasename';

When using an array, the key is a shortcut name you will refer to while activating the database connection, and
the value is the connection string itself.

Here's an example where we specify two connection strings, default and legacy:

drupal:

063 - Connecting to the Database in Drupal

Drupal automatically establishs a connection to the database as part of its normal bootstrap process,
so you do not need to worry about doing that.
If you are working outside Drupal itself (for example, you're writing a stand-alone PHP script or have existing
PHP code outside of Drupal that needs access to Drupal's database)
You would use the following approach.

// Make  Drupal PHP's current directory

chdir('full/path/to/your/drupal/installation');

// Bootstrap Drupal up through the database phase

062 - Change from image1 to image2 by mouse

This is sample codes, when a user clicks on the image, it changes from pic_1.gif to pic_2.gif.

Example:

JavaScript:

061 - extract() function

The extract() function converts elements in an array into variables in their own right, an act commonly called "exporting"
in other languages. Extract takes a minimum of one parameter, an array, and returns the number of elements extracted.
The following example is useful for retriving information from database.

Example:

MySQL:

060 - mysqldump

This utility exports MySQL data and table structures. Typically, you use it to make backups of database or
to copy database from one server to another. You can run it on an active server.
For consistency of data between tables, the table should be locked (--lock-table option) or mysqld
daemon should be shutdown.
There are three syntaxes for this utility. The first method shown makes a backup of all databases for
the server. The second method backs up specific database, named in a space-separated list, including

MySQL:

059 - Show Status

SHOW statement display status information and variables from the server. You can reduce the number
of variables shown with the LIKE clause, based on a naming pattern for the variable name.
Similarly, the WHERE clause may be used to refine the results set. The following is an example
of how you can use this statement with the LIKE clause.

MySQL:

058 - Create MySQL Database for Drupal

To install drupal application, you have to create MySQL Database.

CREATE THE MySQL DATABASE
---------------------------------------------------------------------------

This step is only necessary if you don't already have a database set-up (e.g. by
your host). In the following examples, 'username' is an example MySQL user which
has the CREATE and GRANT privileges. Use the appropriate user name for your
system.

First, you must create a new database for your Drupal site (here, 'databasename'
is the name of the new database):

drupal:

057 - SQL Quick Reference

SQL Condition Clauses:

field = value
field > value
field >= value
filed != value (field is not equal to value)
field <> value (field is not equal to value)
field BETWEEN value1 and value2
field LIKE value
field NOT LIKE vale
field is NULL
field IN (value1, value2, value3, value4)
field NOT IN (value1, value2, value3)

Selecting from Multiple table:

MySQL:

056 - Linux Filesystems

ext3:
Most current Linux distributions default to the Third Extended(ext3) file system. The ext3 filesystem was
developed primary for Linux and supports 256-character filenames and 4-terabyte maximum filesystem size.
This ext3 filesystem is essentially a Second Extended (ext2) filesystem with added journal.since it is in all
other ways identical to the ext2 system, it is both forward- and backward- compatible with ext2-all ext2
utilities work with ext3 filesystem.

055 - Source Code Management

SCCS:
The Source Code Control System. SCCS is the original Unix source code management system.
It was developed in the late 1970s for the Programmer's Workbench(PWB) Unix systems within Bell Labs.
It is still in use at a few large longtime Unix sites. However, for a long time it was not available as a
standard part of most commercial or BSD Unix systems, and it did not achieve the widespread popularity
of other, later systems. (It is still available with Solaris.) SCCS uses a file storage format that allows it to

Linux:

Pages

Subscribe to LAMP, Database and Cloud Technical Information RSS


Main menu 2

by Dr. Radut