Home:ALL Converter>Strange mysql behaviour

Strange mysql behaviour

Ask Time:2017-05-14T04:46:50         Author:John Latez

Json Formatter

I am already programing for many year already now i faced a real strange issue I have query which verify for duplicate id and tid

$query4=mysql_query("select id,tid from transactionlog  where     id='$result1[id]' and tid ='$result1[tid ]'")  ;

$num=mysql_num_rows($query4);
if ($num == 0)
{
// case new . insert new raw here
}

The db i am using is fairly big over 500k raw , now the strange part is that this query sometime return num_rows 0 even when id and tid exist , this happen in about 1 time each few million queries , by the way i am using 5.6.35-log under windows (i need mysql old_password function that's why i am using older version ). I know it is possible to setup id and tx as primary and unique , but i really want to know how come num_rows returning 0 while it should have 1 . is it know bug that i am missing ?

anyone faced similar issue ???

Author:John Latez,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/43957840/strange-mysql-behaviour
yy