Hej alle sammen, nu har jeg siddet og rodet med en masse scripts, i en del timer. Og jeg får fejl i mit script, men kan ikke finde den.
Fejlen er:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Her kommer min kode, den er måske lidt rodet, men ville være fedt, hvis i kunne hjælpe!
<?php
include("conn.php");
$id = $_GET["id"];
$query = "SELECT * FROM artikel_eng where id = $id";
$results = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($results);
$imgid = $row['img_id'];
if ($imgid == 1) {
$id = $_GET["id"];
$query = "SELECT * FROM artikel_eng where id = '$id'";
$results = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($results)) {
?>
<br>
<a href="retartikel.php?retid=1&id2=<?php echo $row['id']; ?>&billede=<? echo $row['billede']; ?>">
<img border="0" src="upload/<? echo $row['billede']; ?>" width="75" height="75"></a>
<br>
<?php
}
} elseif ($imgid == 2) {
$id = $_GET["id"];
$query = "SELECT * FROM artikel_eng where id = $id";
$results = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($results)) {
?>
<br>
<a href="retartikel.php?retid=2&id2=<?php echo $row['id']; ?>&billede=<? echo $row['billede']; ?>">
<img border="0" src="upload/<? echo $row['billede']; ?>" width="75" height="75"></a>
<br>
<?php
}
} elseif ($imgid == 3) {
$id = $_GET["id"];
$query = "SELECT * FROM artikel_eng where id = $id";
$results = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($results)) {
?>
<br>
<a href="retartikel.php?retid=3&id2=<?php echo $row['id']; ?>&billede=<? echo $row['billede']; ?>">
<img border="0" src="upload/<? echo $row['billede']; ?>" width="75" height="75"></a>
<br>
<?php
}
}
$retid = $_GET["retid"];
if ($retid == 1) {
$id_img = $_GET["id2"];
$img = $_GET["billede"];
$sql = "UPDATE `artikel_eng` SET `billede` = '$img' WHERE `id` = '$id_img' LIMIT 1";
mysql_query($sql) or die(mysql_error());
header("Location: tilfoj_artikel.php?id=eng18");
} elseif ($retid == 2) {
$id_img = $_GET["id2"];
$img = $_GET["billede"];
$sql = "UPDATE `artikel_eng` SET `billede` = '$img' WHERE `id` = '$id_img' LIMIT 1";
mysql_query($sql) or die(mysql_error());
header("Location: retartikel.php?retid2=1");
} elseif ($retid == 3) {
$id_img = $_GET["id2"];
$img = $_GET["billede"];
$sql = "UPDATE `artikel_eng` SET `billede` = '$img' WHERE `id` = '$id_img' LIMIT 1 ";
mysql_query($sql) or die(mysql_error());
header("Location: retartikel.php?retid2=2");
}
$retid2 = $_GET["retid"];
if ($retid2 == 1) {
$id = $_GET["id"];
$query = "SELECT * FROM artikel_eng where id = '$id'";
$results = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($results)) {
?>
<br>
<a href="retartikel.php?id3=1&id2=<?php echo $row['id']; ?>&billede=<? echo $row['billede']; ?>">
<img border="0" src="upload/<? echo $row['billede']; ?>" width="75" height="75"></a>
<br>
<?php
}
} elseif($retid2 == 2) {
$id = $_GET["id"];
$query = "SELECT * FROM artikel_eng where id = '$id'";
$results = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($results)) {
?>
<br>
<a href="retartikel.php?id3=2&id2=<?php echo $row['id']; ?>&billede=<? echo $row['billede']; ?>">
<img border="0" src="upload/<? echo $row['billede']; ?>" width="75" height="75"></a>
<br>
<?php
}
}
$id3 = $_GET["id3"];
if ($id3 == 1) {
$id_img = $_GET["id2"];
$img = $_GET["billede"];
$sql = "UPDATE `artikel_eng` SET `billede2` = '$img' WHERE `id` = '$id_img' LIMIT 1 ";
mysql_query($sql) or die(mysql_error());
header("Location: tilfoj_artikel.php?id=");
} elseif ($id3 == 2) {
$id_img = $_GET["id2"];
$img = $_GET["billede"];
$sql = "UPDATE `artikel_eng` SET `billede2` = '$img' WHERE `id` = '$id_img' LIMIT 1 ";
mysql_query($sql) or die(mysql_error());
header("Location: retartikel.php?retid3=1");
}
$retid3 = $_GET["retid3"];
if ($retid3 == 1) {
$id = $_GET["id"];
$query = "SELECT * FROM artikel_eng where id = '$id'";
$results = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($results)) {
?>
<br>
<a href="retartikel.php?id4=1&id2=<?php echo $row['id']; ?>&billede=<? echo $row['billede']; ?>">
<img border="0" src="upload/<? echo $row['billede']; ?>" width="75" height="75"></a>
<br>
<?php
}
}
$id4 = $_GET["id4"];
if ($id4 == 1) {
$id_img = $_GET["id2"];
$img = $_GET["billede"];
$sql = "UPDATE `artikel_eng` SET `billede3` = '$img' WHERE `id` = '$id_img' LIMIT 1 ";
mysql_query($sql) or die(mysql_error());
header("Location: tilfoj_artikel.php?id=eng18");
}
På forhånd tak, og go' jul til alle!
Marc Zacho
www.senia.dk - www.hcparty.dk