S I T E  S E C T I O N S

Home
Sales
Dedicated Servers
Reseller Hosting
Virtual Private Server
Web Hosting
Support
articles
Site Design Quote
Privacy

S E C T I O N S

Getting Started
Agora Shopping Cart
Anonymous ftp
Backup Manager
CGI Setup
CGI Centre
MS Frontpage
Ftp Help
Change Password
File Manager
Form Mail
Email
Mail List
Mime Types
MySql
MySql FAQ
Network Tools
Path Information
PGP Email
PHP information
_Directory password
Search Submit
Secure Server
SSH Telnet
_Server Side Include
Stats Overview
URL Redirection
Java
Control Panel

 

F.A.Q  : MySQL and PHP
       


    1. How do I use the MySQL button in the Control Panel?

    2.
    How do I get started with PHP?

    3.
    How do I get started with MySQL?

    4.
    Where can I find more info on PHP?

    5.
    Where can I find more info on MySQL

    6.
    What are the advantages of MySQL and PHP over ASP?


    1.  How do I use the MySQL button in the Control Panel? - Top
           

    The MySQL feature inside your Control Panel is where you manage your database, including designing tables, adding, deleting, and updating records, all from within your web browser.

    When you first click on the MySQL feature, you will be asked to provide a name for your database and a password, you can use the same username and password that you use for your Control Panel if you so desire. Once the database is created, and you return to this feature inside your Control Panel it will then become the Welcome page for your databases. A tree view is on the left. The name of your databases and the version of MySQL are displayed to the right of the tree.

    The Tree

    The top entry in the tree, "Home," will return you to the Welcome page. Beneath that is your database name and a square with a plus or minus sign in it. Clicking the square will show and hide the names of the tables in the database in the tree. Clicking on the database name in the tree will display the main database management page. Clicking on one of the tables names in the tree will display the properties of that table.

    The Main Database Management Page

    This page displays a list of all the tables in your database and the number of records in each. You can also execute an SQL statement, perform advanced queries, dump the database, and create new tables.

    The List of Tables

    Next to each table name are links to various actions you can perform on a table.



    Browse Displays the records in the table 30 at a time. From the Browse page you can edit or delete a record.


    Select Build and execute a SELECT query on the table. Only those records which match the criteria you provide will be displayed.


    Insert Add a new record to the table. Enter the data in the fields provided. Various functions can be used to obtain the current time, generate random numbers, and more. Press the Save button to insert the record into the table.


    Properties Displays the fields in the table with their data type and attributes. Table management functions for the table are also provided.


    Drop Remove the table and its contents from the database. Once you do this neither the table nor the data will be available.


    Empty Delete all of the records in the table. Once you do this the table will still exits but the data in the table will no longer be available.


    Execute an SQL Statement

    Any SQL statement can be executed on your database by typing it into the textbox labled "Run SQL query/queries on database" and pressing the "Go" button.

    Query by example

    Advanced queries can be built and executed using a graphical interface.

    Advanced Queries

    Queries are built by selecting the fields to search on and the criteria to use for the search. The SQL statement that will be executed is displayed in the textbox in the lower right. The statement is updated to reflect the values provided in the rest of the form fields on the page by pressing the "Update Query" button. Execute the statement by pressing on the "Submit Query" button.

    Each column can be used to specify a field for the SQL statement. Empty columns are ignored.

    The fields specified in the "Fields" row are combined with criteria below it to create a WHERE clause . If the "Show" checkbox in on then the field is placed in the SELECT clause as well. The query results may be sorted on a field based on the selection in the "Sort" menu.

    More fields can be added by turning on the "Ins" checkbox below a column or selecting a positive number in the "Add/Delete Field Columns" menu. Fields are deleted by turning on the "Del" checkbox or selecting a negative number in the "Add/Delete Field Columns" menu. Press "Update Query" to update the page to reflect the changes. You may have to scroll your web browser to the right to see all of the field columns.

    The tables selected in the "Use Tables" listbox form the FROM clause. Also, the fields listed in the "Fields" menus are restricted to the fields in the selected tables.

    Each criteria should be placed on a separate criteria row. If the "And" radio button is selected for a criteria row, that row will be logically AND'd in the WHERE clause. If the "Or" radio button is selected, that row will be logically OR'd in the WHERE clause.

    Criteria are not required for any column. If not provided and the "Show" checkbox is on, the field will be shown for all records that match any other criteria.

    Criteria are added and deleted in a manner similar to adding/deleting fields using the checkboxes to the left of a criteria row or the "Add/Delete Criteria Row" menu. Again, press "Update Query" to update the page.

    View dump (schema) of database

    Dumping of the database displays the structure and or data contained in the database. You can then save this information to a file on your local computer for archiving or to aide in the development of your database. The contents and format of the dump are based on the radio button and check box selections you make. See also View dump (schema) of table.

    The "View Dump (Schema) of Database" section of the Main Database Management page is useful. Pressing the associated Go button will generate a page containing the SQL statements for recreating the database. If the "Structure and Data" radio button is selected, the SQL statements for INSERTing the data will be generated as well. Turn on the. "Add 'DROP TABLE'" checkbox and the SQL statements to DROP the tables will be included also. When you drop a table, the table is deleted. Turning on the "Send" checkbox, causes the generated SQL statements to be sent to you as a file which you can save to your harddisk.

    The "View Dump(Schema) of Table" section of the Table Properties page allows you to obain a dump of a single table. The additional radio button, CVS will return the data in the table with each record as a seperate line. The fields are delimited by the character specified in the "Terminated by" textbox.

    The dumped data can be imported into another database or a spreadsheet, or archived for backup.

    NOTE: None of the selections above will alter your database.


    Create a new table

    Create a new table by typing in the name of the table and the number of fields to be in the table and pressing the "Go" button. You will be shown a page which will allow you to set up the datatype and attributes of each field.


     
         


    2.  How do I get started with PHP? - Top
           

    PHP is a server-side, cross-platform, HTML embedded scripting
    language. If you are completely new to PHP and want to get some
    idea of how it works, have a look at the
    Introductory
    Tutorial at www.php.net.
    PHP is designed especially for
    working with relational database systems.

    A PHP program is embedded directly in the HTML document. It must
    have a .phtml or .php extension in order for the
    server to look for PHP code in the document. Here is an example
    of how you embed the PHP:







        insert PHP code here

        ?>








     PHP.net has a wonderful
    site with several versions of an on-line manual (fancy, plain,
    annotated, etc.) and many links to examples and scripts. There
    is also a mailing list to interact with other PHP users where
    you can ask questions and find useful scripts and bits of code.
    You will also now find books
    available for learning PHP.

     
           


    3.  How do I get started with MySQL? - Top
           

    How do I get started?

    1. The following information is needed to create a MySQL Database.
    1.Database name
    2.Username to use for accessing the database
    3.Password
    (Username and password can be same as login.)

    Setup your MySQL Database through your control panel. Just click on MySQL.

    2.Once it's created, from your ssh prompt you type the following command line to access your database:

    /usr/local/mysql/bin/mysql dbname -u username -ppassword
    (no space between the -p and the password)

    You can also access your MySQL Database from the Web using programming languages such as Perl and PHP.

    How do I work with a MySQL database using PHP?

    1.To merely display the information in your database without the use of a form to call a php script you simply create your HTML document as you would any other web page but instead of the extension of .htm or .html you need to name the file with the extension .phtml. Then within the document itself the section that you'd like to be the PHP code, you begin it with . For instance:


    These are the products I sell:



    mysql_connect(localhost, username, password);
    $result = mysql(mydatabase, "select * from products");
    $num = mysql_numrows($result);
    $i = 0;

    while($i echo "n";
    echo "

    n";
    echo mysql_result($result,$i,"prodid");
    echo "n

    ";
    echo mysql_result($result,$i,"name");
    echo "n

    ";
    echo mysql_result($result,$i,"price");
    echo "n";
    echo "n";
    $i++;}
    ?>




    Thus having the loop in the php program create a table with the products listed. NOTE your username and password for the database are not written in the file when it's displayed on the Internet so users viewing the source of your webpage will not see your password.

    2.When using a CGI script to pull information from a form which has been submitted by a browser you must have the first line of the script have this command on it (Much like perl scripts):

    #!/usr/local/bin/php

    How do I connect my Access DB with MySQL Database?

    Connecting MS Access to a MySQL database

    -- You will first need to contact support to request that we give you access to MySQL remotely, e.g., ODBC.

    ON LOCAL PC:
    1) Download and Install MyODBC 2.50.19 (or most current version) on local
    Win95 machine with MS Access installed
    --can download at: http://www.mysql.com/download.html


    2) Fill in the following settings:
    Windows DNS Name: You can choose the names, must be unique
    Server: This is your domain name or IP address
    MySQL Database Name: The name of your MySQL database
    User: Your MySQL username
    Password: Your MySQL password
    Port: leave blank for default (3306(
    Options; Select "Return Matching Rows"


    3) To Link a Table
    a) File...Get External Data...Link Tables
    b) Under 'Files of Type:', select "ODBC Database"
    c) Select Machine Data Source Tab, and select the appropriate Data Source
    Name
    d) Select the tables(s) to link
     
          
    4.  Where can I find more info on PHP? - Top
           

    For detailed information regarding PHP, you can go to their online manual:

    http://www.php.net/manual
     
          


    5.  Where can I find more info on MySQL - Top
           

    For detailed information regarding MySQL, you can go to the MySQL Online Manual


    We DO NOT PROVIDE TECHNICAL SUPPORT ON MySQL beyond making MySQL avalable for you.

     
          


    6.  What are the advantages of MySQL and PHP over ASP? - Top
           

    Here are some of the reasons to switch:


    1). UNIX is more reliable. Here are some articles backing this up.
    UNIX vs. NT 4.0 Service Pack 3 from an experienced user:
    http://www.zdnet.com/sr/columns/sjvn/980528.html
    UNIX vs. NT 5.0 with detailed comparison:
    http://www.zdnet.com/zdnn/content/inwk/0513/305389.html


    2). MySQL is a very fast Database System. This page will allow someone to
    compare MySQL with a bunch of other database systems.
    http://www.mysql.com/benchmark.html


    3). MySQL is very functional. This page allows comparisons of the
    different functions between MySQL and other Database Systems.


    http://www.mysql.com/crash-me-choose.htmy


    4). PHP 3.0 is designed to be fast and was written to do database work.
    PHP 3.0 is a server side HTML embeded scripting language, meaning that PHP
    is embeded in the HTML files and the server does the work of translating
    the PHP 3.0. This means that it is totally platform and browser
    independent (it is possible to make things platform and browser independent
    with Microsoft ASP (Active Server Pages) having the server do all the
    compiling but if someone brings this up, revert back to the UNIX
    reliability and Database speed, ASP is not quicker than PHP 3.0 but I don't
    have any bench marks on this). Let people know it is reliable and fast.
    They can look here for information on PHP 3.0 here: http://www.php.net
     
     Back  to Top


        

[Home] [Web Hosting] [Reseller Hosting] [Virtual Private Server] [Dedicated Servers] [Sales] [Support]

Please contact our Webmaster with questions or comments.                          
©Copyright 2000 Arachno Net  All rights reserved.