PHP Classes

File: top_script.php

Recommend this page to a friend!
  Classes of Panos Kyriakakis   AJAXed list boxes   top_script.php   Download  
File: top_script.php
Role: Auxiliary script
Content type: text/plain
Description: Example file
Class: AJAXed list boxes
Generate AJAXed linked select inputs
Author: By
Last change: configuration moved here and a help db function.
Date: 16 years ago
Size: 1,016 bytes
 

Contents

Class file image Download
<?php

   
/*
        LSB demo script.
       
        Just for demonstration purposes, it is suposed to use
        your script's current db connection.
     */

   
openDB( 'localhost', // server
           
'salix', // database name
           
'salix', // db username
           
'salix' // db password
         
);

    function
openDB( $dbserver_name, $database_name, $dbserver_username, $dbserver_password) {
   
       
$resp=0;
       
       
$link = @mysql_connect($dbserver_name, $dbserver_username, $dbserver_password);
        if(
$link!=false) {
             
$resp = @mysql_select_db($database_name);
              if (
$resp != false) {
                 
$resp=0;
              }
              else {
               
$resp = -1;
              }
        }
        else {
             
$resp = -2;
        }
        if(
$resp!=0 ) {
            if( isset(
$link) )
                unset(
$link);
        }
        return(
$resp );
    }
// end function openDB ----------------------------------


?>