hi,
i tried to create sort of a db abstraction layer in order to be able to change of database (Mysql | oracle | pg |...).
i implemented that on a obejct oriented way.
i made a sql factory in PHP which simply instanciate classes whose methods wrap the php normal sql functions like mysql_query() mysql_num_rows( ) pg_query()...
one of these methods is num_rows()
i implemented it this way:
the problem is it will generate a mysql error:
mysql_num_rows( ): supplied argument is not a valid MySQL result resource in ...
so i thought it could be because i'm not passing the argument as a reference so i changed that to:
but it still returns that error.
how should that be done?
do you have any suggestions?
by the way how can i know if an insertion succeed, without the "or die(mysql_error )"?
please let me know
thank you!
best regards
bilibytes
i tried to create sort of a db abstraction layer in order to be able to change of database (Mysql | oracle | pg |...).
i implemented that on a obejct oriented way.
i made a sql factory in PHP which simply instanciate classes whose methods wrap the php normal sql functions like mysql_query() mysql_num_rows( ) pg_query()...
one of these methods is num_rows()
i implemented it this way:
Code:
public function num_rows($result)
{
return mysql_num_rows($result);
}
mysql_num_rows( ): supplied argument is not a valid MySQL result resource in ...
so i thought it could be because i'm not passing the argument as a reference so i changed that to:
Code:
public function num_rows(&$result)
{
return mysql_num_rows($result);
}
how should that be done?
do you have any suggestions?
by the way how can i know if an insertion succeed, without the "or die(mysql_error )"?
please let me know
thank you!
best regards
bilibytes
Comment