Zum Inhalt springen

Fehler im SQL Query....

Erstellt am 14. November 2003 · 4 Antworten · letzte Antwort am 14. November 2003

Tags: Frage

TheBaD665 ·

So das ist die ausgabe von meinem slq Query um eine neue news in tt_news einzufügen, sieht für mich eigentlich ganz gut aus... SQL sieht das jedoch anders:

You have an error in your SQL syntax near 'Title,
1068797726,
[BLOB],
,
0,
Test Teaser,
' at line 38

INSERT INTO tt_news
    (
      pid,
      tstamp,
      crdate,
      delted,
      hidden,
      starttime,
      endtime,
      fe_group,
      title,
      datetime,
      image,
      imagecaption,
      related,
      short,
      bodytext,
      autor,
      autor_email,
      category,
      links,
      type,
      page,
      keywords,
      archivedate,
      exturl
    )
    VALUES
    (
      43,
      1068797347,
      1068797347,
      0,
      1,
      0,
      0,
      0,
      Test Title,
      1068797347,
      [BLOB],
      ,
      0,
      Test Teaser,
      Test Text,
      Simon Link,
      sniper65@gmx.de,
      1,
      www.testurl.de,
      0,
      0,
      ,
      0,
      
    )

[/quote]

dj.​picasso ·

Hi,

INSERT INTO tt_news 
    (pid,tstamp,crdate,delted, //// DELETED sollte man mit 3 E schreiben!!
 hidden,starttime,endtime,fe_group,title,datetime,image,imagecaption,related, short, bodytext, autor, autor_email, category,links, type,  page,  keywords, archivedate, exturl) 
    VALUES (
      '43', 
      '1068797347', 
      '1068797347', 
      '0', 
      '1', 
      '0', 
      '0', 
      '0', 
      'Test Title', 
      '1068797347', 
      '[BLOB]',  /// WAS SOLL DATTDENNSEIN????
      '', 
      '0', 
      'Test Teaser', 
      'Test Text', 
      'Simon Link', 
      'sniper65@gmx.de', 
      '1', 
      'www.testurl.de', 
      '0', 
      '0', 
      '', 
      '0', 
      
    )

Über all die ' setzen!
Ciao
Der DJ

TheBaD665 ·

Das steht ja nicht im quelltext sondern ist ne ausgabe der var mit print $sqlquery...

Edit: k.a. was [BLOB] zu bedeuten hat stand so in einer übers BE eingetragenen news...

Edit: Der Quelltext ist:

    VALUES
    (
      43,
      ".time().",
      ".time().",
      0,
      1,
      0,
      0,
      0,
      ".$_POST['title'].",
      ".time().",
      [BLOB],
      ,
      0,
      ".$_POST['short_description'].",
      ".$_POST['body'].",
      ".$_POST['name'].",
      ".$_POST['mail'].",
      ".$_POST['topic'].",
      ".$_POST['rlinks'].",
      0,
      0,
      ,
      0,
      
    )";
TheBaD665 ·

ja doch jetzt hab ichs... hab alle text werte in '' gesetzt
das ergebnis ist:

    if($_POST)
    {
      $dbquery = "INSERT INTO tt_news
    (
      pid,
      tstamp,
      crdate,
      deleted,
      hidden,
      starttime,
      endtime,
      fe_group,
      title,
      datetime,
      image,
      imagecaption,
      related,
      short,
      bodytext,
      author,
      author_email,
      category,
      links,
      type,
      page,
      keywords,
      archivedate,
      ext_url
    )
    VALUES
    (
      43,
      ".time().",
      ".time().",
      0,
      1,
      0,
      0,
      0,
      '".$_POST['title']."',
      ".time().",
      '[BLOB]',
      '',
      0,
      '".$_POST['short_description']."',
      '".$_POST['body']."',
      '".$_POST['name']."',
      '".$_POST['mail']."',
      ".$_POST['topic'].",
      '".$_POST['rlinks']."',
      0,
      0,
      '',
      0,
      ''
    )";

      if(!mysql(TYPO3_db,$dbquery))
        echo $dbquery;
      echo mysql_error();

    }
dj.​picasso ·

Hi,

TheBaD665 schrieb

Das steht ja nicht im quelltext sondern ist ne ausgabe der var mit print $sqlquery...

... das war mir schon klar!

TheBaD665 schrieb

Edit: k.a. was [BLOB] zu bedeuten hat stand so in einer übers BE eingetragenen news...

... das war auch eher eine rhetorische Frage! Ich weiss schon was ein "Blob" ist (nicht zu verwechseln mit dem: "Oma, kennst Du schon den Blubb, Blubb?"), ist aber in diesem Context vollkommener Quatsch!

Schreib es doch mal so:

    VALUES
    (
      '43',
      '".time()."',
      '".time()."',
      '0',
...
      '".$_POST['title']."',
      '".time()."',
...
    )";

Ciao
Der DJ