-
Notifications
You must be signed in to change notification settings - Fork 0
/
fung33ker.php
executable file
·33 lines (30 loc) · 1.05 KB
/
fung33ker.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
<?php
class Funciones {
//Funcion para conectarse a uno de los 2 servidores de MySQL
public function conectarse()
{
//SE ESTABLECE LA CONEXION CON EL SERVIDOR MYSQL, SE MANDA COMO PARAMETROS EL NOMBRE DEL SERVIDOR
// EL NOMBRE DE USUARIO Y LA CONTRASEÑA
try{
$conexion = mysqli_connect("us-cdbr-iron-east-02.cleardb.net","b884bc44b673ed","5e166b98", "heroku_b959f0e1de9d3a7");
}catch(mysqli_sql_exception $e) {
printf("alert('No se pudo conectar');");
}
//SELECCIONA UNA BASE DE DATOS Y REGRESA UN VALOR DE VERDADERO SI LOGRA USARLO
return $conexion;
}
//Para modificar y crear nuevos registros
public function ejecutar($sql,$conexion){
$n=0;
$resultado = mysqli_query($conexion, $sql);
$n= mysqli_affected_rows($conexion);
return $n;
}
//Hacer una busqueda y regresar un ROW
public function busqueda($sql,$conexion){
$resultado=mysqli_query($conexion, $sql);
$row =mysqli_fetch_array($resultado);
return $row;
}
}
?>