|
-
May 11th, 2003, 10:08 PM
#1
Thread Starter
Conquistador
Good database class?
Does anyone have a link to a good mysql database class or can point me in the right direction and make some suggestions
thanks
-
May 12th, 2003, 11:16 PM
#2
Stuck in the 80s
What is a MySQL database class?
-
May 13th, 2003, 12:20 AM
#3
Frenzied Member
it is a class that connects and queries and all that other stuff. I use the vbullitens free version's db class. does really well for what I need. but it shouldn't be hard to write your own or head over to www.hotscripts.com and find one there. or www.zend.com has pleny of code snippets of the sort.
-
May 13th, 2003, 11:07 AM
#4
Stuck in the 80s
I still don't understand. But okay.
-
May 13th, 2003, 01:42 PM
#5
Frenzied Member
that is because you are still thinking in that box, just kidding 
a db class that I think he is talking about is like this. you know what a class is right? well this class does all the connection stuff to the db. all you have to do in your script is connect to this class and do regular stuff.
so lets say I have a db class.
PHP Code:
class DB_BIG {
var $Host; // Hostname of our MySQL server.
var $Database; // Logical database name on that server.
var $User; // User and Password for login.
var $Password;
var $Link_ID = 0; // Result of mysql_connect().
var $Query_ID = 0; // Result of most recent mysql_query().
var $record = array(); // current mysql_fetch_array()-result.
var $Row; // current row number.
var $errno = 0; // error state of query...
var $errdesc = "";
var $appshortname = SITE_NAME;
var $reporterror = 1;
function connect() {
$this->Host = HOSTNAME;
$this->User = USER;
$this->Password = PASS;
$this->Database = DBNAME;
if ( 0 == $this->Link_ID ) {
$this->Link_ID=@mysql_connect($this->Host, $this->User, $this->Password);
if (!$this->Link_ID) {
$this->halt("Link-ID == false, connect failed");
}
if (!mysql_query(sprintf("use %s",$this->Database),$this->Link_ID)) {
$this->halt("Cannot connect to database ".$this->Database);
}
}
}
function query($Query_String) {
// do query
$this->Query_ID = @mysql_query($Query_String,$this->Link_ID);
if (!$this->Query_ID) {
$this->halt("Invalid SQL: ".$Query_String);
}
return $this->Query_ID;
}
that is a short version of vbullitens free version.
so in my script I use it like so,
$db_addCobrand = new DB_BIG; // start a instance of the class
$db_addCobrand->connect(); // connect to the db
$db_addCobrand->query("select * from table"); // run my query
that is a db class in a nut shell.
do you get it now? all it is is a class that handles all the connections to the db.
-
May 13th, 2003, 05:05 PM
#6
Stuck in the 80s
Originally posted by phpman
do you get it now? all it is is a class that handles all the connections to the db.
Ah, I see how that could be useful.
-
May 14th, 2003, 06:00 AM
#7
Thread Starter
Conquistador
hmm the vbulletin lite db class?
i was thinking of writing a forum, do either of you want in or will i attempt this voyage solo
-
May 14th, 2003, 07:49 AM
#8
Frenzied Member
why another forum? hobo started one not sure if he is still doing it, I can't alocate the time as another project is in my bag. in my opinion there are too many out there as it is. but good luck
-
May 14th, 2003, 04:04 PM
#9
Stuck in the 80s
I started developing my own forum, but lost interest in working on it.
-
May 15th, 2003, 05:30 AM
#10
Thread Starter
Conquistador
Originally posted by phpman
why another forum? hobo started one not sure if he is still doing it, I can't alocate the time as another project is in my bag. in my opinion there are too many out there as it is. but good luck
i want to make an awesome free forum that will rival vbb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|