本文整理汇总了PHP中conectaBD函数的典型用法代码示例。如果您正苦于以下问题:PHP conectaBD函数的具体用法?PHP conectaBD怎么用?PHP conectaBD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了conectaBD函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: grabarLog
function grabarLog($nombreicono)
{
global $datosconexion;
$conn = conectaBD($datosconexion);
$error = insertaRegistro($conn, $nombreicono);
if ($error != "") {
die("No se ha podido insertar en el log: " + $error);
}
$conn = null;
// La conexion se cierra sola cuando la variable conn muere
}
示例2: debugInfo
debugInfo($p_query, $_REQUEST['p_debug'] == 'S');
$result = mysql_query($p_query);
if (!$result) {
die("Invalid query: " . mysql_error());
return 0;
} else {
return $result;
}
}
function arraySelect($p_query)
{
$result = preparaQuery($p_query);
$retorno = array();
$cont = 0;
while ($row = @mysql_fetch_assoc($result)) {
$retorno[$cont] = $row;
$cont++;
}
return $retorno;
}
conectaBD();
if ($_REQUEST['p_acao'] == "LLD") {
$dados = arraySelect('show tables');
foreach ($dados as $linha) {
$json[count($json)]['{#NOME}'] = $linha['Tables_in_zabbix'];
}
echo json_encode(array('data' => $json));
}
if ($_REQUEST['p_acao'] == "count") {
echo valorCampo('select count(*) as id from ' . $_REQUEST['p_tabela'], 'id');
}
示例3: session_start
<?php
session_start();
require_once '../include/var_global.php';
require_once '../include/bdatos.php';
require_once '../include/fecha_hora.php';
require_once '../include/log.php';
require_once '../include/funciones.php';
require_once '../include/clasesLepra.php';
$connectionBD = conectaBD();
if ($_POST['cargaFoto']) {
$query = 'SELECT [idLesion],[idCatTipoLesion],[imgUrl] FROM [diagramaDermatologico] WHERE [idLesion]=' . $_POST['idLesion'];
$result = ejecutaQuery($query);
$imagenes = array();
while ($lesion = devuelveRowAssoc($result)) {
$imagenes = explode(";;;", $lesion['imgUrl']);
$imgUrlOld = $lesion['imgUrl'];
}
$numeroFoto = count($imagenes) + 1;
$new_name = "photo_" . $numeroFoto . "_" . $_POST['idLesion'];
$new_name2 = "nuevaFoto";
$ext = explode("/", $_FILES[$new_name2]['type']);
$extencion = $ext[1];
if ($_FILES[$new_name2]["size"] > 0) {
$dir = "../pacienteImg/";
$new_name .= "." . $extencion;
$lesionDiagrama = new DiagramaDermatologico();
move_uploaded_file($_FILES[$new_name2]['tmp_name'], $dir . $new_name);
$lesionDiagrama->idLesion = $_POST['idLesion'];
$lesionDiagrama->imgUrl = $imgUrlOld . $new_name . ";;;";
$lesionDiagrama->updateImgUrl();
示例4: catch
$app->response->setStatus(201);
} catch (PDOException $e) {
$app->response->setStatus(400);
echo '[{"error":"true" , "texto":' . $e->getMessage() . '}]';
}
});
$app->delete('/tareas/borrar/:idTarea', function ($idTarea) use($app) {
$sql = "DELETE FROM tareas WHERE id='" . $idTarea . "' ";
try {
$bd = conectaBD();
$stmt = $bd->query($sql);
$bd = null;
$app->response->setStatus(204);
} catch (PDOException $e) {
$app->response->setStatus(400);
echo '[{"error":"true" , "texto":' . $e->getMessage() . '}]';
}
});
$app->put('/tareas/editaRealizada/:idTarea', function ($idTarea) use($app) {
$sql = "UPDATE tareas SET realizada = !realizada WHERE id = " . $idTarea . " ";
try {
$bd = conectaBD();
$stmt = $bd->query($sql);
$bd = null;
$app->response->setStatus(204);
} catch (PDOException $e) {
$app->response->setStatus(400);
echo '[{"error":"true" , "texto":' . $e->getMessage() . '}]';
}
});
$app->run();