Just taking a look at your class, before testing it, I have some points
1. Use of die:
Well usually this is not the action the programmer want, if the connection fails, I'd like to handle it in another way, not to crash my whole application, you can throw an exception instead, it's preferable that you extend your own exception for eas of use.
e.g. DBConnectionException extends Exception {}; DBSqlException extends Exception {};
you are using PHP5 !
2. Using MySQL Library:e.g. DBConnectionException extends Exception {}; DBSqlException extends Exception {};
you are using PHP5 !
Mysql 5 is up there for a lot of time, we use Stored Procedures, MySQL extention is not that good in handling Stored Procedure, as if you have a stored procedure containing a Select Statement to output data, you would have an error calling it, Although MySQLi is available for it, and you can make use of all the features that it comes with.
3. line 123 - Error:return mysq_insert_id(); // it should be return mysql_insert_id();
4. PHPDoc Tags Need to be fixed:e.g. @param $database => @param string $database // you should specify the data-type of the parameter
@return A mysql result set. => @return resource A mysql result set. // Same as above
some functions like db_1row returns a value but no @return is there.
5. testing with null using ==:@return A mysql result set. => @return resource A mysql result set. // Same as above
some functions like db_1row returns a value but no @return is there.
the first thing == doesn't check on type, so "" == null is true also 0 == null is true, so you can use the === operator, but when it comes to null, it's always better to use !isset instead.
6. More than a database connection:Well, if I'm connecting to more than one server in one page, your class fails in this area, I guess it's so obvious why
7. What Does it do exactly:
Well, taking a look at this class, the question I asked my self is what this class actually do, it does not give me an abstraction of MySql Database, it doesn't handle connections, it doesn't keep track of it, it only tracks on a result, so if that what is supposed to do you can make it a static class, or even a library with several functions that you might use.
I know I'm annoying here, but you are the one who asked :P
On 9/20/06, Al-Faisal El-Dajani <[EMAIL PROTECTED]
> wrote:
Hey all,
I just wrote this class for database connectivity. Can somebody plz help in testing? Any ideas or suggestions would be great.
Thanx
PS: Requires PHP 5
--
Al-Faisal El-Dajani
Tel: +962-7-77 799 781
P.O Box: 140056
11814 Amman, Jordan
--
Ala'a A. Ibrahim
http://www.alaa-ibrahim.info/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Jordan PHP Users Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/JoPHP
http://Jolug.org/
-~----------~----~----~----~------~----~------~--~---
