From: "John Holmes" <[EMAIL PROTECTED]>
> That error means your query failed and the result set is not valid. You
> can't use LIKE on a TIME column.
> Can you explain exactly what you want? How are you storing the times,
> what are the times, what kind of data do you want to pull out of the
> table?
> I'll guarantee that there is one easy query to get exactly what you need
> if you use the correct column types.

well, the whole thing is like this:

I got a Cisco AS5300 for long distance calls which logs information to a
radius server
I made a script that parses the logs and throws the data to a mysql
database, which consists of only one table like the following:

  date VARCHAR(12) NOT NULL,
  connId CHAR(35) NOT NULL,
  connTime CHAR(8) NOT NULL,
  startTime CHAR(8) NOT NULL,
  stopTime CHAR(8) NOT NULL,
  retCode CHAR(2) NOT NULL,
  numberCalled VARCHAR(20) NOT NULL,
  carrierIP VARCHAR(15) NOT NULL,
  numberFrom VARCHAR(20) NOT NULL,
  PRIMARY KEY (connId)

then in my php page I got the following code:

$result = mysql_query("SELECT * FROM cdr WHERE date LIKE

while ($linea = mysql_fetch_array($result)) {
   $date        = $linea["date"];
   $connTime    = $linea["connTime"];
   $startTime   = $linea["startTime"];
   $stopTime    = $linea["stopTime"];
   $retCode     = $linea["retCode"];
   $numberCalled= $linea["numberCalled"];
   $carrierIP   = $linea["carrierIP"];
   $numberFrom  = $linea["numberFrom"];


where $month, $day and $year are got from a form in the previous page via
POST method.
So the LIKE condition matches against the "date" field in the table, where
the format is like "Jun 7 2002"

if I switch connTime, startTime and stopTime to TIME types, I get the error
I said

I'll try the things you've told me and the mysql_error() as Chris said

thanks again,


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to