Zitat:
You have an error in your SQL syntax near '* FROM auctions where id='6662'' at line 1
|
Diese Meldung bekomme ich beim Ausführen folgender Datei
PHP-Code:
<?
require('./includes/messages.inc.php');
require('./includes/config.inc.php');
$query = "select * from auctions where id="$id"";
$result = mysql_query($query);
if ( !$result )
{
print $flr_001;
exit;
}
$user_id = mysql_result ( $result, 0, "user" );
$title = mysql_result ( $result, 0, "title" );
$description = mysql_result ( $result, 0, "description" );
$pict_url = mysql_result ( $result, 0, "pict_url" );
$pict_url2 = mysql_result ( $result, 0, "pict_url2" );
$pict_url3 = mysql_result ( $result, 0, "pict_url3" );
$category = mysql_result ( $result, 0, "category" );
$minimum_bid = mysql_result ( $result, 0, "minimum_bid" );
$auction_type = mysql_result ( $result, 0, "auction_type" );
$location = mysql_result ( $result, 0, "location" );
$location_zip = mysql_result ( $result, 0, "location_zip" );
$shipping = mysql_result ( $result, 0, "shipping" );
$payment = mysql_result ( $result, 0, "payment" );
$photo_uploaded = mysql_result ( $result, 0, "photo_uploaded" );
$international = mysql_result ( $result, 0, "international" );
$reserve_price = mysql_result ( $result, 0, "reserve_price" );
$quantity = mysql_result ( $result, 0, "quantity" );
$zustand = mysql_result ( $result, 0, "zustand" );
$art_nr = mysql_result ( $result, 0, "artnr" );
$buynow = mysql_result ( $result, 0, "buynow" );
$bild2 = mysql_result ( $result, 0, "pict_url2" );
$bild3 = mysql_result ( $result, 0, "pict_url3" );
$sqlquery = "DELETE * FROM auctions where id='$id'";
$delete = mysql_query($sqlquery) or die(mysql_error());
include "header.php";
?>
<link href="style_auction.css" rel="stylesheet" type="text/css">
<table width="50%" border="0" align="center" cellpadding="3" cellspacing="0" class="table_norm">
<tr>
<td class="text_title_bg">Artikel erfolgreich gelöscht</td>
</tr>
<tr>
<td class="text_normal">
<p align="center">Die von Ihnen gewählte Auktion wurde erfolgreich gelöscht.
</p>
<p align="center"> </p>
<p align="center"><a href="active_nobuy_auctions.php?session_id=<? print $sessionIDU."&user_id=".$user_id ?>" class="info_text">[
Zurück zur Liste ]</a></p>
</td>
</tr>
</table>
<?
include "footer.php";
?>
Leider weiss ich noch nicht genug vom Zusammenhang zwischen PHP und SQL. Daher habe ich auch keine Ahnung, nach welchem Fehler ich suchen muss.
Kann mir jemand vielleicht einen Rat geben?
EDIT:
Ich habe den Fehler selber gefunden. Und zwar muss die Delete-Abfrage folgendermaßen lauten:
$sqlquery = "DELETE FROM auctions WHERE id='$id'";
$delete = mysql_query($sqlquery) or die(mysql_error());
also nicht DELETE * FROM