Reply
 
Thread Tools
Old 17-12-2002, 06:17 AM   #1   [permalink]
Torkm
Ex Moderator V.I.P.
 
Torkm's Avatar
 
Join Date: 25 Oct 2000
Location: South Australia
Posts: 1,880
Send a message via ICQ to Torkm Send a message via AIM to Torkm
Red face PHP Help

I am having a bit of rouble with some PHP code..

When I run a particular bit of code I made, this error:


Fatal error: Call to undefined function: db_connect() in /home/torkmc6/public_html/test/application.php on line 48


I thikn I coded it properly, but I guess I made a slight mistake.. :/

If the function to connect to a database is not db_connect(), then what is it?

BTW, here is the little snippet of code that I think is causing the problem:


/* connect to the database */
db_connect($CFG->dbhost, $CFG->dbname, $CFG->dbuser, $CFG->dbpass);
__________________
Torkm

Isn't Klonoa CUTE!
:smash:The Smashing Duo! - I'm not a doll and Torkm - Watch out or be Smashed!:smash:

Last edited by Torkm; 17-12-2002 at 06:20 AM.
Torkm is offline   Reply With Quote
Old 02-02-2003, 11:39 AM   #2   [permalink]
Barnacle
Junior Member
 
Barnacle's Avatar
 
Join Date: 18 Dec 2002
Location: Finland
Posts: 19
Send a message via MSN to Barnacle
lol... If you want to connect to mySQL database use this code:

PHP Code:
$db mysql_connect($dbhost,$dbuser,$dbpass) or die("Cound not connect to the MySQL database.");
mysql_select_db($dbname); 
$dbhost is often localhost
__________________
God that was a bad typo...

http://ecxol.no-ip.org

Last edited by Barnacle; 02-02-2003 at 11:40 AM.
Barnacle is offline   Reply With Quote
Old 20-06-2003, 07:58 AM   #3   [permalink]
Antioch-X
Forum Addicted
 
Antioch-X's Avatar
 
Join Date: 23 Oct 2001
Location: Double DEUUUUCE!
Posts: 1,370
Send a message via ICQ to Antioch-X Send a message via AIM to Antioch-X Send a message via MSN to Antioch-X
most connections have database-specific functionality, such as mysql_connect or pg_connect. I believe the function odbc_connect is a generally-encompasing database connection function.

You also have to keep in mind that you have to configure PHP explicitively with support for the database you plan to use in most cases. ex. --with-pgsql for PostgreSQL

I believe in Windows you can add the lines for the precompiled modules for PHP into the php.ini pretty easily without much fuss or explicitely include the support into a page with the dl() function.
__________________
殺してやる、殺してやる・・・ | koroshite yaru... koroshite yaru... koroshite yaru!
---- Blast the Wagner, death & destruction has arrived! ----
"Misato's cleavege is fan service. Shinji's man-goo is not." - Gundammi!

***Turn on JIS encoding to view my sig!***

Last edited by Antioch-X; 20-06-2003 at 08:00 AM.
Antioch-X is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


New To Site? Need Help?

All times are GMT -4. The time now is 06:03 AM.


Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2018, vBulletin Solutions, Inc.