MySQL - PHP Explanation please
Posted: Wed Jul 30, 2003 8:50 am
Hi,
I was hoping that someone could explain how php works with the mysql server
I have gone through and read almost ALL of the PHP documentation and the MySQL documentation. I get most of the syntax but I dont grasp the concept behind it. When you connect to the mysql server via php you have the link command.
-> mysql_connect("localhost","user","password")
or die("Unable to connect to SQL server");
This just simply sets up the connection to the mysql server correct?
then comes where you connect to the database...
-> mysql_select_db("database") or die("Unable to select database");
does this connect you to one of the databases on the server? Or does it connect you to one of the tables? I dont get this. It looks to me like it is connecting to a database... But which one? Inside of the mysql server there are the databases "test" "mysql" and one that i created "iamdb".
I have also created another user besides the root user "guest" with a password.
when i try to connect to the "test" database everything works fine. When I try to connect to the "iamdb" database it does not work... Why? How do i fix that?
/me is confused /mysql noob
fyi My work forces me to use everything microsoft, but i am a inventory control programmer, i have lots of experiance with the microsoft sql server 2000, the jet engine and ado. (but i really would like to learn this mysql and php interaction (i hate vb!!))
-Thanks
I was hoping that someone could explain how php works with the mysql server
-> mysql_connect("localhost","user","password")
or die("Unable to connect to SQL server");
This just simply sets up the connection to the mysql server correct?
then comes where you connect to the database...
-> mysql_select_db("database") or die("Unable to select database");
does this connect you to one of the databases on the server? Or does it connect you to one of the tables? I dont get this. It looks to me like it is connecting to a database... But which one? Inside of the mysql server there are the databases "test" "mysql" and one that i created "iamdb".
I have also created another user besides the root user "guest" with a password.
when i try to connect to the "test" database everything works fine. When I try to connect to the "iamdb" database it does not work... Why? How do i fix that?
/me is confused /mysql noob
fyi My work forces me to use everything microsoft, but i am a inventory control programmer, i have lots of experiance with the microsoft sql server 2000, the jet engine and ado. (but i really would like to learn this mysql and php interaction (i hate vb!!))
-Thanks