I'm currently building a personal site of my own, and i'm having a bit of a problem as far as getting information from the database using adodb. Its kinda hard for me to explain so I'll print out the code.
Code: Select all
require_once('/adodb/adob.inc.php');
$db = ADONewConnection('mysql');
$db->Connect("host","username","pass","database");
$sql = "SELECT * FROM updates";
$rs = $db->Execute($sql) or die("SQL Error : ".$db->ErrorMsg());
while(!$rs->EOF){
echo $rs->fields('title')."<br/>".$rs->fields('body')."<br><br>";
$rs->MoveNext();
}Code: Select all
class data {
function data(){
$db = ADONewConnection('mysql');
$db->Connect("host","username","pass","database");
}
}
$nd = new data;
$sql = "SELECT * FROM updates";
$rs = $nd->Execute($sql);
while(!$rs->EOF){
echo $rs->fields('title')."<br/>".$rs->fields('body')."<br><br>";
$rs->MoveNext();
}any suggestions? I'm on PHP4.4xx so the '__construct()' function is kinda useless to me at the moment.Fatal error: Call to undefined function: fields() in /home/www/host_name/classes/class.connect.php on line 28