mysqli PHP Class Code Examples

This page contains top rated real world PHP examples of class mysqli extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: view.html.php Project: grlf/eyedock
0
 function display($tpl = null)
 {
     global $mainframe;
     $id = JRequest::getVar('cid', array(0), '', 'array');
     $uid = (int) @$id[0];
     $edit = JRequest::getVar('edit', true);
     if ($edit) {
         if ($boxchecked != 0) {
             $uid = $boxchecked;
         }
         $mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
         $query = 'SELECT * from pn_rx_chem where pn_chem_id = ' . $uid;
         $result = $mysqli->query($query);
         $chemical = $result->fetch_object();
     }
     $mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'SELECT * from pn_rx_moa';
     $result = $mysqli->query($query);
     while ($obj = $result->fetch_object()) {
         $moas[] = $obj;
     }
     $this->assignRef('chemical', $chemical);
     $this->assignRef('moas', $moas);
     parent::display($tpl);
 }
Example #2
Show file File: view.html.php Project: irovast/eyedock
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     $db =& JFactory::getDBO();
     $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     $where = array();
     if ($search) {
         $where[] = 'LOWER(m.pn_trade) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     //	if($limiter || $limit) {
     $limiter = ' LIMIT ' . $limitstart . ', ' . $limit;
     //	}
     $mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'SELECT pn_med_id from pn_rx_meds';
     $result = $mysqli->query($query);
     $total = $result->num_rows;
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $query = 'SELECT m.*, comp.pn_name as companyname from pn_rx_meds m left join pn_rx_company comp on (m.pn_comp_id = comp.pn_comp_id)' . $where . ' ORDER BY m.pn_trade' . $limiter;
     $result = $mysqli->query($query);
     while ($obj = $result->fetch_object()) {
         $meds[] = $obj;
     }
     $this->assignRef('meds', $meds);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Example #3
Show file File: action.php Project: sayoripatil/ESP-Marshmellow
0
function create_user($email, $passwd, $repasswd, $firstname, $middlename, $lastname)
{
    if (strcmp($passwd, $repasswd) !== 0) {
        die("Password and Re-Enter Password is not equal");
    }
    $sql = "INSERT INTO user001 (ur_id, password, f_nm, m_nm, l_nm, cr_dt, cr_by)\nVALUES ('{$email}', '{$passwd}', '{$firstname}', '{$middlename}', '{$lastname}', now(), current_user());";
    $h_success = "Location:reg_success.html";
    $h_fail = "Location:reg_fail.php";
    $servername = "localhost";
    $username = "root";
    $password = "College@2015";
    $dbname = "ESPDB";
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    if ($conn->query($sql) === TRUE) {
        echo "User Successfully Registered";
        register($_POST[firstname], $_POST[middlename], $_POST[lastname], $_POST[email], $_POST[dob], $_POST[phone], $_POST[addr1], $_POST[addr2], $_POST[city], $_POST[state], $_POST[country], $_POST[postalCode]);
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
        $msg = "Error: " . "<br>" . $conn->error;
        $h_fail = $h_fail . "?msg=" . $msg;
        header($h_fail);
        exit;
    }
    $conn->close();
}
Example #4
Show file File: aliMarket.model.php Project: ohjack/newErp
0
 public function insertOKMail($seller, $buyer, $sellermail, $buyermail, $pushtime, $text)
 {
     $sql = "insert into msg_sendOK_EDM values (NULL,'{$seller}','{$buyer}','{$sellermail}','{$buyermail}','{$pushtime}','','{$text}') ";
     echo $sql;
     try {
         $result = $this->dbconn->query($sql);
     } catch (Exception $e) {
         echo "发送失败3\n" . $this->dbconn->error();
         $counter = 10;
         //连接失败,就进行10次重新连接
         while (!($conn = new mysqli("localhost", "root", "123456", "valsun_msg"))) {
             if (!$counter--) {
                 echo "放弃重连\n";
                 return FALSE;
             }
             echo "连接失败\n";
         }
         if ($res = $conn->query($sql)) {
             echo "插入成功!" . "\n";
         } else {
             return FALSE;
         }
     }
     return $result;
 }
Example #5
Show file File: index.php Project: v-sir/voice--card-for-wechat
0
 public function upload_image($postObj)
 {
     //include "./cache/token.php";
     // $token=$Token['token'];
     $sql2 = "select* from token";
     $conn2 = new mysqli("localhost", "root", "", "card");
     $result2 = $conn2->query($sql2);
     $row2 = $result2->fetch_array();
     $token = $row2[1];
     $dir = dirname(__FILE__) . "/card_img/";
     $filename = "sky31_0" . rand(1, 11) . ".jpg";
     $postdata = array("media" => "@" . $dir . $filename);
     $url = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token={$token}&type=image";
     $ch = curl_init();
     //新建curl
     curl_setopt($ch, CURLOPT_URL, $url);
     //url
     curl_setopt($ch, CURLOPT_POST, 1);
     //post
     curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
     //post内容
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $a = curl_exec($ch);
     $a = json_decode($a);
     $media_id = $a->media_id;
     //$errcode=$a->errcode;
     // if($errcode==40001 || $errcode==42001 || $errcode==41001 ){
     ///   $this->save_token();
     // $this->upload_image($postObj,$errcode="");
     //  }
     $this->card($media_id, $postObj, "");
 }
Example #6
Show file File: client_report_controller.php Project: HackathonPaypal/PCVC-Organization
0
 public function load_all_client_form_details()
 {
     //Create a container object which will hold complete information required to display the complete order page
     $container = new stdClass();
     //Establish mysqli connection
     $mysqli_connection = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
     if ($mysqli_connection->connect_errno) {
         $container->show_failure_message = true;
         $container->error_message = "Failed to connect to MySQL: (" . $mysqli_connection->connect_errno . ") " . $mysqli_connection->connect_error;
         return $container;
     }
     $client_form_details_array = array();
     $access = new ClientFormDetailsAccess($mysqli_connection);
     $client_form_details_array = $access->load_all_client_form_details();
     //Validate whether order loading is successful or not.
     if ($access->m_status == false) {
         $container->show_failure_message = true;
         $container->error_message = "No Record found";
         //Close the connection
         $mysqli_connection->close();
         return $container;
     }
     $container->success = true;
     foreach ($client_form_details_array as $row) {
         // $json = json_decode($row['form_json_data'],true);
         // $json['id'] = $row['id'];
         // $json['status'] = $row['status'];
         // $json['timestamp'] = $row['timestamp'];
         $container->client_form_details_array[] = $row;
     }
     return $container;
 }
Example #7
Show file File: addpair.php Project: ashish22arya/Matching-Game
0
function getfilename($type)
{
    include '/var/www/html/Matching-Game/assets/getconfig.php';
    $conn = new mysqli("localhost", $sqlun, $sqlp, "matchthefollowinggame");
    if ($conn->connect_error) {
        die("Connection Failed:" . $conn->connect_error);
    }
    $query1 = "select max(c1name) as name from pairs where c1type='" . $type . "'";
    $result1 = $conn->query($query1);
    $query2 = "select max(c2name) as name from pairs where c2type='" . $type . "'";
    $result2 = $conn->query($query2);
    if ($result1 && $result2) {
        $data1 = $result1->fetch_assoc();
        $data2 = $result2->fetch_assoc();
        $data1 = $data1['name'];
        $data2 = $data2['name'];
        $data1 = $data1[strlen($type)];
        $data2 = $data2[strlen($type)];
        if ($data1 > $data2) {
            echo "<br>" . $type . "" . ($data1 + 1) . "<br>";
            return $type . "" . ($data1 + 1);
        } else {
            echo "<br>" . $type . "" . ($data2 + 1) . "<br>";
            return $type . "" . ($data2 + 1);
        }
    }
}
Example #8
Show file File: meekrodb.2.3.class.php Project: rmak78/talentagency
0
 public function get()
 {
     $mysql = $this->internal_mysql;
     if (!$mysql instanceof MySQLi) {
         if (!$this->port) {
             $this->port = ini_get('mysqli.default_port');
         }
         $this->current_db = $this->dbName;
         $mysql = new mysqli();
         $connect_flags = 0;
         if ($this->ssl['key']) {
             $mysql->ssl_set($this->ssl['key'], $this->ssl['cert'], $this->ssl['ca_cert'], $this->ssl['ca_path'], $this->ssl['cipher']);
             $connect_flags |= MYSQLI_CLIENT_SSL;
         }
         foreach ($this->connect_options as $key => $value) {
             $mysql->options($key, $value);
         }
         // suppress warnings, since we will check connect_error anyway
         @$mysql->real_connect($this->host, $this->user, $this->password, $this->dbName, $this->port, null, $connect_flags);
         if ($mysql->connect_error) {
             $this->nonSQLError('Unable to connect to MySQL server! Error: ' . $mysql->connect_error);
         }
         $mysql->set_charset($this->encoding);
         $this->internal_mysql = $mysql;
         $this->server_info = $mysql->server_info;
     }
     return $mysql;
 }
Example #9
Show file File: my_connection.inc.php Project: lenmorld/AmazingCatering_website
0
function dbConnect($usertype, $connectionType = 'mysqli')
{
    // check if ran locally (testing) or online ################################
    $mystring = $_SERVER['HTTP_HOST'];
    // $_SERVER['HTTP_HOST'] holds the hostname,
    // if tested locally, it is ->  http://localhost/
    // if online, it is ->  http://amazingcoveragecatering.net46.net/
    $posLocal = strpos($mystring, 'localhost');
    // returns true if 'localhost' is find in hostname
    $posOnline = strpos($mystring, 'net46');
    // returns true if 'net46' is find in hostname
    if ($posLocal !== false) {
        //string 'localhost is find in address- use localhost'
        $host = 'localhost';
    } else {
        if ($posOnline !== false) {
            //string 'hostzi' - online host is find in address- use online host'
            $host = 'mysql2.000webhost.com';
        }
    }
    //$host = 'localhost';
    //$host = 'mysql11.000webhost.com';
    // ##################################################################
    $db = 'a8227946_amazing';
    //database name
    //only 1 user is allowed per database at 000webhost
    //so both modes uses the 'a5106316_awrite' user
    if ($usertype == 'read') {
        $user = 'a8227946_awrite';
        //database username
        $pwd = 'programming25';
        //database password
    } elseif ($usertype == 'write') {
        $user = 'a8227946_awrite';
        //database username
        $pwd = 'programming25';
        //database password
    } else {
        exit('Unrecognized connection type');
    }
    // Connection code goes here
    if ($connectionType == 'mysqli') {
        $conn = new mysqli($host, $user, $pwd, $db);
        //establish connection using the credentials given
        if ($conn->connect_error) {
            die('Cannot open database' . $host . $posOnline . $posLocal);
        }
        return $conn;
        //return connection object if successful
    } else {
        try {
            return new PDO("mysql:host={$host};dbname={$db}", $user, $pwd);
            //establish connection using the credentials given
        } catch (PDOException $e) {
            //catch database error
            echo 'Cannot connect to database';
            exit;
        }
    }
}
Example #10
Show file File: paiement_comptant_top.php Project: BGCX067/faaa-multifac-svn-to-git
0
function getInfo()
{
    $id = $_GET['id'];
    $type = $_GET['type'];
    $mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB);
    switch ($type) {
        case "repas":
            $output[0] = "<b>Encaissement au comptant (Ticket Repas)</b><br/>";
            $output[1] = strtoupper($type);
            break;
        case "cantine":
            $query = "SELECT `datefacture`,`communeid`,`montantfcp`,`montanteuro`,`restearegler` FROM `" . DB . "`.`factures_cantine` WHERE `idfacture` = {$id}";
            $result = $mysqli->query($query);
            $row = $result->fetch_array(MYSQLI_ASSOC);
            $output[0] = "<b>Facture {$type} " . $row['communeid'] . " du " . standarddateformat($row['datefacture']) . " montant " . trispace($row['montantfcp']) . "FCP (" . $row['montanteuro'] . "&euro;)</b><br/>" . "Reste &agrave; r&eacute;gler " . trispace($row['restearegler']) . " FCP<input type='hidden' id='montantmax' value='" . $row['restearegler'] . "'/><input type='hidden' id='montanttotal' value='" . $row['montantfcp'] . "'/>";
            $output[1] = strtoupper($type);
            break;
        case "etal":
            $query = "SELECT `datefacture`,`communeid`,`montantfcp`,`montanteuro`,`restearegler` FROM `" . DB . "`.`factures_etal` WHERE `idfacture` = {$id}";
            $result = $mysqli->query($query);
            $row = $result->fetch_array(MYSQLI_ASSOC);
            $output[0] = "<b>Facture Place et Etal " . $row['communeid'] . " du " . standarddateformat($row['datefacture']) . " montant " . trispace($row['montantfcp']) . "FCP (" . $row['montanteuro'] . "&euro;)</b><br/>" . "Reste &agrave; r&eacute;gler " . trispace($row['restearegler']) . " FCP<input type='hidden' id='montantmax' value='" . $row['restearegler'] . "'/><input type='hidden' id='montanttotal' value='" . $row['montantfcp'] . "'/>";
            $output[1] = "PLACE ET ETAL";
            break;
        case "amarrage":
            $query = "SELECT `datefacture`,`communeid`,`montantfcp`,`montanteuro`,`restearegler` FROM `" . DB . "`.`factures_amarrage` WHERE `idfacture` = {$id}";
            $result = $mysqli->query($query);
            $row = $result->fetch_array(MYSQLI_ASSOC);
            $output[0] = "<b>Facture Amarrage " . $row['communeid'] . " du " . standarddateformat($row['datefacture']) . " montant " . trispace($row['montantfcp']) . "FCP (" . $row['montanteuro'] . "&euro;)</b><br/>" . "Reste &agrave; r&eacute;gler " . trispace($row['restearegler']) . " FCP<input type='hidden' id='montantmax' value='" . $row['restearegler'] . "'/><input type='hidden' id='montanttotal' value='" . $row['montantfcp'] . "'/>";
            $output[1] = "AMARRAGE";
            break;
    }
    $mysqli->close();
    return $output;
}
Example #11
Show file File: RequestHandler.inc.php Project: BPMspaceUG/SQMS
0
 public function __construct()
 {
     // Get global variables here
     global $DB_host;
     global $DB_user;
     global $DB_pass;
     global $DB_name;
     // Connect to database
     $db = new mysqli($DB_host, $DB_user, $DB_pass, $DB_name);
     if ($db->connect_errno) {
         printf("Connect failed: %s\n", mysqli_connect_error());
         exit;
     }
     // Set charset
     $db->query("SET NAMES utf8");
     // Save DB Connection
     $this->db = $db;
     //--- Create RoleManager
     $this->RM = new RoleManager();
     //--- Create state engine objects for Syllabus and Question
     // Params: [$db, $tbl_root, $tbl_states, $tbl_rules, $col_rootID, $col_stateID, $colname_stateID_at_TblStates]
     // StateEngine Syllabus
     $this->SESy = new StateEngine($this->db, 'sqms_syllabus', 'sqms_syllabus_state', 'sqms_syllabus_state_rules', 'sqms_syllabus_id', 'sqms_state_id', 'sqms_syllabus_state_id');
     // StateEngine Question
     $this->SEQu = new StateEngine($this->db, 'sqms_question', 'sqms_question_state', 'sqms_question_state_rules', 'sqms_question_id', 'sqms_question_state_id', 'sqms_question_state_id');
 }
Example #12
Show file File: Mysqli.php Project: hientruong90/ee_14_installer
0
 /**
  * Creates a real connection to the database with multi-query capability.
  *
  * @return void
  * @throws Zend_Db_Adapter_Mysqli_Exception
  */
 protected function _connect()
 {
     if ($this->_connection) {
         return;
     }
     if (!extension_loaded('mysqli')) {
         throw new Zend_Db_Adapter_Exception('mysqli extension is not installed');
     }
     // Suppress connection warnings here.
     // Throw an exception instead.
     @($conn = new mysqli());
     if (false === $conn || mysqli_connect_errno()) {
         throw new Zend_Db_Adapter_Mysqli_Exception(mysqli_connect_errno());
     }
     $conn->init();
     $conn->options(MYSQLI_OPT_LOCAL_INFILE, true);
     #$conn->options(MYSQLI_CLIENT_MULTI_QUERIES, true);
     $port = !empty($this->_config['port']) ? $this->_config['port'] : null;
     $socket = !empty($this->_config['unix_socket']) ? $this->_config['unix_socket'] : null;
     // socket specified in host config
     if (strpos($this->_config['host'], '/') !== false) {
         $socket = $this->_config['host'];
         $this->_config['host'] = null;
     } elseif (strpos($this->_config['host'], ':') !== false) {
         list($this->_config['host'], $port) = explode(':', $this->_config['host']);
     }
     #echo "<pre>".print_r($this->_config,1)."</pre>"; die;
     @$conn->real_connect($this->_config['host'], $this->_config['username'], $this->_config['password'], $this->_config['dbname'], $port, $socket);
     if (mysqli_connect_errno()) {
         throw new Zend_Db_Adapter_Mysqli_Exception(mysqli_connect_error());
     }
     $this->_connection = $conn;
     /** @link http://bugs.mysql.com/bug.php?id=18551 */
     $this->_connection->query("SET SQL_MODE=''");
 }
Example #13
Show file File: simple.php Project: sachalmalick/AjaxPHPMySQL
0
function printNumJoined()
{
    $servername = "localhost";
    $username = "root";
    $password = "sachal99";
    $dbname = "hello";
    // Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        echo "uh oh";
        die("Connection failed: " . $conn->connect_error);
    } else {
    }
    $sql = "SELECT numjoin FROM numjoined";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
        // output data of each row
        while ($row = $result->fetch_assoc()) {
            echo "num joined: " . $row["numjoin"] . "<br>";
        }
    } else {
        echo "0 results";
    }
    $conn->close();
}
Example #14
Show file File: ecole_global_search_functions.php Project: BGCX067/faaa-multifac-svn-to-git
0
function load($ecole, $classe)
{
    $mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB);
    $query = "SELECT `nom`,`prenom`,`enfantid`,`clientid` FROM `enfants` WHERE `ecole`='{$ecole}' AND `classe`='{$classe}' AND `active`='1' ORDER BY `nom`";
    $result = $mysqli->query($query);
    $output = "<table id=\"tbl_results\"><tr>";
    $i = 0;
    $j = 4;
    //max columns
    while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
        $output .= "<td class=\"tdcheck\" id=\"td" . $row["enfantid"] . "\"><input type=\"checkbox\" name=\"" . $row["enfantid"] . "\" id=\"" . $row["enfantid"] . "\"/>" . "<a href='clients.php?edit=" . $row["clientid"] . "&hideerrors=1'>" . strtoupper(htmlentities($row["nom"])) . " " . ucwords(htmlentities($row["prenom"])) . "</a>" . "</td>";
        $i++;
        if ($i == $j) {
            $output .= "</tr><tr>";
            $i = 0;
        }
    }
    if ($i == $j) {
        $output .= "</table>";
    } else {
        $output .= "</td></tr></table>";
    }
    $mysqli->close();
    return $output;
}
Example #15
Show file File: db.php Project: dxdc/sendy-webhooks
0
function dbConnect()
{
    //Connect to database
    // Access global variables
    global $mysqli;
    global $dbHost;
    global $dbUser;
    global $dbPass;
    global $dbName;
    if (!isset($mysqli)) {
        // Attempt to connect to database server
        if (isset($dbPort)) {
            $mysqli = new mysqli($dbHost, $dbUser, $dbPass, $dbName, $dbPort);
        } else {
            $mysqli = new mysqli($dbHost, $dbUser, $dbPass, $dbName);
        }
        // If connection failed...
        if ($mysqli->connect_error) {
            webhooks_debug(" == Failed to connect to database: " . $mysqli->connect_error . " == ", true);
        }
        // if ($mysqli->connect_error)
        global $charset;
        mysqli_set_charset($mysqli, isset($charset) ? $charset : "utf8");
    }
    // if(!isset($mysqli))
    return $mysqli;
}
Example #16
Show file File: doctor.php Project: apuurva02/medical_record_system
0
 function list_patient()
 {
     $servername = "localhost";
     $username = "root";
     $password = "Redredred321";
     $dbname = "gh";
     // Create connection
     session_start();
     $conn = new mysqli($servername, $username, $password, $dbname);
     // Check connection
     if ($conn->connect_error) {
         die("Connection failed: " . $conn->connect_error);
     }
     $doctor = $_SESSION['username'];
     $sql = "SELECT name, age, username FROM patient WHERE doctor='{$doctor}'";
     $result = $conn->query($sql);
     if ($result->num_rows > 0) {
         $i = 0;
         // output data of each row
         while ($row = $result->fetch_assoc()) {
             $arr[$i] = $row;
             $i++;
         }
     }
     return $arr;
     $conn->close();
 }
Example #17
Show file File: dosage.php Project: croberson2014/Umbrella
0
 function setCompounds($option)
 {
     if ($option == 'EXISTING') {
         @($db = new mysqli('localhost', getDBUserName(0), getDBPassword(0), getDBName(0)));
         if (mysqli_connect_errno()) {
             //echo "<p>Errorrrss</p>";
             @$db->close();
             return false;
         } else {
             //(address_id, privilege, login, password, firstname, lastname, created)
             $db->select_db("UMBRELLA");
             $result = $db->query('select * from DOSAGE_DETAILS natural join COMPOUND where dosage_id = ' . $this->__get('dosage_id'));
             $num_results = $result->num_rows;
             //echo "<p>Number of compounds: ".$num_results."</p>";
             for ($i = 0; $i < $num_results; $i++) {
                 $row = $result->fetch_assoc();
                 $this->compounds[$i] = new compound();
                 $this->compounds[$i]->read($row['compound_id']);
                 //echo "<p>Compound that existed was set</p>";
             }
             $db->close();
             return true;
         }
     } elseif ($option == 'NEW') {
         @($db = new mysqli('localhost', getDBUserName(0), getDBPassword(0), getDBName(0)));
         if (mysqli_connect_errno()) {
             //echo "<p>Errorrrss</p>";
             @$db->close();
             return false;
         } else {
             //(address_id, privilege, login, password, firstname, lastname, created)
             //echo "<p>Successful DB read connection</p>";
             $db->select_db("UMBRELLA");
             $result = $db->query('select * from COMPOUND where compound_id = 0');
             $num_results = $result->num_rows;
             //echo "<p>Number of compounds: ".$num_results."</p>";
             for ($i = 0; $i < $num_results; $i++) {
                 $row = $result->fetch_assoc();
                 $this->compounds[$i] = new compound();
                 $this->compounds[$i]->read($row['compound_id']);
             }
             //echo "<p>New compounds set</p>";
             $db->close();
             return true;
         }
     }
     return $this->compounds;
 }
Example #18
Show file File: functions.php Project: HDVinnie/BtiTracker-1.5.0
0
function dbconn($do_clean = false)
{
    global $dbhost, $dbuser, $dbpass, $database, $HTTP_SERVER_VARS, $db;
    if ($GLOBALS["persist"]) {
        $db = new mysqli($dbhost, $dbuser, $dbpass, $database);
    } else {
        $db = new mysqli($dbhost, $dbuser, $dbpass, $database);
    }
    if ($db->connect_error) {
        die('Connect Error (' . $db->connect_errno . ') ' . $db->connect_error);
    }
}
Example #19
Show file File: view.html.php Project: grlf/eyedock
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     $db =& JFactory::getDBO();
     $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     //	echo $limitstart;
     //	echo $limit;
     $where = array();
     if ($search) {
         $where[] = 'LOWER(pn_poly_name) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     //	if($limiter || $limit) {
     $limiter = ' LIMIT ' . $limitstart . ', ' . $limit;
     //	}
     $mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'SELECT * from pn_lenses_polymers';
     $result = $mysqli->query($query);
     $total = $result->num_rows;
     //	echo $total;
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'SELECT * from pn_lenses_polymers ' . $where . ' ORDER BY pn_poly_name' . $limiter;
     $result = $mysqli->query($query);
     while ($obj = $result->fetch_object()) {
         $polymers[] = $obj;
     }
     foreach ($polymers as $poly) {
         switch ($poly->pn_fda_grp) {
             case 1:
                 $poly->pn_fda_grp = 'Low Water (<50 percent water content), Nonionic Polymers.<br />This group has the greatest resistance to protein deposition due 
its lower water content and nonionic nature. Heat, chemical, and hydrogen peroxide care regimens can be used.';
                 break;
             case 2:
                 $poly->pn_fda_grp = 'High Water (greater than 50 percent water content), Nonionic Polymers.<br />The higher water content of this group results in g
ter protein attraction than with group 1. However, the nonionic polymers reduce the potential for further attraction. Heat disinfection should be a
ded because of the high water content. In addition, sorbic acid and potassium sorbate preservatives can discolor the lenses.';
                 break;
             case 3:
                 $poly->pn_fda_grp = 'Low Water (less then 50 percent water content), Ionic Polymers.<br />The lower water content but ionic nature of these polymers
sults in intermediate protein resistance. Heat, chemical and hydrogen peroxide care systems may be used.';
                 break;
             case 4:
                 $poly->pn_fda_grp = 'High Water (greater then 50 percent water content), Ionic Polymers.<br />Because of the high water content and ionic nature of 
se polymers they attract more proteins than any other group. It is best to avoid heat disinfection and sorbic acid preservatives.';
                 break;
         }
     }
     $this->assignRef('polymers', $polymers);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Example #20
Show file File: view.html.php Project: grlf/eyedock
0
 function display($tpl = null)
 {
     global $mainframe;
     $id = JRequest::getVar('cid', array(0), '', 'array');
     //	$boxchecked = JRequest::getVar( 'boxchecked' );
     //	echo $boxchecked;
     $uid = (int) @$id[0];
     $edit = JRequest::getVar('edit', true);
     if ($edit) {
         /*if($boxchecked != 0){
         			$uid = $boxchecked;
         		}*/
         $mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
         $query = 'SELECT * from pn_lenses where pn_tid = ' . $uid;
         $result = $mysqli->query($query);
         $lens = $result->fetch_object();
         $query = 'SELECT * from pn_lenses_powers where lensID = ' . $uid;
         $result = $mysqli->query($query);
         while ($obj = $result->fetch_object()) {
             $lenspowers[] = $obj;
         }
     }
     $mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'SELECT pn_comp_tid, pn_comp_name from pn_lenses_companies ORDER BY  pn_comp_name ASC ';
     $result = $mysqli->query($query);
     while ($obj = $result->fetch_object()) {
         $companies[] = $obj;
     }
     $query = 'SELECT pn_poly_tid, pn_poly_name from pn_lenses_polymers ORDER BY pn_poly_name ASC';
     $result = $mysqli->query($query);
     while ($obj = $result->fetch_object()) {
         $polymers[] = $obj;
     }
     if ($edit) {
         $bcsimples = explode(',', $lens->pn_bc_simple);
         $bcsimples = array_filter(array_map('trim', $bcsimples));
         //remove whitespace
         $enhsimples = explode(',', $lens->pn_enh_names_simple);
         $enhsimples = array_filter(array_map('trim', $enhsimples));
         //remove whitespace
         $opqsimples = explode(',', $lens->pn_opaque_names_simple);
         $opqsimples = array_filter(array_map('trim', $opqsimples));
         //remove whitespace
     } else {
         $bcsimples = array();
         $enhsimples = array();
         $opqsimples = array();
     }
     $this->assignRef('polymers', $polymers);
     $this->assignRef('companies', $companies);
     $this->assignRef('lens', $lens);
     $this->assignRef('bcsimples', $bcsimples);
     $this->assignRef('enhsimples', $enhsimples);
     $this->assignRef('opaquesimples', $opqsimples);
     if ($edit) {
         $this->assignRef('lenspowers', $lenspowers);
     }
     parent::display($tpl);
 }
Example #21
Show file File: index.php Project: easonkamander/temp
0
function datapages()
{
    if ($_SESSION['userinfo']['status'] === 1) {
        $conn = new mysqli('localhost', 'root', '12345password12345', 'main');
        if ($conn->connect_error) {
            die("Connection failed: " . $conn->connect_error);
        }
        $num_rows_res = $conn->query("SELECT count(*) FROM mlib;");
        $num_rows = mysqli_fetch_array($num_rows_res, MYSQLI_NUM)[0];
        for ($i = 1; $i <= $num_rows; $i++) {
            $pages_sql = "Select * FROM mlib WHERE c_id=" . $i . ";";
            $pages_res = $conn->query($pages_sql);
            $pages[$i] = mysqli_fetch_object($pages_res);
        }
        $conn->close();
    } else {
        $conn = new mysqli('localhost', 'root', '12345password12345', 'main');
        if ($conn->connect_error) {
            die("Connection failed: " . $conn->connect_error);
        }
        $num_rows_res = $conn->query("SELECT count(*) FROM mlib WHERE viewers='all';");
        $num_rows = mysqli_fetch_array($num_rows_res, MYSQLI_NUM)[0];
        for ($i = 1; $i <= $num_rows; $i++) {
            $pages_sql = "Select * FROM mlib WHERE c_id=" . $i . " AND viewers='all';";
            $pages_res = $conn->query($pages_sql);
            $pages[$i] = mysqli_fetch_object($pages_res);
        }
        $conn->close();
    }
    return $pages;
}
Example #22
Show file File: gfunctions.php Project: GlitchedMan/CyberWorks
0
function serverConnect($dbid = NULL)
{
    if (isset($_SESSION['dbid']) && empty($dbid)) {
        $dbid = $_SESSION['dbid'];
    }
    $settings = (require 'config/settings.php');
    $db_connection = masterConnect();
    $sql = "SELECT `sql_host`,`sql_name`,`sql_pass`,`sql_user` FROM `db` WHERE `dbid` = '" . $dbid . "';";
    $server = $db_connection->query($sql);
    if ($server->num_rows === 1) {
        $server = $server->fetch_object();
        $host = decrypt($server->sql_host);
        if (strpos($host, ":")) {
            $SQL = explode(":", $host);
            $host = $SQL['0'];
            $port = $SQL['1'];
        }
        if (isset($port)) {
            $db_link = new mysqli($host, decrypt($server->sql_user), decrypt($server->sql_pass), decrypt($server->sql_name), $port);
        } else {
            $db_link = new mysqli($host, decrypt($server->sql_user), decrypt($server->sql_pass), decrypt($server->sql_name));
        }
        if (!$db_link->set_charset("utf8")) {
            $db_link->errors[] = $db_link->error;
        }
        return $db_link;
    } else {
        return false;
    }
}
Example #23
Show file File: view.html.php Project: grlf/eyedock
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     $db =& JFactory::getDBO();
     $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     $where = array();
     if ($search) {
         $where[] = 'LOWER(pn_name) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     //	if($limiter || $limit) {
     $limiter = ' LIMIT ' . $limitstart . ', ' . $limit;
     //	}
     $mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'SELECT * from pn_rx_chem';
     $result = $mysqli->query($query);
     $total = $result->num_rows;
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'SELECT c.*, m.pn_name as moa_name from pn_rx_chem c left join pn_rx_moa m on (c.pn_moa_id = m.pn_moa_id) ' . $where . ' ORDER BY pn_name' . $limiter;
     $result = $mysqli->query($query);
     while ($obj = $result->fetch_object()) {
         $chemicals[] = $obj;
     }
     $this->assignRef('chemicals', $chemicals);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Example #24
Show file File: view.html.php Project: grlf/eyedock
0
 function display($tpl = null)
 {
     global $mainframe;
     $id = JRequest::getVar('cid', array(0), '', 'array');
     //	$boxchecked = JRequest::getVar( 'boxchecked' );
     //	echo $boxchecked;
     $uid = (int) @$id[0];
     $edit = JRequest::getVar('edit', true);
     if ($edit) {
         if ($boxchecked != 0) {
             $uid = $boxchecked;
         }
         $mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
         $query = 'SELECT * from rgpMaterials where tid = ' . $uid;
         $result = $mysqli->query($query);
         $material = $result->fetch_object();
     }
     $mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'SELECT tid, name from rgpMaterialCompany';
     $result = $mysqli->query($query);
     while ($obj = $result->fetch_object()) {
         $materialcompanies[] = $obj;
     }
     $query = 'SELECT tid, name from rgpMaterialType';
     $result = $mysqli->query($query);
     while ($obj = $result->fetch_object()) {
         $materialtypes[] = $obj;
     }
     $this->assignRef('materialtypes', $materialtypes);
     $this->assignRef('materialcompanies', $materialcompanies);
     $this->assignRef('material', $material);
     parent::display($tpl);
 }
Example #25
Show file File: functions.php Project: HDVinnie/BtiTracker-1.5.0
0
function dbconn($do_clean = false)
{
    global $dbhost, $dbuser, $dbpass, $database, $HTTP_SERVER_VARS, $db;
    /*
     * Connect to Database.
     */
    if ($GLOBALS["persist"]) {
        $db = new mysqli($dbhost, $dbuser, $dbpass, $database);
    } else {
        $db = new mysqli($dbhost, $dbuser, $dbpass, $database);
    }
    /*
     * This is the "official" OO way to do it,
     * BUT $connect_error was broken until PHP 5.2.9 and 5.3.0.
     */
    if ($db->connect_error) {
        die('Connect Error (' . $db->connect_errno . ') ' . $db->connect_error);
    }
    $db->query("SET NAMES UTF8");
    $db->query("SET collation_connection = 'utf8_general_ci'");
    userlogin();
    if ($do_clean) {
        register_shutdown_function("cleandata");
    }
}
Example #26
Show file File: RoleManager.inc.php Project: BPMspaceUG/SQMS
0
 public function __construct()
 {
     // Get global variables here
     global $DB_host;
     global $DB_user;
     global $DB_pass;
     global $DB_name;
     // Connect to database
     // TODO: give DB object in the constructor
     $db = new mysqli($DB_host, $DB_user, $DB_pass, $DB_name);
     if ($db->connect_errno) {
         printf("Connect failed: %s\n", mysqli_connect_error());
         exit;
     }
     $db->query("SET NAMES utf8");
     $this->db = $db;
     // Connect to LIAM
     $db2 = new mysqli(HOST, USER, PASSWORD, DATABASE);
     if ($db2->connect_errno) {
         printf("Connect failed: %s\n", mysqli_connect_error());
         exit;
     }
     $db2->query("SET NAMES utf8");
     $this->dbLIAM = $db2;
 }
Example #27
Show file File: patient.php Project: apuurva02/medical_record_system
0
 public function auth($username, $password)
 {
     //echo"in auth";
     $servername = "localhost";
     $user = "root";
     $pass = "Redredred321";
     $dbname = "gh";
     $conn = new mysqli($servername, $user, $pass, $dbname);
     if ($conn->connect_error) {
         die("Connection failed: " . $conn->connect_error);
     }
     if ($stmt = $conn->prepare("SELECT name FROM patient WHERE username=? AND password=?")) {
         $stmt->bind_param("ss", $username, $password);
         $stmt->execute();
         $result = $stmt->fetch();
         if ($result == 1) {
             //die("logged in");
             session_start();
             $_SESSION['username'] = $username;
             $_SESSION['user_type'] = "patient";
         } else {
             die("Username or Password is invalid");
         }
     }
     $conn->close();
 }