[color="#FF0000"][size="5"][SQL] How to show bounties on your website..[/size][/color]
[size="3"]SQL for your Bounty Hunter script.[/size]
Supported Cores: All Cores.
Code:
$query = "SELECT bounties.guid, bounties.visual, bounties.price, characters.name
FROM bounties
LEFT JOIN characters
ON bounties.guid=characters.guid
ORDER BY bounties.guid";
+rep if this query was useful for your website. Thanks.
[color="#FF0000"]__EDITED:[/color]
----------------------------------------------------
Here is the simple PHP script:
----------------------------------------------------
**This script must be customized and changed for good functionality (just a basic php script):
Code:
session_start();
error_reporting(0);
include_once("../config.php");
All bounties from your website name here
$connect = mysql_connect($host,$user,$pass);
mysql_select_db($characters,$connect);
$query = "SELECT bounties.guid, bounties.visual, bounties.price, characters.name FROM bounties LEFT JOIN characters ON bounties.guid=characters.guid ORDER BY bounties.guid ASC";
$result = mysql_query($query) or die(mysql_error());
$nr_rec = mysql_num_rows($result);
?>
echo "$nr_rec characters/page.
";
// Listing...
echo "
Character Name |
Reward/Price |
";
if(mysql_num_rows($result))
while($rows = mysql_fetch_object($result)) {
$i++;
$name = $rows->name;
$visual = $rows->visual;
if(!empty($name[name])) {
echo "
",$name," |
",$visual," Gold |
";
} else {
echo "";
}
mysql_close($characters);
} else {
echo "No results for players.
";
mysql_close($characters);
}
echo "
";
?>