• No results found

What will you find here?

N/A
N/A
Protected

Academic year: 2021

Share "What will you find here?"

Copied!
66
0
0

Loading.... (view fulltext now)

Full text

(1)

and manage data of MySQL databases. It also generates PHP code for creating the database itself as well.

Once you get used to PHPMagic (which takes no time), you'll be able to create amazingly powerful web database applications -- even if you know nothing about PHP, SQL, MySQL, html, ... etc. PHPMagic does it all for you, automatically.

PHPMagic 3 is the result of hundreds of user comments and feedback from people who used previous versions of PHPMagic. It is a whole new rebuild with many added features and a completely new and exciting look.

What will you find here?

A step-by-step guide to creating an online music database using PHPMagic.

A guide to using the generated pages and dealing with the database.

(2)

http://www.websitedatabases.com/ 2 In this section, I'll walk you through the simple steps needed to create your first

PHPMagic application. We'll consider a real-world database application as an example: A music albums collection.

I have lots of music CDs that are actually collections of various singers. And I find it really hard sometimes to find a song that I wish to listen to. So, let's begin to create an application to manage this task. It shall also have the

advantage of being an online application, which means you can put it on your web server and allow your friends to view it instead of asking you every time they want to borrow a CD if you have that song named bla bla bla.

We'll create a Singers table, a CDs table and a Songs table. You might wonder: Why don't I create one table for all the data?? Well ... dividing the data into several tables instead of one is called data normalization. Data normalization helps decrease the database size and retain data integrity. In brief, you create a table for each ‘object’ in your

system. So, songs are an object, singers another object and CDs a third object.

For more information about data normalization and other relational database design issues, I recommend you read the great tutorial by Selena Sol on databasejournal.com. (If you are not familiar with database design concepts, I highly recommend you check this tutorial before you continue reading this guide).

(3)

http://www.websitedatabases.com/ 3

• Singer name

• Country

• Comments

CDs table shall have these fields:

• CD number (automatically-incremented primary key)

• Creation date

• CD name (I like to give names to my CDs: Meditation, Night slows, Shadow, .. etc)

• Comments

And Songs table shall have these fields:

• Song Number (automatically-incremented primary key)

• Song name

• Singer (a foreign key field that accepts data only if it matches 'Singer number' field of the Singers table)

• CD (a foreign key field that accepts data only if it matches 'CD number' field of the CDs table)

(4)

http://www.websitedatabases.com/ 4 When you start PHPMagic, you see an empty working area.

Click on the 'New Project' icon to start a new project.

Please note:

This screenshot and all others are taken from PHPMagic version 1.0. Some icons you see have been changed in later versions of PHPMagic and the Trial version. However, you can create the entire example application shown here using the free trial version. Many new features have been added but the functionality is basically the same. This is simply a demo of how the application works.

(5)

http://www.websitedatabases.com/ 5

The project window is displayed. It has two panels.

The left panel is the Project Browser and contains a hierarchical view of your database. Now it has only one item: the database itself. The default name of the database is ‘new_db’.

The right panel is the Properties panel and it contains

information about the currently-highlighted item in the Project Browser.

(6)

http://www.websitedatabases.com/ 6 Click twice (but not double-click) on the item 'new_db', or press F2, to change the database name. We’ll change it to 'music'.

(7)

http://www.websitedatabases.com/ 7 After typing the new name, click anywhere in the window to

(8)

http://www.websitedatabases.com/ 8 We then define the connection parameters for the database. Simply type the server name or IP, the username and the password in the Properties panel.

If you don't know these values, contact your server administrator.

(9)

http://www.websitedatabases.com/ 9 Next, we create the tables of the database. Click on the 'New Table' icon.

(10)

http://www.websitedatabases.com/ 10 Now 'table1' is created. To change its name highlight the table in the Project Browser and press F2 or click on it.

(11)

http://www.websitedatabases.com/ 11 We rename it to 'singers'.

(12)

http://www.websitedatabases.com/ 12 We'll create another table, 'cds' in the same manner.

(13)

http://www.websitedatabases.com/ 13 We’ll rename the table to ‘cds’.

(14)

http://www.websitedatabases.com/ 14 as shown before.

(15)

http://www.websitedatabases.com/ 15 We'll adjust some properties for each table now. The Caption property is the title of the table that users of your application will see.

Users won’t see the actual name of the table since it has many restrictions (lower case letters, no spaces, no special characters, .. etc). But the caption can be almost anything you want (except single quotation marks).

(16)

http://www.websitedatabases.com/ 16 We have just changed the caption of the 'singers' table to

(17)

http://www.websitedatabases.com/ 17 And the caption of the 'cds' table to 'CDs Table', and 'songs' table to 'Songs Table'.

(18)

http://www.websitedatabases.com/ 18 We'll now create some fields. We select the 'singers' table and then click on the 'New Field' icon to create a new field in the selected table.

Voila! 'field1' is created. We'll change the new field name by selecting it and pressing F2.

(19)

http://www.websitedatabases.com/ 19 We changed the name to 'singer number'.

(20)

http://www.websitedatabases.com/ 20 We'll now edit some properties of the selected field in the

(21)

http://www.websitedatabases.com/ 21 The field caption is changed to 'Singer Number'. A field caption is what your application users will see in their browser instead of the field name.

(22)

http://www.websitedatabases.com/ 22 We checked 'Primary key' so that the selected field becomes the primary key of the table.

A primary key is a field used to uniquely identify each record in the table. For example, if we say “the record whose primary key field is equal to 125587”, then we are talking about one and only one record in the table.

The singer number is going to be the primary key field of the singers table in our example.

(23)

http://www.websitedatabases.com/ 23 Auto Increment means the field will contain an automatic counter that increases whenever a new data record is added to the

database.

(24)

http://www.websitedatabases.com/ 24 Let's create some more fields ...

And we rename it to “singer_name” in the same way we renamed tables before.

(25)

http://www.websitedatabases.com/ 25 Singer name will be a text field of type 'VarChar' and length 40.

(26)

http://www.websitedatabases.com/ 26 Then we create another field, ‘country’, and set its properties ...

If you have PHPMagic Professional, you can define several countries to choose from in the Value list box. This will let your users choose the country from a drop down menu instead of typing it.

(27)

http://www.websitedatabases.com/ 27 Here are all the fields created. 'singer' and 'cd' fields of the

'songs' table shall be foreign keys to link the 'songs' table to the 'singers' and 'cds' tables. Let's set this now ...

(28)

http://www.websitedatabases.com/ 28 We set the Parent table to 'singers', Parent ID field to the primary key field of the 'singers' table which is 'singer_number', and

Parent caption field to 'singer_name' so that the users see the singer names instead of their serial numbers.

Please note that the data type of the foreign key field must match that of its parent id field.

(29)

http://www.websitedatabases.com/ 29 We do the same with 'cd' field.

(30)

http://www.websitedatabases.com/ 30 That's all! Your project is ready for generation of the PHP

application. Click on the 'Generate PHP code' icon, or press F5.

You're asked now to select an output folder where the application files will be created. It's recommended you select an empty folder or create a new folder in order not to mix any files. After selecting the output folder, PHPMagic generates the application files and displays a detailed log. Click 'Close' to close the window.

(31)

http://www.websitedatabases.com/ 31 Click the 'Exit' icon to quit PHPMagic.

The next step is to upload the application to your web server and set it up. (http://yourdomain.com/your_phpmagic_folder/setup.php)

(32)

http://www.websitedatabases.com/ 32 PHP application. It contains links to all the tables we created in our PHPMagic project.

TIP!

If you wish to change the look of this page, you can look for the file

‘index.html’ in the generated files folder and open it in your favorite HTML editor and perform your magic!

(33)
(34)

http://www.websitedatabases.com/ 34 before trying to view its tables. However, PHPMagic reminds us of doing so and provides a link to the setup page.

(35)

http://www.websitedatabases.com/ 35 We'll click on the link to set up the database.

(36)

http://www.websitedatabases.com/ 36 Here we are! The database is created

(37)
(38)
(39)

http://www.websitedatabases.com/ 39 Here we can view data records, add new records, edit and delete existing records, sort and filter records.

But since this table is new, it is still empty. We shall now add a new data record.

(40)

http://www.websitedatabases.com/ 40 Note that the 'Country' field has a menu of allowable data values. This was done in PHPMagic Professional Edition by defining a values list for this field.

(41)

http://www.websitedatabases.com/ 41 We now click the 'Add New Record' button to save data to the table.

(42)

http://www.websitedatabases.com/ 42 Observe the new buttons that appear in the Detail View.

Notice also that Singer Number was

automatically set to '1' since we defined this field as 'Auto Increment' in PHPMagic.

(43)
(44)

http://www.websitedatabases.com/ 44 'Micheal Jakson' and edit his data.

(45)

http://www.websitedatabases.com/ 45 the Detail View.

(46)

http://www.websitedatabases.com/ 46 We add a comment and then save changes by clicking the 'Update Record' button.

(47)
(48)
(49)

http://www.websitedatabases.com/ 49 We'll delete 'Britney' from the table by clicking the 'Delete Record' button.

(50)
(51)
(52)

http://www.websitedatabases.com/ 52 The 'Print' button displays the table without the buttons and the detail view so that users can print it. We'll click this button now.

(53)

http://www.websitedatabases.com/ 53 return to the previous view.

(54)

http://www.websitedatabases.com/ 54 The 'Edit Filters' button displays a filters page so that we can search the data in the table according to criteria we'll define.

(55)

http://www.websitedatabases.com/ 55 'Or' to indicate how the filter is combined with other filters. Filters consist of a field

name, a comparison operator and a comparison value ...

(56)
(57)

http://www.websitedatabases.com/ 57 To apply your filter(s), click the 'Apply Filters' button.

(58)
(59)

http://www.websitedatabases.com/ 59 The 'Clear Filters' button removes all filters.

(60)
(61)

http://www.websitedatabases.com/ 61 PHPMagic allows us to sort data by any field. Simply click on the field header.

(62)
(63)
(64)
(65)

http://www.websitedatabases.com/ 65 The 'Select A Table' menu allows you to view any other table by selecting it.

By now we have reached the end of our

Getting Started guide. Try PHPMagic on your own now and see for yourself the possibilites and powers. Context help is availble

everywhere in PHPMagic by clicking F1 anytime. Enjoy!

(66)

http://www.websitedatabases.com/ 66 databases having tens and even hundreds of tables. You can do it without a single line of code. No need to spend hundreds of hours writing SQL, PHP or HTML code. No need to hire expensive programmers to do it for you either. And even if you need to customize the generated files, you know you won’t have to start from scratch. You know that you have already saved yourself tons of programming time and effort. The generated code is very neat and easy to understand. Many customers told us that they used it to learn PHP!

Now, think of it: Isn’t saving yourself hundreds of hours in programming, thousands of dollars in programmers’ costs, endless testing and debugging efforts … isn’t saving all of these worth a little investment in PHPMagic?

References

Related documents

The effect can be done with a borrowed deck, and a borrowed set of keys (making The effect can be done with a borrowed deck, and a borrowed set of keys (making sure they have a

We performed a wind tunnel study at Politecnico di Milano to measure the drag force on handbikers in different layouts to investigate the effect of the athlete position and

MaxiMuM se presenta en cuatro acabados: blanco, antracita alto brillo y dos nuevas melaninas texturizadas en acabados roble y wengé MaxiMuM introduces four finishes: High

A Row Field A Column Field A Data Field Data Plus Row Only or Data Plus Column Only Drag and Drop Inner Row or Inner Column Fields The Pivot Table Page Field Determining

يجذومنلا ةليسوب ميلعتلا ملافأ نوتركلا ةيبرعلا ةيقترل ةراهم ملاكلا يدل بلاط لصفلا نماثلا ةسردبم ارون حلافل ةطسوتلما ةيملاسلإا ناتغام .... ثحبلا ةيفلخ نع يربعتلل ةلود

AWK Airwork Holdings Limited Human Landlord Contractor BGR Briscoe Group Physical Distributor Wholesaler

I posses positive, crystal clear and vivid pictures in my mind of what I want to become I know my goals and purposes In my life.. I have the

Qoc kha jbujh s!stc wjs suddcreb" drk j screcs kd arjwijg/s, Webgc wokhc kd toc s!stc wjs tk ic jebtjebca weto ojbas toc prkgcss kd /ccpeb" jebtjebeb"