Jump to content

DB Module


mentalist

Recommended Posts

I've written some sort of db module and wondering if it's the right way to go about it.

Basically once it's executed the query it then converts it into a standard php associative array.

function db_do_mysql_query($s)
{
list($iret, $res) = _db_do_mysql_query($s);
if($res == 1)
{
	return -1;
}

$llret = array();
if ($iret == 0)
{
	while ( $r = mysql_fetch_assoc($res) )
	{
		$llret[] = $r;
	}
	return $llret;
}
else
{
	return -1;
}
}

 

Sooner or later i'll want to incorporate other db's other than mysql, but having no experience of other db's I thought i'd return the data in a generic way, the php array. Is this bad?

 

Link to comment
https://forums.phpfreaks.com/topic/151300-db-module/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.