Jump to content
Fórum Script Brasil
  • 0

(ajuda) ht exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens'


Question

Tudo bem!!!

Estou com esse erro “ht exception ‘PDOException’ with message ‘SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens’”
já conferir não acho nome diferentes para acusar esse erro…

codigo abaixo:

 

action_cliente.php

$sql = 'UPDATE tab_clientes2 SET codigoean:codigoean , descricao_completa:descricao_completa, products_count_admin:products_count_admin ';
$sql .= WHERE id = :id’;

		$stm = $conexao->prepare($sql);
		$stm->bindValue(':codigoean', $codigoean);
		$stm->bindValue(':descricao_completa', $descricao_completa);
		$stm->bindValue(':products_count_admin', $products_count_admin);
		$stm->bindValue(':id', $id);
        $retorno = $stm->execute();

		if ($retorno):
			echo "<div class='alert alert-success' role='alert'>Registro editado com sucesso, aguarde você está sendo redirecionado ...</div> ";
	    else:
	    	echo "<div class='alert alert-danger' role='alert'>Erro ao editar registro!</div> ";
		endif;

		echo "<meta http-equiv=refresh content='3;URL=index.php'>";
	endif;

Tabela

CREATE TABLE `tab_clientes2` (
  `id` int(11) NOT NULL,
  `codigoean` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `descricao_completa` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `products_count_admin` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
COMMIT;

 

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Descobri o erro

Errado :

$sql = 'UPDATE tab_clientes2 SET codigoean:codigoean , descricao_completa:descricao_completa, products_count_admin:products_count_admin ';

Correto:

$sql = 'UPDATE tab_clientes2 SET codigoean=:codigoean, descricao_completa=:descricao_completa, products_count_admin=:products_count_admin ';

Obrigadooo

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      148687
    • Total Posts
      644520
×
×
  • Create New...