View Full Version : PHP Databases
Ramesiv
12-04-2005, 03:18 PM
About a PHP DatabaseOkay, I know how to store data in text files etc., but what about Databases? I'm not sure how to work with databases. Do you need to make the database, because I don't fully understand.Thanks for reading!
devinemke
12-04-2005, 03:56 PM
PHP has built in support for many popular databases:
mySQL (http://www.php.net/manual/en/ref.mysql.php)
PostgreSQL (http://www.php.net/manual/en/ref.pgsql.php)
SQLite (http://www.php.net/manual/en/ref.sqlite.php)
ODBC (http://www.php.net/manual/en/ref.uodbc.php)
Oracle (http://www.php.net/manual/en/ref.oci8.php)
MSSQL (http://www.php.net/manual/en/ref.mssql.php)
Ramesiv
12-04-2005, 04:05 PM
yes, i understand that, but how do I create a database to use in PHP?
Noodles24
12-04-2005, 04:33 PM
here's a tutorial for php/mysql
http://hotwired.lycos.com/webmonkey/99/21/index2a.html
Ramesiv
12-04-2005, 05:04 PM
Erm, ok kool, Since now tht ive installed mySQL and that, im trying to create a database, and i keep getting this error:
Fatal error: Call to undefined function: dba_open() in c:\phpdev5\www\databases\db1.php on line 4
With this code:
<?php
$dbh = dba_open( "/db/names", "c", "gdbm" ) or die( "Coundn't Open Database" ); #Line 4
dba_insert ( "Asif", $dbh);
dba_close( $dbh );
?>
Whats the problem?
ralph l mayo
12-04-2005, 07:45 PM
MySQL is not the correct type of database to use dba_* on, use the MySQL specific functions described here: http://us3.php.net/mysql
macmonkey
12-04-2005, 08:36 PM
PHP isn't in any way - shape - form a database program.. php is a language that just so happens to funnel data into and out of databases. [unless you count storing arrays etc..]
Diagram:
Users Browser <------> PHP <-------> Database
You'll set up say.. MySQL on your server and configure PHP to connect to this database. Then once connected you can either input or output data.
If you decide to go with MySQL I'd suggest a program called PHPMyAdmin to help you easily create databases etc...
The forums at zend.com (PHP) and mysql.com (MySQL) are very newbie friendly and have tons of documentation if you need it.
Noodles24
12-04-2005, 11:03 PM
Diagram:
Users Browser <------> PHP <-------> Database
Just to be pedantic, it's:
Users Browser <-> Web server <-> PHP <-> Database
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.