You are here: Re: connecting to db.. « PHP Programming Language « IT news, forums, messages
Re: connecting to db..

Posted by Rik on 06/06/06 21:51

Frances wrote:
> this seems pretty straight-forward.. got this code
>
> $link = mysql_connect('localhost:3306', '<uid>', '<pswd>');

Do you need the port here? And I assume your username & password are
correct?
What happens if you:
$link = mysql_connect('localhost', 'your_username', 'your_password');

If you want to connect by TCP/IP use 127.0.0.1 instead of localhost.

> now on top of pg mentioned above, there this description:
>
> resource mysql_connect ( [string server [, string username [, string
> password [, bool new_link [, int client_flags]]]]] )
>
> what does 'resource' refer to here pls...

www.php.net > manual > types > resource:
http://www.php.net/manual/en/language.types.resource.php

A resource is a special variable, holding a reference to an external
resource.

> and where to do specify what
> db to connect to... (in java you put db-name in same line where you
> make the connection..)

mysql_select_db('db_name', $link);

> (and don't you need a driver to connect, I use a JDBC driver to
> connect w/Java..)

Mostly it's enabled by default in PHP4, PHP5 it's not, details:
http://www.php.net/manual/en/ref.mysql.php

Grtz

--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация