Good day all, I hope you are all doing well.
I have a table called platv3_temp that has two fields. The first is an id field of type int(11) that is set as the Primary Key and it auto-increments. The second field is called history and it is of type double(20,10).
I am able to put data into this table no problem using the following code:
$is_history = "
insert into $tb_temp (
id,
history
) values (
' ',
'$rideHistory'
)
";
$is_query_voterHistory = mysql_query($is_history) or die(mysql_error());
After a few clicks here and there on the website, the table might contain the following entries (I know this because I view it using phpMyAdmin on my CPANEL):
id history
1 89.1400000000
2 89.5600000000
3 89.7400000000
4 142.580000000
5 142.330000000
6 89.1400000000
The next thing I want to do is simply check to see if a particular number exists in the history field in this table, and if so, how many times does it appear. I first try it out on phpMyAdmin by executing the following command:
SELECT count(id) FROM platv3_temp WHERE history = 89.14
and it responds with:
count(id)
2
Which appears to be working perfectly so far.
So now I try executing the same command in the PHP code (for the same MySQL database on the same website) as follows:
$var1 = "SELECT count(id) FROM $tb_temp WHERE history = '89.14' ";
$result = mysql_query($var1) or die(mysql_error());
echo $result;
and the website responds with:
Resource id # 15
Do you know what's going on here? I've tried putting the decimal number in single quotes and without, same with the table name.
Could it be a decimal precision inconsistency between the webserver and my machine?
Any help is appreciated.