-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconexion.php
60 lines (44 loc) · 1.13 KB
/
conexion.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
$dbhost = "localhost";
$db = "hiadesco_vectorForms";
$dbuser = "hiadesco_vector";
$dbpass = "vector123it";
$crlf = "\n";
function ejecutarCMD($strSQL) {
global $dbhost, $dbuser, $dbpass, $db, $crlf;
$conn = new mysqli($dbhost, $dbuser, $dbpass, $db);
$conn->set_charset("utf8");
$strError = "";
if (!$conn->query($strSQL))
$strError = $conn->error;
$conn->close();
if ($strError == "")
return true;
else
return $strError;
}
function buscarDato($strSQL) {
global $dbhost, $dbuser, $dbpass, $db, $crlf;
$conn = new mysqli($dbhost, $dbuser, $dbpass, $db);
$conn->set_charset("utf8");
$strSalida = "";
if (!($tabla = $conn->query($strSQL))) {
$strSalida = "Error al realizar la consulta.";
}
else {
$fila = $tabla->fetch_array();
$strSalida = $fila[0];
$tabla->free();
}
$conn->close();
return $strSalida;
}
function cargarTabla($strSQL) {
global $dbhost, $dbuser, $dbpass, $db, $crlf;
$conn = new mysqli($dbhost, $dbuser, $dbpass, $db);
$conn->set_charset("utf8");
$tabla = $conn->query($strSQL);
$conn->close();
return $tabla;
}
?>