Visualizzazione dei risultati da 1 a 3 su 3

Discussione: mi segna questo errore

  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2009
    Messaggi
    208

    mi segna questo errore

    questo è l'errore che mi segnala:

    Errore nella query: Column count doesn't match value count at row 1





    questo è il codice:


    <?php require_once('../Connections/connessione_registrazione.php'); ?>
    <?php
    mysql_select_db($database_connessione_registrazion e, $connessione_registrazione);
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $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;
    }
    }

    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
    $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    }

    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formregistrazione")) {
    $insertSQL = sprintf("INSERT INTO nome_tabella (nome, utente, password, regione) VALUES (%s, %s, %s, %s)",
    GetSQLValueString($_POST['nome'], "text"),
    GetSQLValueString($_POST['utente'], "text"),
    GetSQLValueString($_POST['password'], "text"),
    GetSQLValueString($_POST['regione'], "text"));

    mysql_select_db($database_connessione_registrazion e, $connessione_registrazione);
    $Result1 = mysql_query($insertSQL, $connessione_registrazione) or die(mysql_error());

    $insertGoTo = "../index.php";
    if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
    }
    header(sprintf("Location: %s", $insertGoTo));
    }






    //parte che ho inserito






    $nome=$_POST['nome'];
    $utente=$_POST['utente'];
    $password=$_POST['password'];


    $query = "SELECT * FROM nome_tabella WHERE utente = '$utente'";
    $ris = mysql_query($query) or die("Errore nella query: " . mysql_error());

    while($array = mysql_fetch_array($ris)){
    $conta="$array[nomel]";
    }

    if (empty($conta))
    $conta = 0;
    else
    $conta=count($conta); //controllo sulla variabile
    //se $conta è uguale a 0 vuol dire che il nome non è doppione
    if (empty($conta)) {
    //inserisco il record
    $query = "INSERT INTO `nome_tabella` VALUES ('$nome','$utente','$password','$regione')";
    $ris = mysql_query($query) or die("Errore nella query: " . mysql_error());
    echo("<META http-equiv='REFRESH' content='0; url=index.php'>");
    echo "<script>alert(\"Benvenuto $nome\");</script>";
    }
    else {
    echo "<script>alert(\"Il tuo nome utente risulta già registrato\");</script>";
    }




    //fine parte che ho inserito




    ?>



    che devo fare?

  2. #2
    Utente di HTML.it
    Registrato dal
    Jan 2009
    Messaggi
    208
    up

  3. #3
    non aprire discussioni identiche, non serve a niente.
    pazienta per le risposte, questo è un forum...non una chat.
    Administrator of NAMDesign.Net

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.