conf.php
Código PHP:
ob_start();
$db_server = "localhost";
$db = "test";
$db_user = "root";
$db_passwd = "123";
db_mysql.class.php
Código PHP:
include("conf.php");
class consultaSql{
private $handle;
public $db_server;
private $result;
private $countRecords=0;
private $row_db;
function __construct(){
$this->handle = mysql_connect($db_server, $db_user, $db_passwd) or die(mysql_error());
mysql_select_db($db, $this->handle);
}
public function query($sql_string){
$this->result = mysql_query($sql_string, $this->handle);
}
public function show_query(){
$this->row_db = mysql_fetch_array($this->result);
return $this->row_db;
}
public function close(){
return mysql_close($this->handle);
}
}
index.php
Código PHP:
include_once("db_mysql.class.php");
$db = new consultasql();
$a = $db->query("SELECT * FROM usuarios");
while($row = $db->show_query()){
echo $row[2];
}
$db->close();
agradeceria muchisimo que me puedan ayudar.
gracias de antemano.
damian