I am trying to compare two dates in a column called " fecha_registro " , this column is varchar (100), I'm trying to compare him with this date code:
<?php
$host = "localhost";
$user = "root";
$pass = "";
$db = "gimnasio";
mysql_connect($host, $user, $pass);
mysql_select_db($db);
$from = "2010-02-06";
$to = "2015-11-08";
$consulta = mysql_query("SELECT id_cliente FROM clientes WHERE fecha_registro BETWEEN '$from' AND '$to'");
$cantidad = mysql_num_rows($consulta);
echo $cantidad;
?>
the problem is that you never find any record when multiple records that meet that pattern
The structure of the "clients" table is this :
And the records like this:
please , as I fix this ?