Kann vieleicht jemand dieses Skript von den odbc zu mysql umschreiben?
class DB {
var $connectionID;
var $connectionOpen;
var $queries;
var $dsn;
var $dsn_login;
var $dsn_pw;
function DB($dsn, $dsn_login, $dsn_pw)
{
$this->dsn_login = $dsn_login;
$this->dsn = $dsn;
$this->dsn_pw = $dsn_wd;
$connectionID = 0;
$connectionOpen = false;
}
function Connect()
{
$this->connectionID = odbc_connect($this->dsn, $this->dsn_login, $this->dsn_pw);
if ($this->connectionID == 0)
error("Unable to connect to database.");
}
function Disconnect()
{
odbc_close_all();
}
function query($qName, $sql)
{
$this->queries[$qName] = odbc_exec($this->connectionID, $sql);
if ($this->queries[$qName] == 0) echo("Cannot execute query.");
}
function nextrow($qName)
{
return odbc_fetch_row($this->queries[$qName]);
}
function get($qName, $col)
{
return odbc_result($this->queries[$qName], $col);
}
function getInt($qName, $col)
{
return intval(odbc_result($this->queries[$qName], $col));
}
function getDouble($qName, $col)
{
return doubleval(odbc_result($this->queries[$qName], $col));
}
}
$db = new DB($dsn, $dsn_login, $dsn_pw);
$db->Connect();
?>
Die Paltzhalter dsn, dsn_login und dsn_pw könnt ihr einfach lassen die füll ich dann noch aus!
Danke im Voraus, mfg Spacekiller