1
JS
Help with some code please
  • 2005/1/11 8:36

  • JS

  • Just popping in

  • Posts: 87

  • Since: 2002/12/16


hey all I am working on porting into XOOPS a guild roster for WoW. But I am having some issues. First of all the database tables are all in place and there is data in them. That was the easy part now the problem that I am having is the code I am using will not display the information from the database. Maybe someone who is better with php then me can look at the code and tell me if I am really hosed or what.

// let start including the header of xoops
include("../../mainfile.php"); // including top functions of xoops
include(XOOPS_ROOT_PATH."/header.php"); // including the rest ?>
include "conf.php"?>



Name
Race
Class
Level
Rank

$link mysql_connect($db_host$db_user$db_passwd) or die("Could not connect");
mysql_select_db($db_name) or die("Could not select DB");

$query "SELECT * FROM `guild_char`";
if( 
$guild_name != "" ){
    
$query .= " WHERE guild_name = '$guild_name'";
}

if( 
$_REQUEST['sort'] == 'name' ) {
  
$query .= " ORDER BY name";
} else if( 
$_REQUEST['sort'] == 'race' ) {
  
$query .= " ORDER BY race";
} else if( 
$_REQUEST['sort'] == 'class' ) {
  
$query .= " ORDER BY class";
} else if( 
$_REQUEST['sort'] == 'guild_rank' ) {
  
$query .= " ORDER BY guild_rank"
} else {
  
$query .= " ORDER BY level DESC";
}
print 
"";

$result mysql_query($query) or die(mysql_error());


while ( 
$row mysql_fetch_assoc$result ) )
{
?>
 
href="char.php?name=print $row['name']; ?>&server=print $row['server']; ?>">
print $row["name"]; ?>
print $row["race"]; ?> 
print $row["class"]; ?>
print $row["level"]; ?>
print $row["guild_rank"]; ?>

}

?>




// including footer of xoops
include(XOOPS_ROOT_PATH."/footer.php");
// done
?>


maybe someone can tell me where I have gone wrong.

2
wtravel
Re: Help with some code please

What does the result look like? Do you see any errors on the page or below the footer?

Usually I insert an extra code to display the number of results from a query first, so that I know that the query is correct or not.

Regards,

Martijn

Login

Who's Online

328 user(s) are online (217 user(s) are browsing Support Forums)


Members: 0


Guests: 328


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits