INSERT INTO problem
Hej, jeg er ved at lave en opret download, men når jeg skriver alt det der og vælger den fil. Så uploader den filen, men den sætter ikke tabellen ind i databasen altså den INSERT INTO som man kan se nederst. Nogen der kan hjælpe?<?
session_start();
$username = $_SESSION["username"];
include "bbcode.php";
include "config.php";
$query = mysql_query ("SELECT * FROM members where username='$username'") or die(mysql_error());
while ($row = mysql_fetch_array($query)) {
$brugernavn = $row["username"];
}
?>
<script type="text/javascript">
function addSmilie(text) {
text=''+text+'';
if ( document.getElementById('txt').createTextRange && document.getElementById('txt').caretPos) {
var caretPos=document.getElementById('txt').caretPos;
caretPos.text=caretPos.text.charAt(caretPos.text.length-1)==''?text+'':text;
document.getElementById('txt').focus();
} else {
document.getElementById('txt').value+=text;
document.getElementById('txt').focus();
}
}</script>
<form action="?side=oprettjek" method="post" enctype="multipart/form-data">Kategori: <br><select name="kategori" size="1">
<option value="php">Webprogrammering: PHP</option>
<option value="asp">Webprogrammering: ASP</option>
<option value="perl">Webprogrammering: Perl</option>
<option value="javascript">Webprogrammering: JavaScript</option>
<option value="html">Webprogrammering: HTML</option>
<option value="templates/css">Webprogrammering: Templates/CSS</option>
<option value="java">Programmering: JAVA</option>
<option value="c/c++">Programmering: C/C++</option>
<option value="delphi">Programmering: Delphi</option>
<option value=".net">Programmering: .NET</option>
<option value="visual_basic">Programmering: Visual Basic</option>
<option value="regular_expressions">Programmering: Regular Expressions</option>
<option value="flash">Software: Flash</option>
<option value="3d">Software: 3D</option>
<option value="photoshop">Software: Photoshop</option>
<option value="spil">Software: Spil</option>
<option value="paintshop">Software: Paintshop</option>
<option value="web-programmer">Software: Web-programmer</option>
</select><br>Navn:<br> <input type="text" name="navn"><br>Beskrivelse:<br><input type="button" value="Link" onclick="addSmilie('[link][/link]');"> -
<input type="button" value="Citat" onclick="addSmilie('
""');"> -
<input type="button" value="Center" onclick="addSmilie('
<input type="button" value="F" style="font-weight:bold;" onclick="addSmilie('');"> -
<input type="button" value="K" style="font-style:italic;" onclick="addSmilie('');"> -
<input type="button" value="U" style="text-decoration:underline;" onclick="addSmilie('');"><br><textarea name="beskrivelse" rows="9" cols="30" id="txt"></textarea><br>Fil: <br><input type="file" name="fil"><br><input type="submit" value="Indsend Download"><br><font color="#FF0000"><i>NB: Filen skal være pakket ind i RAR eller ZIP format!</i></font>
<?
if ($_GET["side"]=="oprettjek"){
$navn = mysql_real_escape_string( $_POST["navn"] );
$beskrivelse = mysql_real_escape_string( $_POST["beskrivelse"] );
$kategori = mysql_real_escape_string( $_POST["kategori"] );
$dato = date("m.d.y");
if ($_FILES['fil'])
{
$destination = "downloadfiler/" . $_FILES['fil']['name'];
$fil = $_FILES['fil']['name'];
$size = $_FILES['fil']['size'];
if (move_uploaded_file($_FILES['fil']['tmp_name'], $destination))
{
mysql_query("INSERT INTO script_download (id,navn,kategori,forfatter,dato,downloads,filen,godkendt,beskrivelse,size) VALUES ('','$navn','$kategori','$username','$dato','0','$fil','nej','$beskrivelse','$size')");
echo "Handlingen blev udført";
} else{
echo "Der er sket en fejl";
}
}
}
?>