How To ACCESS MySQL DATABASE FROM PHP CODE FOR SQUIRRELMAIL SERVER

Discussion in 'HOWTO-Related Questions' started by Ghose Sumon, May 21, 2007.

  1. Ghose Sumon

    Ghose Sumon New Member

    Hi Everyone,

    My Organization is currently using Squirrelmail server. Now We are having some requirement of adding some additional info to the existing MySql database but in separate table.Now we r trying to customise some part of the code but facing the database connectivity problem. we r not able to access the database from the PHP code using Mysql_connect() function as the current system hides the database n connects using some different configuration.so please anyone help us to solve this issue..if possible provide the code also for the same.

    Thanking You,
    Sumon Ghose
     
  2. sjau

    sjau Local Meanie

    Please do not use CAPITALS in the topic header. This is considered as shouting and it's not polite.

    A very simple code snippet of accessing a mysql-db through php is this:

    Code:
    <?php
    
    $username = ""; // Username for database here
    $password = ""; // Password for database here
    $db_host = "localhost"; // DB Server
    $db_name =  ""; //name of your database here
    
    // Connect to DB
    mysql_connect("$db_host","$username","$password")
            or die("Unable to connect to SQL server!");
    mysql_select_db("$db_name")
            or die("Unable to select database!");
    
    ?>
    
     

Share This Page