Hi Richard, Richard Lynch wrote: > I'm baffled why you'd be rolling your own instead of using an existing > abstraction layer, and even more baffled why you wouldn't just skip > all this and just do: I'm already using AdoDB, which is excelent, but somethings requires a lot of code. I'm trying to wrote classe that allow me to reduce the code. Richard: it's also a matter of learning something i don't know yet. I consider myself as an expert in qmail servers. If you go to the qmail mailing list, you'll see lots of responses from me to other people. That's what i'm seeking here: help. Not that someone do the my job for me. Best Regards, Deckard > > $query = "insert ..."; > $insert = mysql_query($query, $connection); > > It's not like you can take your MySQL user-creating queries and > directly map them to ANY other database on the planet... > > So what does the DB abstraction and class OOP stuff gain you? > > Nada. > > On Thu, October 5, 2006 2:18 pm, Deckard wrote: >> Hi, >> >> I've burned my brain, checked other sites and come to a code that >> works. >> >> I ask you, please, to see if this makes any sense and/or can be >> improved. >> >> I'd really appreciate. >> >> Warm Regads, >> Deckard >> >> dbInsert.php: >> ------------------------------------------------------------------- >> <?php >> >> /* >> * class to make inserts >> * >> */ >> >> >> // includes >> include_once('/var/www/html/config.inc.php'); >> include_once('adodb/adodb.inc.php'); >> >> class dBInsert >> { >> // global variables >> var $table; >> var $sql; >> >> // constructor >> function dBInsert($table, $sql) >> { >> $this->table = $table; >> $this->sql = $sql; >> >> return(TRUE); >> } >> >> >> // function that constructs the sql and inserts it into the database >> function InsertDB($table, $sql) >> { >> >> print($sql); >> // connect to MySQL >> $conn = &ADONewConnection('mysql'); >> $conn->debug=1; >> $conn->PConnect('localhost', 'gamito', 'ble', 'wordlife'); >> >> // execute the insert >> if ($conn->Execute($sql) === false) >> print 'error inserting: '.$conn->ErrorMsg().'<BR>'; >> >> return (TRUE); >> >> } >> >> } >> >> ?> >> ------------------------------------------------------ >> >> testedb.php >> ------------------------------------------------------ >> <?php >> >> include_once("classes/dBInsert.php"); >> >> $sql = "INSERT INTO wl_admins VALUES ('',3)"; >> $dBInsert = new dBInsert('wl_admins', $sql); >> $dBInsert->InsertDB('wl_admins', $sql); >> >> ?> >> ------------------------------------------------------ >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php