RE: [PHP] [PHP MySQL] Introduction to using relational databases
From: Dirk Thilo Klein wrote: Dear readers, I am new to relational DB but not to MySQL PHP in general. I created a RDB using Struggling with the program's complexity I managed to create a set of databases being interconnected via (foreign) keys. What I want to know is how to use this database via php. How does my ER-Diagram come into play? In other words I want to know more about a general approach to using relational databases via php. well you export the db you designed into ansi sql and use the cmdline mysql client to create a db with it... this guide http://www.databasejournal.com/features/mysql/article.php/1469211/Using -a-MySQL-database-with-PHP.htm seems ok on the first look.. Is there a Postgres translation of this or other DB articles available? Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP MySQL] Introduction to using relational databases
Bob McConnell wrote: From: Dirk Thilo Klein wrote: Dear readers, I am new to relational DB but not to MySQL PHP in general. I created a RDB using Struggling with the program's complexity I managed to create a set of databases being interconnected via (foreign) keys. What I want to know is how to use this database via php. How does my ER-Diagram come into play? In other words I want to know more about a general approach to using relational databases via php. well you export the db you designed into ansi sql and use the cmdline mysql client to create a db with it... this guide http://www.databasejournal.com/features/mysql/article.php/1469211/Using -a-MySQL-database-with-PHP.htm seems ok on the first look.. Is there a Postgres translation of this or other DB articles available? Haven't read that article but I have a few intro's on my site: http://www.designmagick.com/category/4/PostgreSQL/Starting-Out -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [PHP MySQL] Introduction to using relational databases
Dear readers, I am new to relational DB but not to MySQL PHP in general. I created a RDB using Powerdesigner. Struggling with the program's complexity I managed to create a set of databases being interconnected via (foreign) keys. What I want to know is how to use this database via php. How does my ER-Diagram come into play? In other words I want to know more about a general approach to using relational databases via php. Regards from .de Thilo PS: If you speak german, answer in german. Appreciate it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP MySQL] Introduction to using relational databases
Thilo Klein wrote: Dear readers, I am new to relational DB but not to MySQL PHP in general. I created a RDB using Struggling with the program's complexity I managed to create a set of databases being interconnected via (foreign) keys. What I want to know is how to use this database via php. How does my ER-Diagram come into play? In other words I want to know more about a general approach to using relational databases via php. Regards from .de Thilo PS: If you speak german, answer in german. Appreciate it. well you export the db you designed into ansi sql and use the cmdline mysql client to create a db with it... this guide http://www.databasejournal.com/features/mysql/article.php/1469211/Using-a-MySQL-database-with-PHP.htm seems ok on the first look.. from php you access the db like this... ?php $username = pee_wee; $password = let_me_in; $hostname = localhost; $dbh = mysql_connect($hostname, $username, $password) or die(Unable to connect to mysql); print connected to mysqlbr; $selected = mysql_select_db(first_test,$dbh) or die(Could not select first_test); if (mysql_query(insert into people values('5','Hazel','Burger'))) { print successfully inserted record; } else { print Failed to insert record; } mysql_close($dbh); ? Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP MySQL] Introduction to using relational databases
On Tue, Mar 10, 2009 at 05:44:31AM +0100, Thilo Klein wrote: Dear readers, I am new to relational DB but not to MySQL PHP in general. I created a RDB using Powerdesigner. Struggling with the program's complexity I managed to create a set of databases being interconnected via (foreign) keys. What I want to know is how to use this database via php. How does my ER-Diagram come into play? In other words I want to know more about a general approach to using relational databases via php. Assuming you want to use straight PHP (as opposed to an object-relational mapping framework), you have several choices. You can use the native PHP mysql functions to access the tables. Or you can use PHP's PDO classes (or similar). Both are documented at php.net (and very well, I might add). Your ER diagram is a visual representation of various CREATE TABLE statements in SQL. Using straight PHP, you'll need to learn to use the SQL language to make queries and changes to the tables. It is relatively simple to learn, but essential unless you want to use some odd framework, as I mentioned before. SQL queries would look something like this: $result = mysql_query(SELECT name, address FROM people WHERE country = 'Germany', $connection_info); Then, you would do something like: $person = mysql_fetch_array($result) And $person would look like this: $person = array('name' = 'Helmut Schmidt', 'address' = '123 Anystrasse'); I want to stress that PHP is *not* a *visual* language. You have to sit down with an editor and write it. Very unlike programs which allow you to design tables using visual means. Hope that helps. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP MySQL] Introduction to using relational databases
Thilo Klein wrote: Dear readers, I am new to relational DB but not to MySQL PHP in general. I created a RDB using Powerdesigner. Struggling with the program's complexity I managed to create a set of databases being interconnected via (foreign) keys. What I want to know is how to use this database via php. How does my ER-Diagram come into play? In other words I want to know more about a general approach to using relational databases via php. Regards from .de Thilo PS: If you speak german, answer in german. Appreciate it. The ER-Diagram can be printed and rolled up to a nice weapon for smacking your co-workers with so they learn the layout faster... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php