ninnypants
03-17-2009, 04:16 AM
can I use define inside of a class to use for function input. Like this:
class DB{
define('ARRAY_A', 'associative');
define('ARRAY_N', 'numeric');
public function fetch($query, $type = ARRAY_N){
// do sql work here
}
}
$db = new DB('localhost', 'root', 'pass');
$db->fetch("select * from users", ARRAY_A);
or maybe like this
class DB{
public function fetch($query, $type = ARRAY_N){
define('ARRAY_A', 'associative');
define('ARRAY_N', 'numeric');
// do sql work here
}
}
$db = new DB('localhost', 'root', 'pass');
$db->fetch("select * from users", ARRAY_A);
class DB{
define('ARRAY_A', 'associative');
define('ARRAY_N', 'numeric');
public function fetch($query, $type = ARRAY_N){
// do sql work here
}
}
$db = new DB('localhost', 'root', 'pass');
$db->fetch("select * from users", ARRAY_A);
or maybe like this
class DB{
public function fetch($query, $type = ARRAY_N){
define('ARRAY_A', 'associative');
define('ARRAY_N', 'numeric');
// do sql work here
}
}
$db = new DB('localhost', 'root', 'pass');
$db->fetch("select * from users", ARRAY_A);