Código PHP:
<?php
class Db {
var $server='localhost';
var $user='insane';
var $psw='xxxxxx';
var $database='administrativo';
var $haystackQuerys=array();
var $connection;
var $id=0;
var $counter=0;
var $errorCounter;
function __construct(){
}
function connect(){
$this->connection= mysql_pconnect($this->server,$this->user,$this->psw);
$this->usedb($this->database);
}
function getConnection(){
static $connectionSingleton=null;
if(null===$connectionSingleton){
echo "<b>New</b><br>";
$connectionSingleton = new Db();
$connectionSingleton->connect();
return $connectionSingleton;
}else{
echo "<b>Singleton</b><br>";
return $connectionSingleton;
}
function execute($querye="",$retry=boolean){
$queryx = ($querye =="") ? array_shift($this->haystackQuerys) : $querye;
$result=mysql_query($queryx,$this->connection);
if($result)$this->counter++;else $this->errorCounter++;
return $result ? $result : mysql_error();
}
}
//......
//...
?>
Código PHP:
class MysqlResultsInterpretations extends Db {
function MysqlResultsInterpretations(){
parent::getConnection();
}
function toSomething($sql){
$this->execute($sql);
}
}
El problema
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\www\veryImportantProject\lib\database\Db.class. php on line 875 ''la de el methodo ejecutar en Db
porque ???
sugerencias ??
gracias.