Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2006
    Messaggi
    280

    [mysql] Aggiornare un recordset..

    $insertSQL = sprintf("UPDATE tbl_food SET (start_time=%s,point=%s,working=%s) WHERE userID=%s",
    GetSQLValueString(1, "int"),
    GetSQLValueString(1, "int"),
    GetSQLValueString(1, "int"),
    GetSQLValueString(2, "int"));


    ciao a tutti.. cosa c'è di male nel codice sopra elencato?? l'errore che mi da è il seguente..


    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 '(start_time=1,point=1,working=1) WHERE userID=2' at line 1

    grazie

  2. #2
    Utente di HTML.it
    Registrato dal
    Aug 2006
    Messaggi
    1

    Re: [mysql] Aggiornare un recordset..

    Originariamente inviato da magicofred
    $insertSQL = sprintf("UPDATE tbl_food SET (start_time=%s,point=%s,working=%s) WHERE userID=%s",
    GetSQLValueString(1, "int"),
    GetSQLValueString(1, "int"),
    GetSQLValueString(1, "int"),
    GetSQLValueString(2, "int"));


    ciao a tutti.. cosa c'è di male nel codice sopra elencato?? l'errore che mi da è il seguente..


    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 '(start_time=1,point=1,working=1) WHERE userID=2' at line 1

    grazie
    Forse il doppio apice che circoscrive gli int? Prova con 'int' invece di "int" .... forse è quello

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2006
    Messaggi
    280

    Re: Re: [mysql] Aggiornare un recordset..

    Originariamente inviato da Stone71
    Forse il doppio apice che circoscrive gli int? Prova con 'int' invece di "int" .... forse è quello
    ho provato... stesso identico errore....

  4. #4
    Utente di HTML.it
    Registrato dal
    Jan 2006
    Messaggi
    280
    up please.. aiutatemi per favore!

  5. #5
    codice:
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
      $updateSQL = sprintf("UPDATE tbl_food  SET start_time=%s, point=%s, working=%s",
                           GetSQLValueString($_POST['start_time'], "int"),
                           GetSQLValueString($_POST['point'], "int"),
                           GetSQLValueString($_POST['working'], "int"));
    
      mysql_select_db($database_x, $tbl_food );
      $Result1 = mysql_query($updateSQL, $tbl_food ) or die(mysql_error());
    }
    
    $colname_Recordset1 = "-1";
    if (isset($_GET['recordMuserID])) {
      $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['recordMuserID'] : addslashes($_GET['recordMuserID']);
    }
    mysql_select_db($database_x, $tbl_food );
    $query_Recordset1 = sprintf("SELECT * FROM tbl_food  WHERE MuserID = '%s'", $colname_Recordset1);
    $Recordset1 = mysql_query($query_Recordset1, $MuserID) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    oppure

    codice:
     $updateSQL = sprintf("UPDATE tbl_food  SET tbl_food.start_time='$campo1' and tbl_food .point='$campo2' and tbl_food.working='$campo3' WHERE  tbl_food.userID = '$campo5' ");
        mysql_select_db($database_x, $tbl_food);
        $Result1 = mysql_query($updateSQL, $tbl_food) or die(mysql_error());

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.