不会在数据库上分配信息

时间:2012-02-12 14:08:18

标签: php database

我确实遇到了问题,而且它不仅仅是数据库的信息。

<?php
    include("include/database/database.php");

    //Infomation
    $email = mysql_real_escape_string($_POST["email"]);
    $password = mysql_real_escape_string($_POST["password"]);
    $gentag = mysql_real_escape_string($_POST["gentag"]);
    $facebook = mysql_real_escape_string($_POST["facebook"]);
    $land = mysql_real_escape_string($_POST["land"]);
    $profiltekst = mysql_real_escape_string($_POST["profiltekst"]);
    $djnavn = mysql_real_escape_string($_POST["djnavn"]);
    $site = mysql_real_escape_string($_POST["site"]);
    $fk_id = mysql_real_escape_string($_POST["kategori"]);
    $errorCount = 0;

    $billedefilnavn = null;

    include("include/class.upload.php");

    $handle = new Upload($_FILES['file']);

    if($handle->uploaded){

            //lidt mere store billeder
            $handle->image_resize = true;
            $handle->image_ratio_y = true;
            $handle->image_x = 220;
            $handle->Process("picthumb/storeimg");

            //til profil billede lign..
                $handle->image_resize = true;
                $handle->image_ratio_crop = true;
                $handle->image_y = 75;
                $handle->image_x = 75;
                $handle->Process("picthumb");

    $billedefilnavn = $handle->file_dst_name;

        echo "Dit billede blev upload<br>";

    }else {
        echo "Fejl; Du skal uploade en fil<br>";
    }

     if($email == "")
     {
        echo "Du skal indtaste et Email som brugernavn.<br>";
        $errorCount++;
     }
     if($password == "")
     {
        echo "Du skal indtaste et password.<br>";
        $errorCount++;
     }
     if($gentag == "" || $gentag != $password)
     {
        echo "De to passwordfelter skal have ens indhold.<br>";
        $errorCount++;
     }


    $password = sha1($password);
    $insert = mysql_query("INSERT INTO brugere (email,password,facebook,land,profiltekst,email,site,fk_musik_info,profilbillede) VALUES ('$email','$password','$facebook','$land','$profiltekst','$djnavn','$site','$fk_id','$billedefilnavn')") or die (mysql_errno());

        if(!$insert) {
            echo "Fejlede at gemme i databasen!";
            echo "<a href='index.php'>forside</a>";
        }
        else {
           echo "<a href='index.php'>forside</a>";
        }

    ?>


<form action="opretbruger_info.php" enctype="multipart/form-data"  method="post" onsubmit="return validatePasswords()">
            <div id="boxinfo">
                <!-- bruger infomation-->
                <p>Brugerinfomation</p>
                <input type="email" id="email" name="email" placeholder="Email til Brugernavn">
                <br>
                <input type="password" id="password" name="password" placeholder="Password">
                <br />
                <input type="password" id="gentag" name="gentag" placeholder="Gentag password">
            </div>
            <div id="boxinfo2">
                <!-- Dj infomation-->
                    <p>Dj infomation</p>
                    <input type="text" name="site" placeholder="Website Navn" id="formboxprofil">
                    <br>
                    <input type="text" name="facebook" placeholder="Facebook" id="formboxprofil">
                    <br>
                    <input type="text" name="djnavn" placeholder="Dj Navn" id="formboxprofil">
                    <br>
                    <input type="text" name="land" placeholder="Hvor kommer du fra" id="formboxprofil">
                    <br>
                            <?php
                                    $sql = 'SELECT * FROM musik_info';
                                    $res = mysql_query($sql) or die (mysql_error());
                                    $select = '<select name="kategori">';
                                    while ($row=mysql_fetch_assoc($res)) {
                                    $select .= '<option value="'.$row['musikid'].'">'.$row['navn_musik'].'</option>';
                                    }
                                    $select .= '</select>';
                                    print $select;
                            ?>
            </div>
         <!-- Profil Tekst-->
            <div id="boxinfo3">
                <p>Profil Tekst</p>
                <textarea name="profiltekst" id="profiltekst" style="width:410px; height:155px;"></textarea>
                <input type="file" name="file" id="uploadfile"><br>
                <input type="submit" value="Godkendt & Opret Bruger" id="godkendt_bruger">
            </div>
     </form> 

我的问题是什么,所以不打算上班?它没有出现一些错误或类似的东西,但这是我的数据库如下:

image http://jesperbok.dk/skoleopgave/db.png

1 个答案:

答案 0 :(得分:2)

您正在插入2个电子邮件值。 mysql只允许你为电子邮件设置一个值

  

$ insert = mysql_query(“INSERT INTO brugere
  (电子邮件下,密码,脸谱,土地,profiltekst,电子邮件下,网站,fk_musik_info,profilbillede)
  VALUES
  ( '$电子邮件', '$密码', '$ Facebook的', '$土地', '$ profiltekst', '$ djnavn', '$站点', '$ fk_id', '$ billedefilnavn')“)