idos Posted August 25, 2006 Share Posted August 25, 2006 I can't display the output from a query function.. [quote][code=php:0]<?phpinclude 'config.php'?><?phpif(isset($_COOKIE['ID_my_site'])){$username = $_COOKIE['ID_my_site'];}else{echo 'du er ikke logget inn';}$con = mysql_connect($host,$dbuser,$dbpass);if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("klatrereg", $con);$result = mysql_query( $sql = 'SELECT SUM(score) FROM ruter WHERE Navn= \'idar\' ORDER BY `Grad` DESC LIMIT 0,20 ');// here i need some code to display the SUM(score)mysql_close($con);?>[/code][/quote]I have tried several things but none seem to work.. .HELP :P Quote Link to comment Share on other sites More sharing options...
hostfreak Posted August 25, 2006 Share Posted August 25, 2006 Try:[code]<?phpinclude 'config.php'?><?phpif(isset($_COOKIE['ID_my_site'])){$username = $_COOKIE['ID_my_site'];}else{echo 'du er ikke logget inn';}$con = mysql_connect($host,$dbuser,$dbpass);if (!$con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("klatrereg", $con);$result = mysql_query( $sql = 'SELECT SUM(score) FROM ruter WHERE Navn= \'idar\' ORDER BY `Grad` DESC LIMIT 0,20 ');$score = mysql_fetch_row($result);echo "$score";mysql_close($con);?>[/code] Quote Link to comment Share on other sites More sharing options...
shocker-z Posted August 25, 2006 Share Posted August 25, 2006 [code]$result = mysql_query( $sql = 'SELECT SUM(score) as 'scoretotal' FROM ruter WHERE Navn= \'idar\' ORDER BY `Grad` DESC LIMIT 0,20 ');$row=mysql_fetch_array($result);echo $row['scoretotal'];[/code]Think that should do the trick Quote Link to comment Share on other sites More sharing options...
idos Posted August 25, 2006 Author Share Posted August 25, 2006 Tnx .. ;DThis worked:[code]$result = mysql_query( $sql = 'SELECT SUM(score) as scoretotal FROM ruter WHERE Navn= \'idar\' ORDER BY `Grad` DESC LIMIT 0,20 ');$row=mysql_fetch_array($result);echo $row['scoretotal'];[/code] 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.