Ankündigung

Einklappen
Keine Ankündigung bisher.

[Erledigt] You have an error in your SQL syntax...

Einklappen

Neue Werbung 2019

Einklappen
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • [Erledigt] You have an error in your SQL syntax...

    Guten morgen/ abend ^^
    Ich bin schon seit 1 stunde am suchen und ausprobieren und auch Google konnte mir nicht helfen! jetzt muss ich mal euch fragen!
    Ich habe da ein Problem mit eine Code

    der Code
    PHP-Code:
    <?php
    if (!function_exists("GetSQLValueString")) {
    function 
    GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
    {
      if (
    PHP_VERSION 6) {
        
    $theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }

      
    $theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

      switch (
    $theType) {
        case 
    "text":
          
    $theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
          break;    
        case 
    "long":
        case 
    "int":
          
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case 
    "double":
          
    $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case 
    "date":
          
    $theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
          break;
        case 
    "defined":
          
    $theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
          break;
      }
      return 
    $theValue;
    }
    }

    $colname_posteingang "-1";
    if (isset(
    $_SESSION['MM_Username'])) {
      
    $colname_posteingang $_SESSION['MM_Username'];
    }
    mysql_select_db($database_local$local);
    $query_posteingang sprintf("SELECT * FROM post WHERE empfaenger = %s AND read=1"GetSQLValueString($colname_posteingang"text"));
    $posteingang mysql_query($query_posteingang$local) or die(mysql_error());
    $row_posteingang mysql_fetch_assoc($posteingang);
    $totalRows_posteingang mysql_num_rows($posteingang);
    ?>
    wenn ich die seite (post.php) jetzt öffne dann bekomme ich folgende Fehlermeldung:
    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 'read=1' at line 1
    Kann mir da jemand helfen??
    lg
    oliking

  • #2
    Lass dir die Query zur Kontrolle ausgeben ...

    Kommentar


    • #3
      klingt zwar komisch und ich will auch net klugschei*en aber lass mal "PHP" weg also statt:
      <?PHP einfach mal <?
      komisch hat aber bei mir auch schon mal geklappt

      Kommentar


      • #4
        xerox das wäre zu einfach gewesen!^^

        jetzt kommt die nächste dumme frage! wie lasse ich mir die Query ausgen?

        Kommentar


        • #5
          Mit echo ...?

          Kommentar


          • #6
            read in Backticks setzen also `read`

            Kommentar


            • #7
              TBT danke das wars!

              Kommentar

              Lädt...
              X