cancel
Showing results for 
Search instead for 
Did you mean: 

Problema accesso tabella customer_entity_varchar

Problema accesso tabella customer_entity_varchar

HO un semplice script che pernde un valore dalla form di registrazione e verifica se è già presente nel db:

if ($_POST != null) {
$partita_iva = $_POST['taxvat'];
$abspath = $_SERVER['DOCUMENT_ROOT'] . '/';
require_once $abspath . 'CANENERO/inc/pdo_statment.php';
$conn = PDO();
$query = "SELECT * FROM `customer_entity_varchar` WHERE `attribute_id` = 17 AND `value` LIKE '".$partita_iva."'";
$all_rows = countRow($query);
if( $all_rows > 0 ) {
header("location: http://test.fitoweb.com/partita-iva-gia-registrata");
$conn = null;
exit;
}
}

countRow restituisce il numero di righe in un pdo statement.
Il problema è che se passo il valore $partita_iva così com'è la query dà sempre zero righe.

Se eseguo la query senza il valore 'value' allora vengono fuori tutte le righe con 'attribute_id' 17. Credo possa esser collegato ad un problema di codifica.
Nel db il campo è varchar(255) utf8_general_ci.
Come posso aggiustare la query per farla funzionare?

Grazie.