Are there any preliminaries before accessing My SQL from PHP?

Are there any preliminaries before accessing My SQL from PHP?

am 25.02.2006 00:38:41 von frange5tan

I've got PHP running on IIS in XP Pro on a local machine at Port 8080
and the MySQL server on the same machine at Port 3306. My SQL server
has a Server host name of localhost and a user name of root. I don't
use a password. Does anyone know whether it will, or should, be
possible for me to make a call from PHP to my MySQL Server to access
tables, make querys etc. Any hints on where to find good code for these
sorts of operations would be welcome. For example, $ dbhost = local
host (presumeably), and $ dbuser = root. Presumeably I don't use $
dbpassword. Then I use the mysql connect command to call up a $ dbname
(an existing, named MySQL db) etc. I just wondered if I could get any
guidance with this in case I am missing something. Thanks.

Re: Are there any preliminaries before accessing My SQL from PHP?

am 25.02.2006 00:51:30 von Shion

napoleon wrote:
> I've got PHP running on IIS in XP Pro on a local machine at Port 8080
> and the MySQL server on the same machine at Port 3306. My SQL server
> has a Server host name of localhost and a user name of root. I don't
> use a password. Does anyone know whether it will, or should, be
> possible for me to make a call from PHP to my MySQL Server to access
> tables, make querys etc. Any hints on where to find good code for these
> sorts of operations would be welcome. For example, $ dbhost = local
> host (presumeably), and $ dbuser = root. Presumeably I don't use $
> dbpassword. Then I use the mysql connect command to call up a $ dbname
> (an existing, named MySQL db) etc. I just wondered if I could get any
> guidance with this in case I am missing something. Thanks.
>

http://www.php.net/manual/en/function.mysql-connect.php

Just set the password to '' (empty string), but I would really set a password
for the root user and then use it.

//Aho

Re: Are there any preliminaries before accessing My SQL from PHP?

am 25.02.2006 01:34:56 von frange5tan

Thanks. That was easy. Connected successfully, and then used $_dblist
to list the dbs. Isn't the manual great!

Re: Are there any preliminaries before accessing My SQL from PHP?

am 25.02.2006 01:36:56 von Shion

napoleon wrote:
> Thanks. That was easy. Connected successfully, and then used $_dblist
> to list the dbs. Isn't the manual great!

Yes, it's the best I know of, specially with the user comments, sometimes
there are really good examples. I wish that more people would know about it,
like an auto generated link to the manual when there is an error message from
php :P

Re: Are there any preliminaries before accessing My SQL from PHP?

am 25.02.2006 01:43:13 von Andy Hassall

On 24 Feb 2006 15:38:41 -0800, "napoleon" wrote:

>I've got PHP running on IIS in XP Pro on a local machine at Port 8080
>and the MySQL server on the same machine at Port 3306. My SQL server
>has a Server host name of localhost and a user name of root. I don't
>use a password. Does anyone know whether it will, or should, be
>possible for me to make a call from PHP to my MySQL Server to access
>tables, make querys etc. Any hints on where to find good code for these
>sorts of operations would be welcome.

The manual has examples, and also instructions on what you need to configure
for Windows.

http://uk.php.net/mysql

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

Re: Are there any preliminaries before accessing My SQL from PHP?

am 25.02.2006 02:18:54 von frange5tan

Thanks Andy. Everything seems to be working ok. It's getting late. I'll
have to study the manual when there's time.