login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Variabele in MySQL-Connect (Opgelost)

Offline tbsites - 23/09/2007 14:21
Avatar van tbsitesOnbekend Hallo ik heb dit:

  1. <?php
  2. $server = 'localhost';
  3. $gebruikersnaam = '...';
  4. $wachtwoord = '...';
  5. $database = '...';
  6.  
  7. mysql_connect("'$server'", "'$gebruikersnaam'", "'$wachtwoord'");
  8. mysql_select_db("'$database'");
  9.  
  10. ?>


Maar dan krijg ik de volgende foutmelding:

Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL Server Host ''localhost'' (1) in /home/vhosts/tbsites.nl/httpdocs/mysql/login/config.php on line 7

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'apache'@'localhost' (using password: NO) in /home/vhosts/tbsites.nl/httpdocs/mysql/login/config.php on line 8

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/vhosts/tbsites.nl/httpdocs/mysql/login/config.php on line 8

6 antwoorden

Gesponsorde links
Offline marten - 23/09/2007 14:23
Avatar van marten Beheerder
  1. <?php
  2. $server = 'localhost';
  3. $gebruikersnaam = '...';
  4. $wachtwoord = '...';
  5. $database = '...';
  6.  
  7. mysql_connect("'" .$server. "'", "'" .$gebruikersnaam. "'", "'" .$wachtwoord. "'");
  8. mysql_select_db("'$database'");
  9.  
  10. ?>
Offline tbsites - 23/09/2007 14:27
Avatar van tbsites Onbekend dan krijg ik:

Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL Server Host ''localhost'' (1) in /home/vhosts/tbsites.nl/httpdocs/mysql/login/config.php on line 7

Warning: mysql_select_db() [function.mysql-select-db]: Access denied for user 'apache'@'localhost' (using password: NO) in /home/vhosts/tbsites.nl/httpdocs/mysql/login/config.php on line 8

Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established in /home/vhosts/tbsites.nl/httpdocs/mysql/login/config.php on line 8
Offline TotempaaltJ - 23/09/2007 14:31
Avatar van TotempaaltJ PHP interesse [code=sql]
mysql_connect("'" .$server. "'", "'" .$gebruikersnaam. "'", "'" .$wachtwoord. "'");
mysql_select_db("'".$database."'");
?>
Moet ook bij db selecten he! 
Offline tbsites - 23/09/2007 14:34
Avatar van tbsites Onbekend Krijg nog steeds de error

Offline Simon - 23/09/2007 14:38
Avatar van Simon PHP expert
  1. mysql_connect($server,$gebruikersnaam,$wachtwoord);
  2. mysql_select_db($database);

waarom niet gewoon zo?
Offline tbsites - 23/09/2007 14:39
Avatar van tbsites Onbekend Ja dan doet hij het bedankt!
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.272s