Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class DBConexion
- {
- public $link;
- public function __construct($host='', $user='', $pass='', $db='')
- {
- $this->link = mysql_connect($host, $user, $pass) or die (mysql_error());
- mysql_select_db($db, $this->link) or die (mysql_error());
- }
- public function query($strQuery)
- {
- $resource = mysql_query($strQuery, $this->link) or die (mysql_error());
- return $resource;
- }
- public function numRows($resource)
- {
- $nRows = mysql_num_rows($resource);
- if($nRows)
- return $nRows;
- else
- return 0;
- }
- public function fetchAssoc($resource)
- {
- $rows = mysql_fetch_assoc($resource);
- return $rows;
- }
- public function fetchRow($resource)
- {
- $rows = mysql_fetch_row($resource) or die (mysql_error());
- return $rows;
- }
- public function affectedRows($resource)
- {
- $nRows = mysql_affected_rows($resource) or die (mysql_error());
- return $nRows;
- }
- public function limpiarEntrada($string)
- {
- return mysql_real_escape_string($string);
- }
- public function close()
- {
- mysql_close($this->link);
- unset($this->link);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement