本文整理匯總了PHP中DataBase::get_connect方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataBase::get_connect方法的具體用法?PHP DataBase::get_connect怎麽用?PHP DataBase::get_connect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DataBase
的用法示例。
在下文中一共展示了DataBase::get_connect方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getBook
public function getBook($id)
{
require_once 'dbm.php';
$data = new DataBase();
$data->open();
$query = "SELECT * FROM `archivo` WHERE `id_archivo` = {$id}";
$result = mysqli_query($data->get_connect(), $query);
$row = mysqli_fetch_array($result);
$this->id = $row[0];
$this->user = $row[1];
$this->title = $row[2];
$this->path = $row[5];
$this->description = $row[3];
$this->punteo = $row[6];
$data->close();
}
示例2: getUserId
function getUserId($usuario, $contrasena)
{
if ($usuario == "" or $contrasena == "") {
return -1;
}
$datab = new DataBase();
$datab->open();
$connect = $datab->get_connect();
echo $query = "SELECT id_usuario, nombre, contrasena FROM usuario WHERE nombre = '" . $usuario . "' AND contrasena = '" . $contrasena . "';";
$result = mysqli_query($connect, $query);
while ($row = mysqli_fetch_array($result)) {
mysqli_close($connect);
return $row[0];
}
mysqli_close($connect);
return -1;
}
示例3: getComentarios
function getComentarios($id_archivo)
{
require_once 'dbm.php';
require_once 'user.php';
$data = new DataBase();
$data->open();
$comentarios = array();
$query = "SELECT comentario.id_usuario, comentario.texto FROM comentario WHERE comentario.id_archivo = {$id_archivo} ORDER BY comentario.id_comentario DESC";
$result = mysqli_query($data->get_connect(), $query);
while ($row = mysqli_fetch_array($result)) {
$elemento = new Comment();
$usuario = new User();
$usuario->getUser($row[0]);
$elemento->setComentario($usuario->getNombre(), $row[1]);
$comentarios[] = $elemento;
}
$data->close();
return $comentarios;
}
示例4: Delete
public function Delete()
{
require_once 'dbm.php';
$data = new DataBase();
$data->open();
$query = "DELETE FROM categoria WHERE id_categoria = {$this->id}";
$result = mysqli_query($data->get_connect(), $query);
$data->close();
if ($result) {
$this->id = null;
$this->nombre = null;
$this->descripcion = null;
return true;
} else {
return false;
}
}
示例5: DataBase
function list_of_files()
{
// Esta funcion devolvera un arreglo de objetos para los archivos
require_once 'dbm.php';
$data = new DataBase();
$userid = $this->userid;
$query = "SELECT * FROM archivo WHERE id_usuario = {$userid}";
$data->open();
$result = mysqli_query($data->get_connect(), $query);
$list_of_files = array();
while ($row = mysqli_fetch_array($result)) {
$elemento = new element_book($row[1], $row[2], $row[3], $row[4]);
$elemento->setId($row[0]);
$list_of_files[] = $elemento;
}
$data->close();
return $list_of_files;
}