Reply to Re: mysql_select_db doesn't work

Your name:

Reply:


Posted by Jerry Stuckle on 06/25/05 00:19

bettina@coaster.ch wrote:
> Hi Jim,
> In PHPMyAdmin I've just defined the following:
> In DB webauth:
> user: bett
> password: sapto
> In DB mysql Table DB: a new entry for DB coaster with user bett
> In DB mysql Table User: a new entry for user bett
>
> Now the code:
> ?php
> $db_server = "localhost";
>
> /* Datenbankname */
> $db_name = "coaster";
>
> /* Datenbankuser */
> $db_user = "bett";
>
> /* Datenbankpasswort */
> $db_passwort = "sapto";
>
> /* Erstellt Connect zu Datenbank her */
> $db = @MYSQL_PCONNECT($db_server,$db_user,$db_passwort)
> or die ("Konnte keine Verbindung zur Datenbank herstellen");
> $db_select = @MYSQL_SELECT_DB($db_name);
> if($db_select)
> echo "Datenbank wurde ausgewählt";
> ?>
>
> the DB is local, but I've sent the php document to my webserver. Is it
> correct? because I cannot see it local...
>
> and I received the following:
> Konnte keine Verbindung zur Datenbank herstellen
>
> What can I do????
>

Are you saying the database is on your local machine but you're php page
is on the server?

If so, that won't work. PHP runs on the server, and in your PHP code
"localhost" therefore refers to the server - not your local machine.

Create the database on the server and ensure you have the correct
permissions set.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original 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

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