• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

Probleme beim Einrichten / Keine Verbindung

aJunkie

Mitglied
Hallo,

ich richte zum ersten Mal eine Datenbank ein.

Ich bekomme entweder keine Verbindung zur der Datenbank oder es kommt dieser PHP Fehler wie jetzt im Moment.

Meine Config sieht so aus:
PHP:
<?php
///////////////////////
//
//    CONFIG --
//
/*///*/    $host = "localhost";  // MySQL Datenbank Host
/*///*/ $user = "web****";  // MySQL User
/*///*/ $pass = "blabla";  // MySQL User password
/*///*/ $dbdb = "usr_****_2";  // MySQL Datenbank
//
///////////////////////

$con = @mysql_connect($host,$user,$pass)or die("Die Verbindung zur MySQL Datenbank konnte nicht stattfinden!");
mysql_select_db($dbdb,$con)or die("Verbindung mit der Datenbank fehlgeschlagen!");
?>
Und das ist die index:
PHP:
<h1 align="center">Musik</h1>
<?php

include("cfg.php");

$ordner = "mp3s";
$handle = opendir($ordner);
if(!isset($_GET['file'])){
?>


<table style="border:1px dotted #000000;" align="center" width="500">
    <tr>
        <th>Titel</th><th>Release</th><th></th>
    </tr>
<?php

while(($file = readdir($handle)) !== FALSE){
    
    if($file != '.' && $file !='..'){
        $sql = mysql_query("SELECT * FROM `mp3` WHERE `titel`='".$file."'");
        if(mysql_num_rows($sql)<1){
                
            $entry = mysql_query("INSERT INTO `mp3` ( `id` , `titel` , `datum` , `clicks`, `zeit`)VALUES (NULL , '".$file."', '".date ("d-m-Y", filemtime($ordner."/".$file))."' , '0', '".date("H:i", filemtime($ordner."/".$file))."')") or die("err");
            
        }
    }
}



$sql2 = mysql_query("SELECT * FROM `mp3` ORDER BY `datum` DESC ,`zeit` DESC");
while($row = mysql_fetch_assoc($sql2) ){
    $an = 0;
            if(!file_exists("mp3s/".$row['titel'])){
            
            $del = mysql_query("DELETE FROM mp3 WHERE `titel`='".$row['titel']."'");
            $an = 1;
            }
            
    if($an!=1){
        ?>
     <tr align="center">
         <td><a href="index.php?file=<?php echo $row['titel']; ?>"><?php echo substr($row['titel'],0,strlen($row['titel'])-4); ?></a></td><td><?php echo $row['zeit']; ?> <?php echo $row['datum']; ?></td><td><?php echo $row['cmnt']; ?></td>
     </tr>
     <?php
    }
    
}

?>
</table>

<?php


} else {
        $sql = mysql_query("SELECT * FROM `mp3` WHERE `titel`='".$_GET['file']."'");
    $row = mysql_fetch_assoc($sql);
?>
<script type="text/javascript">
function openURL (url) {
 fenster = window.open(url, "Musik", "width=500,height=300,status=yes,scrollbars=yes,resizable=no");
 fenster.focus();
}
</script>
<a href="index.php">Zur&uuml;ck</a>
<div style="border:1px dotted #000000;">~Werbung 1~</div>
<div style="margin-top:150px; text-decoration:none;">Download: <a href="javascript:void" style="text-decoration:none" onclick="openURL('load.php?file=<?php echo $_GET['file']; ?>');"> <?php echo substr($_GET['file'],0,strlen($_GET['file'])-4); ?></a><br />Kommentare: <?php echo $row['cmnt']; ?></div>

<?php
}
?>
Was mache ich als völliger Neuling falsch?

Problem gelöst!
 
Zuletzt bearbeitet:
Werbung:
Zurück
Oben