On 12 Apr 2001, at 16:03, josh kneedler wrote:

> i'm trying to connect to mysql using php so that i can do web based 
> queries of my tables. i'm new at this so here are some questions:
> 1. is localhost just the ip of my server or is it also the path to 
> where mysql is on my server?

Just the hostname or IP. MySQL runs wth port 3306 by default so
when you do  @mysql_connect("localhost", "root", "mypasswd");
you will be automagically connected to the MySQL server. You then
need to determine which database to use, eg:

mysql_select_db($DBNAME, $db);

$DBNAME is the database, $db the connection you opened.

> 2. if root is the login name should it be my login or just stay as root?

Which login do you mean? The *NIX login or your MySQL user name?
You should set up a user in MySQL user table with the appropriate
privileges and log in as that user.

> 3. is mypasswd the same password i enter when i'm in the mysql 
> evironment in reference to (mysql -u root -p)?
> 

Yes, see 2 above also.

David
> once i can declare the dbcnx variable i'll be able to do queries with php.
> josh
> 
>   // Connect to the database server
>    $dbcnx = @mysql_connect("localhost",
>             "root", "mypasswd");
>    if (!$dbcnx) {
>      echo( "<P>Unable to connect to the " .
>            "database server at this time.</P>" );
>      exit();
>    }
> 
> -- 
> dreaming america : visual media studio
> 503.222.2242 : http://dreamingamerica.com
> ::::...:::. http://rangermag.com :....::...:::::::.....:.v.1.i.2...::::::
> 



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to