Hellusius Posted September 2, 2006 Share Posted September 2, 2006 I am trying to sum two variables, but it gives me the following error[code]Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/www/warnicro.awardspace.com/stats.php on line 3[/code]The php code is [code]<? echo "<font color=\"#EFDFA0\">Statistics<br />;$count = file_get_contents("count.txt"); $count2 = file_get_contents("count2.txt"); echo "<font color=\"#EFDFA0\">Homepage views: ".trim($count); echo "<font color=\"#EFDFA0\">Total page view: ".trim($count) + ($count2);?> [/code]Anyone see what I am doing wrong? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 2, 2006 Share Posted September 2, 2006 You forgot to close your first echo statement:echo "<font color=\"#EFDFA0\">Statistics[nobbc]<br />[/nobbc][color=red][b]"[/b][/color]; Quote Link to comment Share on other sites More sharing options...
Hellusius Posted September 2, 2006 Author Share Posted September 2, 2006 thank you.with that solved I bumped into another problem which is I want them to sum up but instead the are placed behind one another so the answer is 15315 while it should be 168 Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 2, 2006 Share Posted September 2, 2006 Use this:[code=php:0]echo "<font color=\"#EFDFA0\">Statistics<br />";$count = file_get_contents("count.txt");$count2 = file_get_contents("count2.txt");echo "<font color=\"#EFDFA0\">Homepage views: " . trim($count) . "</font><br />";echo "<font color=\"#EFDFA0\">Total page view: " . (trim($count) + $count2);[/code] Quote Link to comment Share on other sites More sharing options...
Hellusius Posted September 2, 2006 Author Share Posted September 2, 2006 That works, Thank you very very much :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.