Results 1 to 10 of 10
  1. #1
    smith78 is offline Freshman
    Join Date
    Feb 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default How to connect MYSQL Data base on a webserver with a PHP Script

    How to connect MYSQL Data base on a webserver with a PHP Script or page?

    HI,
    I have a website and i want to connect a database in order to get form data saved into it.
    Want to do it using PHP.
    Now i am looking or the basic connection process. Not the SQL syntax for queries but only to establish the connection.

  2. #2
    IntraSpek is offline Freshman
    Join Date
    Feb 2010
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    Hi,

    Go through this - dev.mysql.com/tech-resources/articles/ddws/21. Use html at the end of this page.

    May be you can get the solution from this...

    Regards,

  3. #3
    ngseosept is offline Junior
    Join Date
    Sep 2009
    Posts
    187
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    You can connect your table to the page you want to have a database connection by clicking the Database on the dreamweaver
    but before that you must first set the necessary privileges to XAMPP. Enter the necessary fields needed and then remember the
    connection name and the password because it will be ask to you to input if your gonna connect it when you click the database then
    database behavior. Hope it will help you.

  4. #4
    mahesh2010 is offline Banned
    Join Date
    Jun 2010
    Location
    USA
    Posts
    194
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    MYSQL can be installed runs in any remote server user can connect to the local server using IP address on the privilege they have. Once connected users can manipulate the MySQL database by using different PHP commands. So first you learn about PHP commands.

  5. #5
    elgenio is offline Freshman
    Join Date
    Jul 2010
    Location
    Belgium
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    Quote Originally Posted by smith78 View Post
    [B][SIZE=3]Not the SQL syntax for queries but only to establish the connection.
    $link = mysql_connect('localhost', 'mysql_user', 'mysql_password');

    more on http://php.net/manual/en/function.mysql-connect.php

  6. #6
    sandy_j_sam is offline Freshman
    Join Date
    Jul 2010
    Posts
    32
    Thanks
    0
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    HI, we easily connect Server Side Scripting Language,PHP with Open Source Database System Software "MySql " ,
    and here I Mention Basic code that' help you,

    <?php
    $connection = mysql_connect("localhost","root","");
    /*
    Server Name => "localhost", username => "root", Password =>" ".
    $connection having Resource Data Type.
    */

    if (!$connection)
    {
    die('We unable to Connect, Try Again !! connect: ' . mysql_error());
    }

    //Now before Creating Table we Must Create Data Base, then see here,

    if (mysql_query("CREATE DATABASE sample_database_name",$connection))
    {
    echo "Your Database created, Successfully";
    }
    else
    {
    echo "Error, During creating database: " . mysql_error();
    }
    /*
    After Creating Database We need to create Table.
    */
    mysql_select_db("sample_database_name", $connection);
    $sql = "CREATE TABLE sample_table_name
    (
    UserName varchar(15) NOT NULL,
    Address varchar(15) NOT NULL,
    )";

    // Execute query
    mysql_query($sql,$connection);
    /*
    After completion of task we need to close connection.
    */
    mysql_close($con);
    ?>

    and still if you Problem then Just mention here, I'll Try to Solve them.

  7. #7
    Zendooo is offline Junior
    Join Date
    Dec 2009
    Posts
    234
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Feedback Score
    0

    Default

    The query is used to connect with the mysql

    mysql_connect(servername, username, password);

  8. #8
    gurusofit is offline Sophomore
    Join Date
    Jul 2010
    Location
    Pakistan
    Posts
    130
    Thanks
    6
    Thanked 1 Time in 1 Post
    Feedback Score
    0

    Default

    really good question kindly take a look at following tutorials, through these tutorial u will get exactly what u want

    http://www.w3schools.com/php/php_mysql_connect.asp

  9. #9
    waynewex is offline Freshman
    Join Date
    Aug 2010
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    Learning how to connect to a MySQL database with PHP shouldn't be a difficult task.

    //Connect to MySQL
    $res = mysql_connect("host","username","password");
    //Select database
    mysql_select_db("DatabaseName");

  10. #10
    MaryLyons9's Avatar
    MaryLyons9 is offline Freshman
    Join Date
    Aug 2010
    Location
    2481 E Ft Lowell Rd
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Feedback Score
    0

    Default

    w3school is best answer to your question look at w3school website..

Similar Threads

  1. How best ot optimize content?
    By wujijiangjun in forum Search Engine Optimization
    Replies: 13
    Last Post: 10-27-2011, 08:21 AM
  2. Replies: 3
    Last Post: 08-13-2011, 06:19 PM
  3. MySQL Best Practices
    By eusha in forum Databases
    Replies: 5
    Last Post: 12-11-2009, 03:42 AM
  4. Replies: 1
    Last Post: 07-06-2009, 10:35 PM
  5. Complete Matrimonial Script @ www.infocuswebdesigning.com
    By ashish10 in forum Marketplace - Buy, Sell & Trade
    Replies: 0
    Last Post: 06-13-2009, 07:18 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Partners: BOSTON WEB DEVELOPER, LLC   |   WEBCOSMO CLASSIFIEDS