René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

conn_db.inc

<?php

  function connect_db() {
   
    $servername = 'foo';
    $username   = 'bar';
    $password   = 'pw' ;

    $db_conn = mysql_connect($servername, $username, $password);

    if (! $db_conn) {
      printf("<b>Connect failed</b>: %s\n", mysql_error());
      return 0;
    }

    if (! mysql_select_db('adp')) {
      printf("<b>Could not select db</b>: %s\n", mysql_error());
      return 0;
    }
    return $db_conn;
  }

?>