I am trying this code which should perform +, _, x, / but i am getting raw output instead of sum, multiplaction, division, subtraction. here is my code.
if($randf=='1'){$fac='+';}
if($randf=='2'){$fac='-';}
if($randf=='3'){$fac='*';}
if($randf=='4'){$fac='/';}
$ran1=rand(1,100);
$ran2=rand(1,500);
$cans=$ran1.$fac.$ran2;
echo $cans;
but it outputs something like this
10+45
instead of 55. can u please tell where i am doing mistake.
In addition to that, I am trying to perform some filtering function in post. When users submit data in post I am trying to match with some value and then updating to database. Unfortunately, that also fails and always gives 0 as output.
if ($ans2==$ans1)
{
$marks==1;
}
else {
$marks=0;
}
mysql_query("INSERT INTO TABLEA () VALUES ()");