RE: [PHP] more easy questions but getting there.
| From: | Kevin Stone | Date: | Wed, 23 Jan 2002 17:11:22 +0000 |
| Subject: | RE: [PHP] more easy questions but getting there. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-81722@lists.php.net to get a copy of this message | ||
The only thing different that I do is to pass the handle, that the
mysql_connect function returns upon success, as the second argument in
the mysql_select_db function.
$db = mysql_connect("$location", "$username", "$password");
mysql_select_db("$database",$db);
--
Kevin Stone
www.helpelf.com
> -----Original Message-----
> From: Matthew Darcy [mailto:matthew@darcy.demon.co.uk]
> Sent: Wednesday, January 23, 2002 9:47 AM
> To: PHP developers
> Subject: [PHP] more easy questions but getting there.
>
> Hello again.
>
> Second post of the day.
>
> I have got the table html page and the database commit php script
sorted
> no
> problem.
>
> I in my main php script I have included a script called dbconnect.php
>
> this contains
>
> mysql_connect("localhost", "$user", "$passwd") or
> die ("Error could not connect to MySql Server - connnection
not
> possible
> ");
> mysql_select_db("$database") or
> die ("Could not start session with database ");
>
>
> I have put the username and password in the $user and $passwd I just
> withheld them for the sake of this mail.
>
> When I run my main php script it creates the form without a problem,
but
> just before the form the lines
>
> mysql_connect("localhost", "$user", "$passwd") or die
> ("Error could
not
> connect to MySql Server - connnection not possible");
> mysql_select_db("$database") or die ("Could not start session with
> database
> ");
>
> I have tested the user $user and $password and it connects fine from
mysql
> and I can run selects without problem. Can someone give my php the
once
> over
> and see if there is an error in the connection string.
>
> Thanks,
>
> Matt.
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
php-list-admin@lists.php.net