Tristan Wells
11-10-2003, 01:51 AM
Hey. I just finished writing my database wrapper and I need comments on it.
Thanks.
http://php.neohaven.com/nbsource/mysql.phps
Thanks.
http://php.neohaven.com/nbsource/mysql.phps
|
Click to See Complete Forum and Search --> : MySQL database wrapper Tristan Wells 11-10-2003, 01:51 AM Hey. I just finished writing my database wrapper and I need comments on it. Thanks. http://php.neohaven.com/nbsource/mysql.phps drawmack 11-10-2003, 07:57 AM you don't comment your variables, you should so I know what they're for. you have a variable that's only for postgre but you don't allow for postgre to be used in the class in connect and select you don't error trap the actual command, what if it fails? Tristan Wells 11-10-2003, 09:17 AM Connect and select check if connections are possible and if they arent it exits. <?p if(!@mysql_pconnect($this->obj['host'],$this->obj['user'], $this->obj['pass'])) { $this->error(); exit; } ?> HalfaBee 11-10-2003, 09:46 AM You need a function to return all the rows as an array. Halfabee drawmack 11-10-2003, 06:57 PM Originally posted by Tristan Wells Connect and select check if connections are possible and if they arent it exits. what if in that microsecond between the execution of the if statment and the execution of the real statment something happens that makes the database no longer available? I know it's a long shot but it's a shot. Tristan Wells 11-10-2003, 07:03 PM Originally posted by HalfaBee You need a function to return all the rows as an array. Halfabee Line 87-92. //+---------------------------------+\\ //+Fetch arrays from the database //+---------------------------------+\\ function fetch($res) { return mysql_fetch_array($res) or die($this->error()); } HalfaBee 11-10-2003, 07:06 PM This only returns 1 row. I meant all the rows. Halfabee Tristan Wells 11-10-2003, 07:27 PM Originally posted by HalfaBee This only returns 1 row. I meant all the rows. Halfabee Oh I see what you mean. I thought about it back when Nuke-Board was in the plannin stages but decided it wasn't needed because im a while() whore. :p Shrike 11-17-2003, 01:04 PM I have a similar class written just for mysql, I have mysql_put() method mysql_get_hash() method mysql_get_hashlist() method mysql_get_tabledescription() method also I always echo mysql_error() in each method for debugging :) perrio 12-02-2003, 06:06 PM I'd like to know how you'll instantiate the obj object. If i had to guess I'd say like this. $newob = New obj("filename of class definition"); //then then refer to the functions associated with that class like $newob ->connect(); etc... ? But how do you get values into the newly declared object? Mind clarifying what a wrapper is? PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved. |