PHP Forum

PHP Forum (http://www.selfphp.de/forum/index.php)
-   MySQLi/PDO/(MySQL) (http://www.selfphp.de/forum/forumdisplay.php?f=22)
-   -   Verbindung mit Datenbank herstellen (http://www.selfphp.de/forum/showthread.php?t=25764)

primetime 27.01.2016 21:12:07

Verbindung mit Datenbank herstellen
 
Hallo zusammen,

ich bin leider totaler Anfänger und schaffe es nicht mich korrekt mit einer Datenbank zu verbinden.
Meine bisherige Vorgehensweise:

1.Xampp installiert
2.Alle Dateien(php, html) + ___.sql in einen Ordner gepackt und unter htdocs abgelegt
3.Datenbank ___.sql bei phpmyadmin importiert

Nun kommt folgender Fehler:

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /Applications/XAMPP/xamppfiles/htdocs/www2/connection.php on line 8

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /Applications/XAMPP/xamppfiles/htdocs/www2/connection.php on line 9

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /Applications/XAMPP/xamppfiles/htdocs/www2/suche.php on line 158

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in /Applications/XAMPP/xamppfiles/htdocs/www2/suche.php on line 159


Hängt ja vermutlich mit der connection.php zusammen oder?
Die sieht folgendermaßen aus:

PHP-Code:

<?php
    $server
="localhost";
    
$username "";
    
$passwd="";
    
$mysqldb="tv";
    
$con=mysqli_connect($server$username$passwd$mysqldb);  -->Zeile 8
    mysqli_query
($con"SET NAMES 'utf8'");                                    -->Zeile 9
?>



Es wäre echt super, wenn mich jemand auf die richtige Spur bringen könnte.

Beste Grüße

Karl

primetime 28.01.2016 14:49:20

AW: Verbindung mit Datenbank herstellen
 
Es hat ein einfaches 'root' gefehlt. Danke für nichts. Kann gelöscht werden!


Alle Zeitangaben in WEZ +2. Es ist jetzt 20:39:11 Uhr.

Powered by vBulletin® Version 3.8.3 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.