|
From: AR <li...@tu...> - 2006-10-05 22:36:53
|
Hi,
I've written this classs to make SELECTS using AdoDB.
My question is how to retrieve the values from the SELECT statement ?
Obviously something is wrong.
The code follows my signature.
Any help would be appreciated.
Warm Regards,
AR
dbSelect.php:
----------------------------------------------------------------
<?php
// includes
include_once('config.inc.php');
include_once('adodb/adodb.inc.php');
class dBSelect
{
// global variables
var $table;
var $sql;
// constructor
function dBSelect()
{
return(TRUE);
}
// function that constructs the sql and inserts it into the database
function SelectDB($table, $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 selecting: '.$conn->ErrorMsg().'<BR>';
$conn->Close();
return (TRUE);
}
}
?>
----------------------------------------------------------------
testdb.php
----------------------------------------------------------------
<?php
include_once("classes/dBSelect.php");
$sql = "SELECT * FROM wl_users";
$dBSelect = new dBSelect();
$result = $dBSelect->SelectDB('wl_admins', $sql);
print($result->fields[0]);
print($result->fields[1]);
?>
----------------------------------------------------------------
|