PHP MySQL WHERE子句列名错误

MySQL Query:

$sSix = "SELECT count(*) as count FROM `timers` WHERE `real_id` = {$row['real_id']}";
$rSix = mysql_query($sSix, $conn2);
echo mysql_error(); die;

Result: Unknown column '985_1445542200' in 'where clause'

Column name is real_id but in result its showing column '985_1445542200'.

Could you please let me know the probable cause of error.

You will need quotes in your WHERE part. Like so:

$sSix = "SELECT count(*) as count FROM `timers` WHERE `real_id` = '{$row['real_id']}'";

Additionally, please consider using the newer mysqli_ functions or PDO, as the old mysql_ functions will stop working in the future.

$sSix = "SELECT count(*) as count FROM `timers` WHERE `real_id` = "'. $row['real_id'].'";
$rSix = mysql_query($sSix, $conn2);
echo mysql_error(); die;