MySQL Query Abfrage in PHP

O

OliLang

Hallo zusammen,
Ich bin ein ziemlicher PHP-Anfänger und möchte gerne ein Script so umbasteln, das es wenn man eine Datei hochlädt automatisch einen Eintrag in einer Tabelle macht! Damit man nachschauen kann was neu hochgeladen wurde! Nur funktioniert das ganze nicht sauber, es kommt immer eine Fehlermeldung wo steht das ein Fehler bei Zeile 30 ist das ist die Zeile mit dem SQL-Befehl! Kann mir einer helfen?

Oli

<?
$updir = "/home/zachwhit/public_html/img"; //absolute path to where files are uploaded, no trailing slash
$sizelim = "yes"; //do you want size limitations yes or no
$size = "25000"; //if you want size limited how many bytes
$certtype = "no"; //do you want certain type of file, no recommended
$type = ""; //what type of file would you like
//error if no file is selected
if ($file_name == "") {
die("No file selected to upload");
}
//error if file exists
if (file_exists("$updir/$file_name")) {
die("The file you are trying to upload already exists");
}
//error if file is to big
if ($sizelim == "yes") {
if ($file_size > $size) {
die("The file you are trying to upload is too big.");
}
}
//error if file isn't certain type
if ($certtype == "yes") {
if ($type != $file_type) {
die("The file you are trying to upload is wrong type");
}
}
mysql_connect("db.olilang.f2s.com","olilang","password");
mysql_select_db("olilang");
mysql_query("insert into uploadnews values("test")");
@copy($file, "$updir/$file_name") or die("The file you are trying to upload couldn't be copied to the server");
?>
<html>
<head>
<title>File Uploaded</title>
</head>
<body>
<p>
<h2>File Uploaded</h2>
File Name: <? echo "$file_name"; ?><br>
File Size: <? echo "$file_size"; ?><br>
File Type: <? echo "$file_type"; ?>
</p>
</body>
</html>
 
Jo hab ich, so nen Anfänger bin ich nun auch wieder nicht! Auch die Spalten existieren!
 
jut mmhh komisch!


ersetz mysql_select_db("olilang"); mal durch

$datenbank = @MYSQL_SELECT_DB("olilang") or die ( "Datenbank nicht vorhanden");

und sag mir was dann passiert.....
 
Ok alles palleti ich habs rausgefunden anstelle von den "" bei den werten hab ich '' genommen jetzt funktioniert alles! Thx für deine Hilfe

Oli
 

Neue Beiträge

Zurück