![]() |
SQL Update in PHP was stimmt nicht am Befehl?
Hallo,
ich verstehe nicht, warum dieser Code nicht funktioniert... Kann mir jemand helfen?
SQL-Code:
Gruß
UPDATE `InfoBox` SET `Prioritaet` = '0' WHERE `ID` = `$_SESSION['UID']`
Thomas |
Re: SQL Update in PHP was stimmt nicht am Befehl?
hallo thomas,
bist du sicher, das prioritaet vom typ ein varchar ist? raik |
Re: SQL Update in PHP was stimmt nicht am Befehl?
Priorität ist ein Varchar, aber die Session ist ein Integer!
Vielleicht liegt da das Problem... Wie kann ich die Session umwandeln? Gruß Thomas |
Re: SQL Update in PHP was stimmt nicht am Befehl?
leider habe ich von php keine ahnung,
sorry |
Re: SQL Update in PHP was stimmt nicht am Befehl?
Schade, vielleicht kann mir ja jemand anderes helfen ;)
|
Re: SQL Update in PHP was stimmt nicht am Befehl?
Zitat:
Code:
Das wird aber so nicht funktionieren mit Deinen Quote-Strings. PHP-Variablen werden grundsätzlich nur in Double-Quotes aufgelöst. So sollte es funktionieren:
mysql_query('UPDATE `InfoBox` SET `Prioritaet` = '0' WHERE `ID` = `$_SESSION['UID']`');
Code:
Gruß,
mysql_query("UPDATE \"InfoBox\" SET \"Prioritaet\" = \"0\" WHERE ID = $_SESSION['UID']");
Marcel |
Re: SQL Update in PHP was stimmt nicht am Befehl?
Danke erstmal!
Aber eine kleine Korrektur war bei deiner Idee noch notwenig ohne, dass es Fehler gibt:
Code:
Jetzt kommt zwar kein Fehler, aber es kommt nicht zu einem UPDATE.
$sql= ("UPDATE \"InfoBox\" SET \"Prioritaet\" = \"0\" WHERE ID = ".$_SESSION['UID']);
Gruß Thomas |
Re: SQL Update in PHP was stimmt nicht am Befehl?
Probier doch mal:
SQL-Code:
$sql = "UPDATE InfoBox SET Prioritaet = '0' WHERE ID = '".$_SESSION['UID']."'";
|
Re: SQL Update in PHP was stimmt nicht am Befehl?
Hallo Marcus,
nachdem Session ein Integer ist, kannst du die einzelnen Hochkommas getrost weglassen. Die anderen, schraegen Hochkommas macht eigentlich nur phpMyAdmin rein, ich selbst hab sie noch nie gebraucht, und bei mir funktioniert alles wunderbar ;) Greetz alcaeus |
Re: SQL Update in PHP was stimmt nicht am Befehl?
Hi,
probier mal folgendes:
Code:
cu
$query = "UPDATE `InfoBox` SET `Prioritaet` = '0' WHERE `ID` = '".$_SESSION['UID']."'";
if (!mysql_query($query)) { Die("Fehler: ".mysql_error()); } else { echo "Query erfolgreich ausgeführt (".$query.")"; } |
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:24 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz