I have this code for a system:
//get new data from text fields
$i = 0;
$data = array();
while ($i < 7){
$data[$i] = $_POST['t'.$i];
$i++;
}
//get the ID to use in the MySQL database query
$id=$data[0];
//get the existing integer from MySQL database
$query="SELECT * FROM tbl WHERE ID='$id';";
$result=mysql_query($query) or die(mysql_error());
$mem=mysql_result($result, 0, 'Member');
//print to see if it's equal
echo 'Does '.$mem.'='.$data[1].'?<br>';
//check equality
if ($mem != $data[1]){
echo "I'm not supposed to exist";
}
The $data[0] is the unique id for that database table and $data[1] is what we're trying to get.
The code prints $mem
as 999999.
Same with $data[0]
, 999999.
But for some reason, when I pass them through the if
statement, They are not equal.