Hello masters

It is possible to connect two different database system like(sql server and mysql) at the same time in the same script?

If yes can you give me some tips of what procedure I'm going to use.

If no then thanks for reading my threads.
/////////////////////////////////////////////////////////////////////////////////////
Because i have a code that can able to connect to the mysql and it work smoothly and at the same time the sql server can do also.
But when I try to combine the code my main session is logging out or destroyed.

Should be no problem. Use mysql_connect() and mssql_connect(). Be sure each have their own variables, and that they don't mix.

If you are talking about the microsoft sql database + mysql database then that I believe is totally possible as they are two separate modules. Although I have never used the ms sql database system before, if you could post an example of the two separate scripts I will happily merge them together for you if their not too big.

If you are talking about the microsoft sql database + mysql database then that I believe is totally possible as they are two separate modules. Although I have never used the ms sql database system before, if you could post an example of the two separate scripts I will happily merge them together for you if their not too big.

This is sql server

<?php
     include('constant.php');
     class msSQLDB{
           var $con;


           function msSQLDB(){
                    $this->con=mssql_connect(MS_SERVER, MSDB_USER, MSDB_PASS) or die("SQL Server connection failed");
                    mssql_select_db("pnc_enrollment",$this->con) or die("Database connection failed");
           }

           /*
             msSchedule - use by the admin to activate all the schedule that is available
             in current semester.
           */ /*
           function msSchedule(){
                    $mssql = "SELECT S.SubjCode, C.Description, S.FromTime, S.ToTime,".
                             " S.Semester, S.SchoolYear, S.Day, S.Room FROM Schedule AS S, Curriculum AS C ".
                             "WHERE S.CurriID=C.CurriID AND S.SubjCode=C.SubjCode AND S.Semester=C.Semester AND S.CourseID=C.CourseID";

                    $query = mssql_query($mssql,$this->con);
                    $fetch = mssql_fetch_array($query);

           }
                */
           /*
             The student which is the active user will show their schedule base on their
             student ID and the pre-requisite.
           */
           function msStudSchedule($studentID){
                    $mssql = "SELECT S.SubjCode, C.Description, S.FromTime, S.ToTime,".
                             " S.Semester, S.SchoolYear, S.Day, S.Room FROM Schedule AS S,Curriculum AS C ".
                             " WHERE S.CourseID IN ".
                                     "(SELECT CourseID FROM Curriculum)".
                             " AND SubjCode IN".
                                     "(SELECT SubjCode From Curriculum WHERE Pre_Requisite IN".
                                              "(SELECT SubjCode FROM StudGrade WHERE StudentNumber =".
                                              "'$studentID' AND Grade <= 3 AND Grade != 0) ".
                                     "AND CourseID IN".
                                              "(SELECT Course FROM Students WHERE StudentNumber = ".
                                              "'$studentID'))";


                    $msquery = mssql_query($mssql,$this->con);
                    $fetch = mssql_fetch_array($msquery);
                    while ($row = $fetch){
                          $_SESSION['checkboxes']=$row['SubjCode'];
                          echo "<tr><td><INPUT TYPE='CHECKBOX' NAME='$row[SubjCode]' ></td>".
                               "<td>$row[SubjCode]</td>".
                               "<td>$row[Description]</td>".
                               "<td>$row[FromTime]</td>".
                               "<td>$row[ToTime]</td>".
                               "<td>$row[Semester]</td>".
                               "<td>$row[SchoolYear]</td>".
                               "<td>$row[Day]</td>".
                               "<td>$row[Room]</td></tr>";
                    }
           }

           /*
             msEnlist - the student will now enlist to subject that they take
           */
           function msEnlist($studentID, $schedCode, $sectionCode, $subjCode, $semester,
                             $schoolY, $prof, $schedtype, $enlistedBy, $dateEnlist,
                             $secured_slot, $securedBy){

                    $mssql = "INSERT INTO Enlistment VALUES('$studentID','$schedCode','$sectionCode',"
                             ."'$subjCode','$semester','$schoolY','$prof','1','$schedtype','0','$enlistedBy',"
                             ."'$dateEnlist','$secured_slot','$securedBy')";

                    return mssql_query($mssql,$this->con);
           }
           /*
            view the current enlisted student in the subject that they take
            by selecting either the subject or the the student
           */
           function msEnlisted($studID){
                    //This is for viewing the student who is enlist
                    $mssql = "SELECT S.Lastname,S.Firstname,S.Middlename FROM Enlistment AS E, Students AS S ".
                             "WHERE E.StudentNumber=S.StudentNumber AND S.StudentNumber =".
                             "'$studID'";

                    $msquery = mssql_query($mssql,$this->con);
                    $fetch = mssql_fetch_array($msquery);
                       while ($row =$fetch){
                             echo "<td>".$row['Lastname'].", ".
                                  $row['Firstname']." ".
                                  $row['Middlename'].".</td>";
                       }
           }
}
$msDatabase = new msSQLDB;
?>

and mysql code

<?php
     include ('constant.php');
     include ('msDB.php');
     class mySQLDB{
           var $con;
           var $num_active_users;
           var $num_active_guests;
           var $num_members;


           function MySQLDB(){
                    $this->con=mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die('Could not connect: ' . mysql_error());
                    mysql_select_db("pnc_preregistration",$this->con) or die('Could not select database: ' . mysql_error());
                    
                    /*
                      only query database to find out number of members
                      when getNumMembers() is called for the first time,
                      until the, default value set.
                    */
                    $this->num_members = -1;
                    
                    if (TRACK_VISITORS){
                       //calculate the number of users at site
                       $this->calcNumActiveUsers();
                       
                       //calculate number of guests at site
                       $this->calcNumActiveGuests();
                    }
           }

           function pinNum($studID,$email,$pin){
                    $sql="INSERT INTO studentaddress VALUE('$studID','$email','$pin','0')";
                    return mysql_query($sql,$this->con);
           }

           function updateUserField($username, $field, $value){
                    $sql = "UPDATE reg_login SET ".$field." = '$value' WHERE username = '$username'";
                    return mysql_query($sql, $this->con);
           }

           function listQuestion(){
                    $sql = "SELECT * FROM list_question";
                    return mysql_query($sql, $this->con);
           }

           function removeActiveUser($user){
                    if(!TRACK_VISITORS)return false;
                    $sql = "DELETE FROM active_user WHERE username = '$user'";
                    $this->calcNumActiveUsers();
                    return mysql_query($sql, $this->con);

           }
           
           function removeActiveGuest($ip){
                    if (!TRACK_VISITORS) return;
                    $sql = "DELETE FROM active_guest WHERE ip = '$ip'";
                    $this->calcNumActiveGuests();
                    return mysql_query($sql,$this->con);

           }
           
           function removeInactiveUsers(){
                    if (!TRACK_VISITORS) return;
                    $timeout = time() - USER_TIMEOUT * 60;
                    $sql = "DELETE FROM active_user WHERE timestamp < '$timeout'";
                    $this->calcNumActiveUsers();
                    return mysql_query($sql, $this->con);

           }

           function removeInactiveGuests(){
                    if (!TRACK_VISITORS) return;
                    $timeout = time() - GUEST_TIMEOUT * 60;
                    $this->calcNumActiveGuests();
                    $sql = "DELETE FROM active_guest";
                    return mysql_query($sql, $this->con);

           }
           /*
             getNumMembers - Return the number of signed-up users
             of the website, banned members not included. The first time
             the function is called on page load, the database
             is queried, on subsequent calls, the stored result is
             returned. This is to improved efficiency, effectively
             not querying the database when no call is made.
           */
           function getNumMembers(){
                    if ($this->num_members < 0){
                       $sql = "SELECT * FROM reg_login";
                       $result = mysql_query($sql, $this->con);
                       $this->num_members = mysql_num_rows($result);
                    }
                    return $this->num_members;
           }
           
           /*
             find out how many active user are viewing
             site and sets class variable accordingly
           */
           function calcNumActiveUsers(){
                    $sql = "SELECT * FROM active_user";
                    $result = mysql_query($sql, $this->con);
                    $this->num_active_users = mysql_num_rows($result);

           }
           
           /*
             Add guest to active guest table
           */
           function addActiveGuest($ip, $time){
                    if (!TRACK_VISITORS) return;
                    $sql = "REPLACE INTO active_guest VALUES ('$ip','$time')";
                    mysql_query($sql, $this->con);
                    $this->calcNumActiveGuests();
           }
           
           /*
             Find out how many active guests are viewing site
             and sets class variable accordingly.
           */
           function calcNumActiveGuests(){
                    $sql = "SELECT * FROM active_guest";
                    $result = mysql_query($sql, $this->con);
                    $this->num_active_guests = mysql_num_rows($result);
           }
           
           /*
             check user last active timestamp
           */
           function addActiveUser($username, $time){
                    $sql="UPDATE reg_login SET  timestamp= '$time' WHERE username = '$username'";
                    mysql_query($sql, $this->con);
                    
                    if (!TRACK_VISITORS) return;
                    $sql="REPLACE INTO active_user VALUES ('$username','$time')";
                    mysql_query($sql,$this->con);
                    $this->calcNumActiveUSers();
           }
           
           /*
             check whether or not the given
             username is in the database, if so it checks if the
             given password is the same password in the database
             for that user. if the user doesn't exist of if the
             passwords don't match up, it return an error code
             (1 or 2). On success it return 0.
           */
           function confirmUserPass($username, $password){
                    if (!get_magic_quotes_gpc()){
                       $username= addslashes($username);
                    }
                    // verify that user is in database
                    $sql = "SELECT password FROM reg_login WHERE username = '$username'";
                    $result = mysql_query($sql, $this->con);
                    if (!$result || (mysql_num_rows($result)<1)){
                       return 1;
                    }
                    
                    //retrieve password from result, strip slashes
                    $dbarray= mysql_fetch_array($result);
                    $dbarray['password'] = stripslashes($dbarray['password']);
                    $password = stripslashes($password);
                    
                    //validate that password is correct
                    if ($password == $dbarray['password']){
                       return 0; // return success! password confirm
                    }else{
                          return 2;
                    }
           }
           
           /*
             check whether or not the given
             username is in the database
           */
           function confirmUserID($username,$userid){
                    if (!get_magic_quotes_gpc()){
                       $username=addslashes($username);
                    }
                    $sql="SELECT userID FROM reg_login WHERE username= '$username'";
                    $result=mysql_query($sql, $this->con);
                    if (!$result || mysql_num_rows($result) < 1 ){
                       return 1; //username failure
                    }
                    
                    //retrieve username from result, strip slashes
                    $dbarray=mysql_fetch_array($result);
                    $dbarray['userID']=stripslashes($dbarray['userID']);
                    $userid=stripslashes($userid);
                    
                    /*
                      validate that userid is correct
                    */
                    if ($userid=$dbarray['userID']){
                       return 0;//Username and userid confirmed
                    }else{
                       return 2;//userid invalid
                    }
           }
           //view the result array from a query asking  for all information stored.
           function getUserInfo($username){
                    $sql= "SELECT * FROM reg_login WHERE username= '$username'";
                    $result=mysql_query($sql, $this->con);

                    if (!$result || (mysql_num_rows($result)<1)){
                       return NULL;
                    }
                    
                    $dbarray=mysql_fetch_array($result);
                    
                    return $dbarray;
           }
           
           function loginUser($username,$password){
        
                    //To protect MySQL injection
                    $username=stripslashes($username);
                    $password=stripslashes($password);
                    $username=mysql_real_escape_string($username);
                    $password=mysql_real_escape_string($password);
        
                    $sql="SELECT username,password FROM reg_login WHERE username='$username' and password='$password'";
                    $result=mysql_query($sql,$this->con);

                    // Mysql_num_row is counting table row
                    $count=mysql_num_rows($result);
                    // If result matched $myusername and $mypassword, table row must be 1 row
                    if($count==1){
                        //register $admin_user and $admin_password and redirect to the file "login_success.php"
                        session_register('username');
                        session_register('password');
                        //login success!!
                        }else{
                        echo "Wrong Username or Password";
                    }
           }
           
           /*this userRegister is not for the admin,
           user level:
                5-admin, 1-student, 0-guest */
           function addNewUser($username, $password, $userID, $email, $birthday, $postal, $secretQ, $secretA){
                    $date=date("Y-m-d");
                    $time=time();
                    $sql="INSERT INTO reg_login VALUES ('$username','$password','$userID','$email','1','$birthday',
                                                   '$postal','$date','$secretQ','$secretA','$time')";
                    return mysql_query($sql,$this->con);
           }
           
           /*
           user's updating the username and password
           */
           function changePassword($oldPassword,$newPassword, $username){
                     $sql="SELECT password FROM reg_login WHERE username='$username' and password='$oldPassword'";
                     $result=mysql_query($sql,$this->con);

                     if($result){
                           $newSQL="UPDATE reg_login ".
                                    "SET password='$newPassword' ".
                                    "WHERE username='$username'";
                           return mysql_query($newSQL,$this->con);
                     }else{
                           return 1;
                     }
           }

           function usernameTaken($username){
                    if (!get_magic_quotes_gpc()){
                       $username=addslashes($username);
                    }
                    $sql="SELECT username FROM reg_login WHERE username='$username'";
                    $result=mysql_query($sql,$this->con);
                    return (mysql_num_rows($result)>0);
           }
           
           /*
             perform the given query on the database and
             return the result, which may be false, true or a
             resource identifier.
           */
           function query($query){
                    return mysql_query($query, $this->con);
           }
           
           /*
             closing the connection of the mysql
           */
           function closeMySQL(){
                    return mysql_close($this->con);
           }
}
           /*
             create database connection
           */
           $database = new mySQLDB;
?>

some of my (sql server) method is not yet tested
I hope you try to test my code

I have just merged them to what I think it should be but haven't tested it since I don't have mssql installed. Below is an example to be used as a guide.

<?php
     include ('constant.php');
     include ('msDB.php');
     class mySQLDB{
           var $con;
           var $conb;
           var $num_active_users;
           var $num_active_guests;
           var $num_members;


           function MySQLDB(){
                    $this->con=mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die('Could not connect: ' . mysql_error());
                    mysql_select_db("pnc_preregistration",$this->con) or die('Could not select database: ' . mysql_error());
                    

                    $this->conb=mssql_connect(MS_SERVER, MSDB_USER, MSDB_PASS) or die("SQL Server connection failed");
                    mssql_select_db("pnc_enrollment",$this->conb) or die("Database connection failed");
                    /*
                      only query database to find out number of members
                      when getNumMembers() is called for the first time,
                      until the, default value set.
                    */
                    $this->num_members = -1;
                    
                    if (TRACK_VISITORS){
                       //calculate the number of users at site
                       $this->calcNumActiveUsers();
                       
                       //calculate number of guests at site
                       $this->calcNumActiveGuests();
                    }
           }

/*
             msSchedule - use by the admin to activate all the schedule that is available
             in current semester.
           */ /*
           function msSchedule(){
                    $mssql = "SELECT S.SubjCode, C.Description, S.FromTime, S.ToTime,".
                             " S.Semester, S.SchoolYear, S.Day, S.Room FROM Schedule AS S, Curriculum AS C ".
                             "WHERE S.CurriID=C.CurriID AND S.SubjCode=C.SubjCode AND S.Semester=C.Semester AND S.CourseID=C.CourseID";

                    $query = mssql_query($mssql,$this->conb);
                    $fetch = mssql_fetch_array($query);

           }
                */
           /*
             The student which is the active user will show their schedule base on their
             student ID and the pre-requisite.
           */
           function msStudSchedule($studentID){
                    $mssql = "SELECT S.SubjCode, C.Description, S.FromTime, S.ToTime,".
                             " S.Semester, S.SchoolYear, S.Day, S.Room FROM Schedule AS S,Curriculum AS C ".
                             " WHERE S.CourseID IN ".
                                     "(SELECT CourseID FROM Curriculum)".
                             " AND SubjCode IN".
                                     "(SELECT SubjCode From Curriculum WHERE Pre_Requisite IN".
                                              "(SELECT SubjCode FROM StudGrade WHERE StudentNumber =".
                                              "'$studentID' AND Grade <= 3 AND Grade != 0) ".
                                     "AND CourseID IN".
                                              "(SELECT Course FROM Students WHERE StudentNumber = ".
                                              "'$studentID'))";


                    $msquery = mssql_query($mssql,$this->conb);
                    $fetch = mssql_fetch_array($msquery);
                    while ($row = $fetch){
                          $_SESSION['checkboxes']=$row['SubjCode'];
                          echo "<tr><td><INPUT TYPE='CHECKBOX' NAME='$row[SubjCode]' ></td>".
                               "<td>$row[SubjCode]</td>".
                               "<td>$row[Description]</td>".
                               "<td>$row[FromTime]</td>".
                               "<td>$row[ToTime]</td>".
                               "<td>$row[Semester]</td>".
                               "<td>$row[SchoolYear]</td>".
                               "<td>$row[Day]</td>".
                               "<td>$row[Room]</td></tr>";
                    }
           }

           /*
             msEnlist - the student will now enlist to subject that they take
           */
           function msEnlist($studentID, $schedCode, $sectionCode, $subjCode, $semester,
                             $schoolY, $prof, $schedtype, $enlistedBy, $dateEnlist,
                             $secured_slot, $securedBy){

                    $mssql = "INSERT INTO Enlistment VALUES('$studentID','$schedCode','$sectionCode',"
                             ."'$subjCode','$semester','$schoolY','$prof','1','$schedtype','0','$enlistedBy',"
                             ."'$dateEnlist','$secured_slot','$securedBy')";

                    return mssql_query($mssql,$this->conb);
           }
           /*
            view the current enlisted student in the subject that they take
            by selecting either the subject or the the student
           */
           function msEnlisted($studID){
                    //This is for viewing the student who is enlist
                    $mssql = "SELECT S.Lastname,S.Firstname,S.Middlename FROM Enlistment AS E, Students AS S ".
                             "WHERE E.StudentNumber=S.StudentNumber AND S.StudentNumber =".
                             "'$studID'";

                    $msquery = mssql_query($mssql,$this->conb);
                    $fetch = mssql_fetch_array($msquery);
                       while ($row =$fetch){
                             echo "<td>".$row['Lastname'].", ".
                                  $row['Firstname']." ".
                                  $row['Middlename'].".</td>";
                       }
           }






















           function pinNum($studID,$email,$pin){
                    $sql="INSERT INTO studentaddress VALUE('$studID','$email','$pin','0')";
                    return mysql_query($sql,$this->con);
           }

           function updateUserField($username, $field, $value){
                    $sql = "UPDATE reg_login SET ".$field." = '$value' WHERE username = '$username'";
                    return mysql_query($sql, $this->con);
           }

           function listQuestion(){
                    $sql = "SELECT * FROM list_question";
                    return mysql_query($sql, $this->con);
           }

           function removeActiveUser($user){
                    if(!TRACK_VISITORS)return false;
                    $sql = "DELETE FROM active_user WHERE username = '$user'";
                    $this->calcNumActiveUsers();
                    return mysql_query($sql, $this->con);

           }
           
           function removeActiveGuest($ip){
                    if (!TRACK_VISITORS) return;
                    $sql = "DELETE FROM active_guest WHERE ip = '$ip'";
                    $this->calcNumActiveGuests();
                    return mysql_query($sql,$this->con);

           }
           
           function removeInactiveUsers(){
                    if (!TRACK_VISITORS) return;
                    $timeout = time() - USER_TIMEOUT * 60;
                    $sql = "DELETE FROM active_user WHERE timestamp < '$timeout'";
                    $this->calcNumActiveUsers();
                    return mysql_query($sql, $this->con);

           }

           function removeInactiveGuests(){
                    if (!TRACK_VISITORS) return;
                    $timeout = time() - GUEST_TIMEOUT * 60;
                    $this->calcNumActiveGuests();
                    $sql = "DELETE FROM active_guest";
                    return mysql_query($sql, $this->con);

           }
           /*
             getNumMembers - Return the number of signed-up users
             of the website, banned members not included. The first time
             the function is called on page load, the database
             is queried, on subsequent calls, the stored result is
             returned. This is to improved efficiency, effectively
             not querying the database when no call is made.
           */
           function getNumMembers(){
                    if ($this->num_members < 0){
                       $sql = "SELECT * FROM reg_login";
                       $result = mysql_query($sql, $this->con);
                       $this->num_members = mysql_num_rows($result);
                    }
                    return $this->num_members;
           }
           
           /*
             find out how many active user are viewing
             site and sets class variable accordingly
           */
           function calcNumActiveUsers(){
                    $sql = "SELECT * FROM active_user";
                    $result = mysql_query($sql, $this->con);
                    $this->num_active_users = mysql_num_rows($result);

           }
           
           /*
             Add guest to active guest table
           */
           function addActiveGuest($ip, $time){
                    if (!TRACK_VISITORS) return;
                    $sql = "REPLACE INTO active_guest VALUES ('$ip','$time')";
                    mysql_query($sql, $this->con);
                    $this->calcNumActiveGuests();
           }
           
           /*
             Find out how many active guests are viewing site
             and sets class variable accordingly.
           */
           function calcNumActiveGuests(){
                    $sql = "SELECT * FROM active_guest";
                    $result = mysql_query($sql, $this->con);
                    $this->num_active_guests = mysql_num_rows($result);
           }
           
           /*
             check user last active timestamp
           */
           function addActiveUser($username, $time){
                    $sql="UPDATE reg_login SET  timestamp= '$time' WHERE username = '$username'";
                    mysql_query($sql, $this->con);
                    
                    if (!TRACK_VISITORS) return;
                    $sql="REPLACE INTO active_user VALUES ('$username','$time')";
                    mysql_query($sql,$this->con);
                    $this->calcNumActiveUSers();
           }
           
           /*
             check whether or not the given
             username is in the database, if so it checks if the
             given password is the same password in the database
             for that user. if the user doesn't exist of if the
             passwords don't match up, it return an error code
             (1 or 2). On success it return 0.
           */
           function confirmUserPass($username, $password){
                    if (!get_magic_quotes_gpc()){
                       $username= addslashes($username);
                    }
                    // verify that user is in database
                    $sql = "SELECT password FROM reg_login WHERE username = '$username'";
                    $result = mysql_query($sql, $this->con);
                    if (!$result || (mysql_num_rows($result)<1)){
                       return 1;
                    }
                    
                    //retrieve password from result, strip slashes
                    $dbarray= mysql_fetch_array($result);
                    $dbarray['password'] = stripslashes($dbarray['password']);
                    $password = stripslashes($password);
                    
                    //validate that password is correct
                    if ($password == $dbarray['password']){
                       return 0; // return success! password confirm
                    }else{
                          return 2;
                    }
           }
           
           /*
             check whether or not the given
             username is in the database
           */
           function confirmUserID($username,$userid){
                    if (!get_magic_quotes_gpc()){
                       $username=addslashes($username);
                    }
                    $sql="SELECT userID FROM reg_login WHERE username= '$username'";
                    $result=mysql_query($sql, $this->con);
                    if (!$result || mysql_num_rows($result) < 1 ){
                       return 1; //username failure
                    }
                    
                    //retrieve username from result, strip slashes
                    $dbarray=mysql_fetch_array($result);
                    $dbarray['userID']=stripslashes($dbarray['userID']);
                    $userid=stripslashes($userid);
                    
                    /*
                      validate that userid is correct
                    */
                    if ($userid=$dbarray['userID']){
                       return 0;//Username and userid confirmed
                    }else{
                       return 2;//userid invalid
                    }
           }
           //view the result array from a query asking  for all information stored.
           function getUserInfo($username){
                    $sql= "SELECT * FROM reg_login WHERE username= '$username'";
                    $result=mysql_query($sql, $this->con);

                    if (!$result || (mysql_num_rows($result)<1)){
                       return NULL;
                    }
                    
                    $dbarray=mysql_fetch_array($result);
                    
                    return $dbarray;
           }
           
           function loginUser($username,$password){
        
                    //To protect MySQL injection
                    $username=stripslashes($username);
                    $password=stripslashes($password);
                    $username=mysql_real_escape_string($username);
                    $password=mysql_real_escape_string($password);
        
                    $sql="SELECT username,password FROM reg_login WHERE username='$username' and password='$password'";
                    $result=mysql_query($sql,$this->con);

                    // Mysql_num_row is counting table row
                    $count=mysql_num_rows($result);
                    // If result matched $myusername and $mypassword, table row must be 1 row
                    if($count==1){
                        //register $admin_user and $admin_password and redirect to the file "login_success.php"
                        session_register('username');
                        session_register('password');
                        //login success!!
                        }else{
                        echo "Wrong Username or Password";
                    }
           }
           
           /*this userRegister is not for the admin,
           user level:
                5-admin, 1-student, 0-guest */
           function addNewUser($username, $password, $userID, $email, $birthday, $postal, $secretQ, $secretA){
                    $date=date("Y-m-d");
                    $time=time();
                    $sql="INSERT INTO reg_login VALUES ('$username','$password','$userID','$email','1','$birthday',
                                                   '$postal','$date','$secretQ','$secretA','$time')";
                    return mysql_query($sql,$this->con);
           }
           
           /*
           user's updating the username and password
           */
           function changePassword($oldPassword,$newPassword, $username){
                     $sql="SELECT password FROM reg_login WHERE username='$username' and password='$oldPassword'";
                     $result=mysql_query($sql,$this->con);

                     if($result){
                           $newSQL="UPDATE reg_login ".
                                    "SET password='$newPassword' ".
                                    "WHERE username='$username'";
                           return mysql_query($newSQL,$this->con);
                     }else{
                           return 1;
                     }
           }

           function usernameTaken($username){
                    if (!get_magic_quotes_gpc()){
                       $username=addslashes($username);
                    }
                    $sql="SELECT username FROM reg_login WHERE username='$username'";
                    $result=mysql_query($sql,$this->con);
                    return (mysql_num_rows($result)>0);
           }
           
           /*
             perform the given query on the database and
             return the result, which may be false, true or a
             resource identifier.
           */
           function query($query){
                    return mysql_query($query, $this->con);
           }
           
           /*
             closing the connection of the mysql
           */
           function closeMySQL(){
                    return mysql_close($this->con);
           }
}
           /*
             create database connection
           */
           $database = new mySQLDB;
?>

thanks for the reply, I think i have to review first start from the scratch
maybe there is some error logic in my code.
Thank you!!!!!

gaspan will you tell me which tool you use for the integration of two databases??
i doing this work in vb.net 2010
if you want code then contact me on alisegment@gmail.com

Member Avatar for diafol

@Motib

This is a php thread an a very old one at that. You'll probably find more help in the vb.net forum (under software development). Also - displaying your email is probably not the wisest thing to do. Daniweb has a PM system for this sort of thing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.