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 Link to comment https://forums.phpfreaks.com/topic/18659-display-query-issue/ 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] Link to comment https://forums.phpfreaks.com/topic/18659-display-query-issue/#findComment-80428 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 Link to comment https://forums.phpfreaks.com/topic/18659-display-query-issue/#findComment-80430 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] Link to comment https://forums.phpfreaks.com/topic/18659-display-query-issue/#findComment-80449 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.