Jump to content

[SOLVED] How do I pull out the highest value in MySQL?


Klance

Recommended Posts

Ok, I tried that and it came out with

 

"Resource id #2"

 

Heres the code I used:

 

<?php

$host = "localhost";
$user = "root";
$pass = "****";
$db = "GHScores";

$conn = mysql_connect($host, $user, $pass) or die("Unable to connect!") ;

mysql_select_db($db) or die("Unable to select database!");

$query = "SELECT MAX(score) FROM GH80";

$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());

echo $result
?>

<?php

$host = "localhost";
$user = "root";
$pass = "****";
$db = "GHScores";

$conn = mysql_connect($host, $user, $pass) or die("Unable to connect!") ;

mysql_select_db($db) or die("Unable to select database!");

$query = "SELECT MAX(score) FROM GH80";

$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());

echo mysql_result($result, 0);
?>

<?php

$host = "localhost";
$user = "root";
$pass = "****";
$db = "GHScores";

$conn = mysql_connect($host, $user, $pass) or die("Unable to connect!") ;

mysql_select_db($db) or die("Unable to select database!");

$query = "SELECT MAX(score) FROM GH80";

$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());

echo mysql_result($result, 0);
?>

 

Thank you

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.