greensmurf -
Joined: 02 Jun 2004 Posts: 1
|
Posted: Thu Jun 10, 2004 8:31 pm Post subject: Just recently... |
|
|
I have just recently begun teaching myself php and mssql. i have been trying to execute a sql code and output the table info but only specific parts. for example,
SELECT * FROM tblGameID1 ORDER BY Lvl+STotalBonus DESC
that's the code i have. it organizes everyone by their "rank" from highest value to lowest.
the database is redmoon and i have a script that logs me in called config.php, i know it works.
here's the code for that
<?php
//MSSQL Host IP
$db_host = 'localhost';
//MSSQL Username
$db_user = 'RMGS';
//MSSQL Password
$db_pass = 'S#d885fk';
//MSSQL Database
$db_name = 'redmoon';
$conn = mssql_connect($db_host,$db_user,$db_pass);
mssql_select_db($db_name,$conn);
?>
here are my problems. i don't understand how to include the config.php in the rank.php and make the php execute this command into mssql and output colunms GameID, Lvl, Strength, Spirit, Dexterity, and Power.
also, i've noticed that this doesn't make the change to the table permanent, is there anyway to do that?
here is what i've got.
<?
include (config.php);
$query="SELECT * FROM tblGameID1 ORDER BY Lvl+STotalBonus DESC";
$result = mssql_query($query,$conn);
if (mssql_num_rows($result) > 0) {
echo "<b>Error 1.</b>";
}
else {
echo "<b>Player Ranks</b><br><br>";
while ($f = mssql_fetch_array($result)) {
echo "<b>Error 2.</b>";
echo "<b>".$f['GameID']." -- ".$f['Lvl']." -- ".$f['Strength']." -- ".$f['Spirit']." -- ".$f['Dexerity']." -- ".$f['Power']."</b><br>";
}
}
?> |
|