I am coding a module for bebot but I am annoyed by $this->bot->db->select only returning numeric indexes.
The fix I suggest is simple. The code as it stands now in MySQL.php (version 0.2.1) is:
function select ($sql)
{
$data = "";
$result = mysql_query($sql, $this->CONN);
if (!$result)
{
$this -> error($sql);
return false;
}
if (empty($result))
{
return false;
}
$count = 0;
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
$data[$count] = $row;
$count++;
}
mysql_free_result($result);
return $data;
}
The change that I suggest would look something like:
function select ($sql, $result_form=MYSQL_NUM)
{
$data = "";
$result = mysql_query($sql, $this->CONN);
if (!$result)
{
$this -> error($sql);
return false;
}
if (empty($result))
{
return false;
}
while ($row = mysql_fetch_array($result, $result_form))
{
$data[] = $row;
}
mysql_free_result($result);
return $data;
}
The default is set to MYSQL_NUM and the argument is optional as to not break modules already written.
Thank you for concidering this suggestion.
Edit: There was a way.
Terje Monsen
Blueeagl3 on RK1