Jump to content

Display Query issue.


idos

Recommended Posts

I can't display the output from a query function..

[quote][code=php:0]
<?php
include 'config.php'
?>
<?php

if(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
Share on other sites

Try:

[code]
<?php
include 'config.php'
?>
<?php

if(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
Share on other sites

Tnx ..  ;D

This 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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.