本文整理汇总了PHP中open_connection函数的典型用法代码示例。如果您正苦于以下问题:PHP open_connection函数的具体用法?PHP open_connection怎么用?PHP open_connection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了open_connection函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert_child
function insert_child()
{
$father = $_POST['father'];
$mother = $_POST['mother'];
//$pswrd=$_POST['pswrd'];
//$cnf_pswrd=$_POST['cnf_pswrd'];
//$pswrd = "ABCD";
$date = $_POST['date'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$pin = $_POST['pin'];
$contact = $_POST['contact'];
$lat = $_POST['lat'];
$lng = $_POST['lng'];
$birth_id = $_POST['birth_id'];
$hid = $_SESSION['id'] . "/" . date("Y") . "/" . $birth_id;
$con = open_connection();
$sql_query = "INSERT INTO child (dob,hid,mother,father,address,city,state,pin,lat,lng,contact) VALUES('{$date}','{$hid}', '{$mother}','{$father}','{$address}','{$city}','{$state}',{$pin},0,0,{$contact})";
if (mysqli_query($con, $sql_query)) {
$response['code'] = 1;
$response['response'] = "Data inaserted";
$response['response_data'] = $hid;
} else {
$response['code'] = 0;
$response['response'] = "Please try again later";
}
echo json_encode($response);
}
示例2: buscar_cursos
public function buscar_cursos($nomeCurso)
{
$conexao = open_connection();
$dados = array();
$Where = "";
if ($nomeCurso == " ") {
$Where = "";
} else {
$Where = " WHERE nome_curso LIKE '%{$nomeCurso}%' ";
}
$SQLBusCurso = $conexao->query("SELECT cod_curso,\n\t\t\t\t\t\t\t\t\t\t\t\t nome_curso,\n\t\t\t\t\t\t\t\t\t\t\t\t periodo \n\t\t\t\t\t\t\t\t\t\t\t FROM curso \n\t\t\t\t\t\t\t\t\t\t\t{$Where}\n\t\t\t\t\t\t\t\t\t\t\t LIMIT 7");
if ($SQLBusCurso) {
while ($RESBusCurso = $SQLBusCurso->fetch(PDO::FETCH_ASSOC)) {
if ($RESBusCurso['periodo'] == 1) {
$periodo = "Matutino";
}
if ($RESBusCurso['periodo'] == 2) {
$periodo = "Vespertino";
}
if ($RESBusCurso['periodo'] == 3) {
$periodo = "Integral";
}
$dados[] = array("value" => $RESBusCurso['cod_curso'] . "-" . $RESBusCurso['nome_curso'] . "-" . $periodo);
}
}
return $dados;
}
示例3: __construct
public function __construct()
{
$this->connect = open_connection();
$this->path = $GLOBALS['path'];
$this->url_rewrite = $GLOBALS['url_rewrite'];
$this->url_rewrite_report = $GLOBALS['url_rewrite_report'];
//echo $this->path;
}
示例4: k_query
function k_query($request)
{
global $num_queries;
global $mysql_link;
if ($mysql_link == false) {
open_connection();
}
$num_queries = $num_queries + 1;
$result = mysql_query($request, $mysql_link) or die("{$request}<br>Error in: " . mysql_error());
return $result;
}
示例5: search
function search($field, $value)
{
$con = open_connection();
$sql_query = "SELECT * from child where " . $field . "=" . $value;
//echo $sql_query;
if ($result = mysqli_query($con, $sql_query)) {
if (mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
echo mysqli_num_rows($result);
//display here
} else {
echo "No results found";
}
} else {
echo mysql_error($con);
}
}
示例6: buscar_alunos
public function buscar_alunos($nomePessoa)
{
$conexao = open_connection();
$dados = array();
$Where = "";
if ($nomePessoa == " ") {
$Where = "";
} else {
$Where = " WHERE nome_aluno LIKE '%{$nomePessoa}%' ";
}
$SQLBusAluno = $conexao->query("SELECT cod_aluno,\n\t\t\t\t\t\t\t\t\t\t\t\t nome_aluno\n\t\t\t\t\t\t\t\t\t\t\t FROM aluno \n\t\t\t\t\t\t\t\t\t\t\t{$Where}\n\t\t\t\t\t\t\t\t\t\t\t LIMIT 7");
if ($SQLBusAluno) {
while ($RESBusAluno = $SQLBusAluno->fetch(PDO::FETCH_ASSOC)) {
$dados[] = array("value" => $RESBusAluno['cod_aluno'] . "-" . $RESBusAluno['nome_aluno']);
}
}
return $dados;
}
示例7: register_hospital
function register_hospital()
{
$name = $_POST['name'];
$pswrd = $_POST['password'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$pin = $_POST['pin'];
$contact = $_POST['contact'];
$con = open_connection();
$query = "INSERT INTO hospital (name,pswrd,address,city,state,pin,lat,lng,contact) VALUES('{$name}','{$pswrd}','{$address}','{$city}','{$state}',{$pin},0,0,{$contact})";
if (mysqli_query($con, $query)) {
$response['code'] = 1;
$response['response'] = "Data inserted.";
} else {
$response['code'] = 0;
$response['response'] = "There was some error. Please try again later";
}
echo json_encode($response);
}
示例8: ob_start
<?php ob_start();?>
<html>
<?php
include "../../config/config.php";
include "$path/header.php";
include "$path/title.php";
?>
<body>
<?php
include "$path/menu.php";
$status=$_GET['status'];
$id=$_SESSION['Aset_ID'];
?>
<?php
open_connection();
if (isset($_GET['act']))
{
if ($_GET['act'] == 'Edit')
{
$queryselect = "SELECT a.*, b.* From Penilaian AS a LEFT JOIN NilaiAset AS b ON a.Penilaian_ID = b.Penilaian_ID
WHERE a.Penilaian_ID = '$_GET[id]'";
// print_r($queryselect);
$result=mysql_query($queryselect) or die(mysql_error());
if ($result){
//echo mysql_num_rows($result);
$row = mysql_fetch_object($result);
// pr($row);
示例9: xmpp_connect
function xmpp_connect($options, $access_token)
{
global $STREAM_XML, $AUTH_XML, $RESOURCE_XML, $SESSION_XML, $CLOSE_XML, $START_TLS;
$fp = open_connection($options['server']);
if (!$fp) {
return false;
}
// initiates auth process (using X-FACEBOOK_PLATFORM)
send_xml($fp, $STREAM_XML);
if (!find_xmpp($fp, 'STREAM:STREAM')) {
return false;
}
if (!find_xmpp($fp, 'MECHANISM', 'X-FACEBOOK-PLATFORM')) {
return false;
}
// starting tls - MANDATORY TO USE OAUTH TOKEN!!!!
send_xml($fp, $START_TLS);
if (!find_xmpp($fp, 'PROCEED', null, $proceed)) {
return false;
}
stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
send_xml($fp, $STREAM_XML);
if (!find_xmpp($fp, 'STREAM:STREAM')) {
return false;
}
if (!find_xmpp($fp, 'MECHANISM', 'X-FACEBOOK-PLATFORM')) {
return false;
}
// gets challenge from server and decode it
send_xml($fp, $AUTH_XML);
if (!find_xmpp($fp, 'CHALLENGE', null, $challenge)) {
return false;
}
$challenge = base64_decode($challenge);
$challenge = urldecode($challenge);
parse_str($challenge, $challenge_array);
// creates the response array
$resp_array = array('method' => $challenge_array['method'], 'nonce' => $challenge_array['nonce'], 'access_token' => $access_token, 'api_key' => $options['app_id'], 'call_id' => 0, 'v' => '1.0');
// creates signature
$response = http_build_query($resp_array);
// sends the response and waits for success
$xml = '<response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">' . base64_encode($response) . '</response>';
send_xml($fp, $xml);
if (!find_xmpp($fp, 'SUCCESS')) {
return false;
}
// finishes auth process
send_xml($fp, $STREAM_XML);
if (!find_xmpp($fp, 'STREAM:STREAM')) {
return false;
}
if (!find_xmpp($fp, 'STREAM:FEATURES')) {
return false;
}
send_xml($fp, $RESOURCE_XML);
if (!find_xmpp($fp, 'JID')) {
return false;
}
send_xml($fp, $SESSION_XML);
if (!find_xmpp($fp, 'SESSION')) {
return false;
}
// we made it!
send_xml($fp, $CLOSE_XML);
print "Authentication complete<br>";
fclose($fp);
return true;
}
示例10: validarPreenchimentoDosCampos
?>
<div class="container">
<fieldset class="col-md-8 col-md-offset-2">
<legend>Cadastro de matrículas</legend>
<form action="ModelCadMatricula.php" method="get" onsubmit="return validarPreenchimentoDosCampos();">
<div class="form-group">
<label>Aluno: *</label>
<input type="text" id="nome_aluno" name="nome_aluno" class="form-control inputUnico" placeholder="Campo auto-complete">
</div>
<div class="form-group">
<label>Curso: *</label>
<select id="curso" name="curso" class="form-control inputUnico">
<option value="0">----Selecione um curso----</option>
<?php
$conexao = open_connection();
$SQLBusCurso = $conexao->query("SELECT cod_curso,\n nome_curso,\n periodo\n FROM curso");
if ($SQLBusCurso) {
while ($RESBusCurso = $SQLBusCurso->fetch(PDO::FETCH_ASSOC)) {
$cod_curso = $RESBusCurso['cod_curso'];
$nome_curso = $RESBusCurso['nome_curso'];
$periodo = $RESBusCurso['periodo'];
if ($periodo == 1) {
$periodo = "Matutino";
}
if ($periodo == 2) {
$periodo = "Vespertino";
}
if ($periodo == 3) {
$periodo = "Integral";
}