Avatar billede fzone Nybegynder
28. august 2004 - 19:21 Der er 1 løsning

PHP returnerer ingenting

Hej

Følgende stykke kode burde returnere en bunke informationer om brugeren, men i stedet sker der bare intet. Dvs. at indholdet af headerfilen bliver loadet, men derefter står der intet.

Kode:
<? include('includes/header.inc.php');
//File: profile.php :: Info: Displays user profile

//Include LogFile
include('loginfo.php');

//Connect to MySQL DB
$db = mysql_connect("$mysql_host", "$mysql_user", "$mysql_pass") or die(mysql_error());
mysql_select_db($mysql_db, $db) or die(mysql_error());


//Get varibles
$user = $_GET['user'];
$accept = "FALSE";

//Check if user exists
$resultatset=mysql_query('SELECT user FROM 1y_brugere WHERE user=\''.mysql_escape_string($user).'\' LIMIT 1');
if(mysql_num_rows($resultatset)) {
    list($user)=mysql_fetch_row($resultatset);
    $accept = "TRUE";
        $name = mysql_result(mysql_query("SELECT name FROM 1y_brugere WHERE user='$user'"),0) or die(mysql_error());
        $user = mysql_result(mysql_query("SELECT user FROM 1y_brugere WHERE user='$user'"),0) or die(mysql_error());
        $age = mysql_result(mysql_query("SELECT age FROM 1y_brugere WHERE user='$user'"),0) or die(mysql_error());
        $gender = mysql_result(mysql_query("SELECT gender FROM 1y_brugere WHERE user='$user'"),0) or die(mysql_error());
        $brace = mysql_result(mysql_query("SELECT brace FROM 1y_brugere WHERE user='$user'"),0) or die(mysql_error());
        $post_forum = mysql_result(mysql_query("SELECT post_forum FROM 1y_brugere WHERE user='$user'"),0) or die(mysql_error());
        $descrip = mysql_result(mysql_query("SELECT descrip FROM 1y_brugere WHERE user='$user'"),0) or die(mysql_error());
        $descrip = nl2br($descrip);
        print "<h1>Brugerprofil for ".$user."</h1>";
        print "<p>Fulde Navn: ".$name."<br>";
        print "<p>Alder: ".$age."<br>";
        print "<p>Køn: ".$gender."<br>";
        print "<p>Yndlings bæverrace: ".$brace."<br>";
        print "<p>Forumindlæg: ".$post_forum."<br>";
        print "<p>Beskrivelse:<br>".$descrip."<br>";
        print "</p>";
} else {
    print "<p>Brugeren findes ikke!";
    print "<br><a href=\"userlist.php\">Tilbage</a></p>";
    $accept = "FALSE";
};
?>
<? include('includes/footer.inc.php'); ?>

--

Headerfil:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>

<head>
<link rel="stylesheet" href="includes/style/main.css" type="text/css">
<META NAME="description" CONTENT="NAG 1.Y's side">
<META NAME="keywords" CONTENT="PAME,Patrick,Anders,Media,Entertainment,NAG">
<META NAME="Robots" CONTENT="ALL">
<META NAME="Revisit-after" CONTENT="7">
<META NAME="Author" CONTENT="Anders Ossowicki">
<LINK REV=made href="mailto:and@vmn.dk">
<META HTTP-EQUIV="Reply-to" CONTENT="and@vmn.dk">
<META NAME="Copyright" CONTENT="PAME">
<META HTTP-EQUIV="Content-language" CONTENT="dan">
<META NAME="Rating" CONTENT="General">
<META NAME="DC.Creator" CONTENT="Anders Ossowicki">
<META NAME="DC.Contributor" CONTENT="Anton">
<META NAME="DC.Rights" CONTENT="PAME">
<META NAME="DC.Identifier" CONTENT="http://www.pame.dk">
<META NAME="DC.Publisher" CONTENT="PAME">
<META NAME="DC.Date" SCHEME="ISO8601" CONTENT="2004-09-01">
<META NAME="DC.Language" scheme="NISOZ39.50" CONTENT="dan">
<META NAME="DC.Type" CONTENT="Text">
<META NAME="DC.Format" SCHEME="MIME" CONTENT="text/html">
<title>1.Y NAG - Nærum Amtsgymnasium</title>
</head>

<body>

<table border="0" width="100%" id="table1" cellspacing="7">
    <tr>
        <td width="100" valign="top" background="images/design/banner.gif">
        </td>
        <td valign="top" height="30px">
        <p style="font-size: 7pt;" align="right">
        <a href="kontakt.php" title="Kontakt PAME.dk" style="font-size: 7pt;"> Kontakt</a>
        <a style="font-size: 7pt;" href="sitemap.php" title="Sitemap af PAME.dk"> Sitemap</a>
        <script type="text/javascript">
            var months=new Array(13);
            months[1]="januar";
            months[2]="februar";
            months[3]="marts";
            months[4]="april";
            months[5]="maj";
            months[6]="juni";
            months[7]="juli";
            months[8]="august";
            months[9]="september";
            months[10]="oktober";
            months[11]="november";
            months[12]="december";
            var time=new Date();
            var lmonth=months[time.getMonth() + 1];
            var date=time.getDate();
            var year=time.getFullYear();
            var hours=time.getHours();
            var minutes=time.getMinutes();
            var seconds=time.getSeconds();

            document.write(date + ". " + lmonth + " " + year);
            document.write(" kl. " + hours + ":" + minutes + ":" + seconds);
        </script>
        <hr color="#666666">
        </td>
        <td width="100" valign="top" background="images/design/nag.gif">&nbsp;</td>
    </tr>
    <tr>
        <td width="100" valign="top" background="images/design/box2.gif" height="203">
        <p align="center">Menu:</p>
        <p><img src="images/design/arrow.gif"> <a href="http://1y.fantasyzone.dk/index.php">Forside</a><br>
        <img src="images/design/arrow.gif"> Profiler<br>
        <img src="images/design/arrow.gif"> Forum<br>
        <img src="images/design/arrow.gif"> Tagwall<br>
        <img src="images/design/arrow.gif"> Downloads<br>
        <img src="images/design/arrow.gif"> Kontakt</p></td>
        <td valign="top" rowspan="2">

---

Der er indhold både i databasen og i footerfilen.

Nogle idéer?
Avatar billede fzone Nybegynder
28. august 2004 - 22:36 #1
bg
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester