Link Building An Important SEO Strategy 40

From IVP Wiki
Revision as of 14:54, 3 March 2011 by 72.11.138.217 (talk) (New page: thumb| Difficulty: Moderate Instructions 1 Design your database structure. A relational database yous single that consists about Entities also their Rela...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Error creating thumbnail: Unable to save thumbnail to destination

Difficulty: Moderate Instructions

1 Design your database structure. A relational database yous single that consists about Entities also their Relations . Each and every Entity represents an object of some kind inside your application. An instance regarding this might be a Client in a commercial application. In similar any database here might be any Client Entity and a Transaction Entity. Each and every Entity would have some corresponding table in the database. Design your database with an abstract way first, deciding on the Entities you need.

2 Decide on a list of attributes for each regarding your Entities. The attributes are the characteristics about one Entity that is you want to store for each record with the database. With example, the name plus address of a Client would be between its attributes. Each Entity should obtain exclusive attribute that makes any file inside its table unique--this is the Primary Key and is normally represented as an ID number. A simple, commonly employed approach is to assign the next from a series about numbers each time a new entry is additional to a table.

3 Decide on the Relationships in your database. Most about the Entities will have Associations with other Entities. For example, here may be a Association among the Customer plus Transaction Entities. Each and every Transaction will likely be associated together with a single Client, while each and every Client might be associated with one or more Transactions. This means that is the Association between Client and Transaction yous "One to Quite a few." To link the double tables within the database, you could include a field (attribute) in the Transaction table that stores the ID number of the Client who placed it--this is the Foreign Key. When the Association is "One to Quite a few" you should always include the Foreign Key on the "Many" side, since this results in greater efficiency and integrity.

4 Create your database. Utilize either SQL statements within a script or any tool such because phpMyAdmin to assemble your database. Using an automated tool permits you to build the framework without having having to write SQL declarations, plus Web hosts usually make available such tools for free. If you are using SQL, consider the following illustration syntax to create your tables: CREATE TABLE 'client' ( 'ID' smallint(3) Never NULL auto_increment, 'identify' varchar(20) Never NULL, 'address' varchar(100) Not NULL, Primary Key ('ID') ); CREATE TABLE 'transaction' ( 'ID' smallint(3) Never NULL auto_increment, 'date_placed' date Not NULL, 'client_ID' smallint(3) Not NULL, Primary Key ('ID') ); Consider attention to choose the accurate data kinds for your attributes. The ID fields in two tables are set to automatically assign the next number in a sequence whenever some new record is created. Populate the database with certain data, even if this is only just check data to begin through.

5 Connect to your data using a Server-side script such since PHP or ASP. Websites are created by making HTML structures on top of the data. The ensuing website interface will normally also facilitate updating or adding to the data. For example, someone within exclusive administrator or managerial role may need to view the list about Transactions associated with a particular Client. Inside this sample PHP script, the Client ID has been sent to the script by way of the Publish variable, which would generally occur from cases where the consumer has requested the data using any form: <?php //link to the database using the correct host, username also password mysql_connect("localhost", "db_user", "db_pass"); //select the database from identify mysql_select_db("db_name"); //construct the HTML page structure echo "<html><head></head><physique>

"; //query the database - the customer ID has been passed in by way of Publish $db_query="select * from transaction where client_ID=".$_POST['ID']; $db_result=mysql_query($db_query); //iterate via the query results while($db_row=mysql_fetch_array($db_result)) //{get the data into variables $trans_date=$db_row['date_placed']; //write the data out in HTML echo "

".$trans_date."

"; }//close the HTML page frameworks echo "

</body></html>"; ?> This unimportant illustration merely writes out the dates for a given Client's Transactions. Naturally your own scripts should reflect the purpose about your website.

Tips & Cautions

Take time to come increase with any good design based on some thorough understanding regarding the Entities and their Associations. Using diagramming tools can be hugely helpful and regularly results on more tough databases.

Be wary of any database design that is involves duplication of data. Examine through your design and reconsider it if this is the case.