Hi,
I may be doing something wrong here but for some reason, my database object does not seem to be returning an associative array when is should be. The code goes as follows:
class db_object
{
var $link;
//*************************************************************
function query($sql)
{
$this->link = mysql_query($sql,$GLOBALS["db_conn"]);
}
//*************************************************************
function nextrow()
{
return mysql_fetch_array($this->link);
}
}
$db = new db_object;
$sql="select * from table";
$db->query($sql);
$myrow = $db->nextrow();
After executing this code, $myrow[] is only indexed by number rather than with the field name.
What am I doing wrong?
Cheers
Rene Docherty
I may be doing something wrong here but for some reason, my database object does not seem to be returning an associative array when is should be. The code goes as follows:
class db_object
{
var $link;
//*************************************************************
function query($sql)
{
$this->link = mysql_query($sql,$GLOBALS["db_conn"]);
}
//*************************************************************
function nextrow()
{
return mysql_fetch_array($this->link);
}
}
$db = new db_object;
$sql="select * from table";
$db->query($sql);
$myrow = $db->nextrow();
After executing this code, $myrow[] is only indexed by number rather than with the field name.
What am I doing wrong?
Cheers
Rene Docherty