<?php
class DBConexion{
var $conect;
function DBConexion(){
}
function getCon(){
return $this->conect;
}
function conectar() {
if(!($con=@mysql_connect("localhost","root","")))
{
echo"Error al conectar a la base de datos";
exit();
}
if (!@mysql_select_db("NOMBRE DE LA BD",$con)) {//EJEMPLO if (!@mysql_select_db("inventariobd",$con))
echo "Error al seleccionar la base de datos";
exit();
}
$this->conect=$con;
return true;
}
}
?>
4 Responses
Write a comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.