Jump to content

[SOLVED] problem can't find fault


DEVILofDARKNESS

Recommended Posts

can I suggest against the use of a while loop in this situation? if there is only 1 row you really don't need a loop.

 

Also try this

print_r($row);

 

add it just after

$row = mysql_fetch_array($result);

 

<?php

/*DATABASE SETTINGS */

$user_id = (int)$_GET["user_id"];
$type = $_GET["type"];
$username = mysql_real_escape_string($_SESSION['username']);
$query = "SELECT user_id FROM users WHERE username = '$username'";
$result = mysql_query($query);
list($own_id) = mysql_fetch_row($result);
$query = "SELECT COUNT(user_id) FROM users WHERE user_id='$user_id' ORDER BY u.ammount DESC";
$result = mysql_query($query);
list($rang) = mysql_fetch_row($result);

$user_id = mysql_real_escape_string($user_id);

if(isset($user_id)) {
$query = "SELECT * FROM users WHERE user_id = '$user_id'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
switch($type){
	case 'info':
		$text = "<table border='0'><tr><td colspan='2'><CENTER>INFO OVER {$row['user_name']}</CENTER></TD></TR>
                <tr><td>forum Naam:</td><td><b>{$row['forum_name']}</b></td></tr>
                <tr><td>e-mail:</td><td><b>{$row['email']}</b></td></tr>
                <tr><td>telefoon:</td><td><b>{$row['tel']}</b></td></tr>
                <tr><td>woonplaats:</td><td><b>{$row['place']}</b></td></tr>
                <tr><td>leeftijd:</td><td><b>{$row['age']}</b></td></tr>
                <tr><td colspan='2'></td></tr>
                <tr><td>Aantal posts:</td><td><b>{$row['ammount']}</b></td></tr>
                <tr><td>ranglijst:</td><td><b>{$rang}</b></td></tr>
                </table>";
		break;
	case 'edit':
		if($user_id == $own_id) {
			$forumch = $_POST["forumch"];
			if(isset($forumch)) {
				$forum = $_POST['forum'];
				$query = "UPDATE users SET forum_name = '$forum' WHERE user_id = '$user_id'";
				$result = mysql_query($query);
				if(isset($_POST['emailch'])) {
					$forum = $_POST['email'];
					$query = "UPDATE users SET email = '$email' WHERE user_id = '$user_id'";
					$result = mysql_query($query);
				}
				if(isset($_POST['telch'])) {
					$forum = $_POST['tel'];
					$query = "UPDATE users SET forum_name = '$tel' WHERE user_id = '$user_id'";
					$result = mysql_query($query);
				}
				if(isset($_POST['placech'])) {
					$forum = $_POST['place'];
					$query = "UPDATE users SET forum_name = '$place' WHERE user_id = '$user_id'";
					$result = mysql_query($query);
				}
				if(isset($_POST['agech'])) {
					$forum = $_POST['age'];
					$query = "UPDATE users SET forum_name = '$age' WHERE user_id = '$user_id'";
					$result = mysql_query($query);
				}
				$text="
                  <form action='' method='post'><table border='0'><tr><td colspan='2'><CENTER>VERANDER JE PROFIEL</td></tr>
                  <tr><td>Forum Naam:</td><td><textarea name='forum' cols='40' rows='1'>{$row['forum_name']}</textarea><input type='submit' value='change' name='forumch'></td></tr>
                  <tr><td>Email:</td><td><textarea name='email' cols='40' rows='1'>{$row['email']}</textarea><input type='submit' value='change' name='emailch'></td></tr>
                  <tr><td>telefoon:</td><td><textarea name='tel' cols='40' rows='1'>{$row['tel']}</textarea><input type='submit' value='change' name='telch'></td></tr>
                  <tr><td>Woonplaats:</td><td><textarea name='place' cols='40' rows='1'>{$row['place']}</textarea><input type='submit' value='change' name='placech'></td></tr>
                  <tr><td>Leeftijd:</td><td><textarea name='age' cols='40' rows='1'>{$row['age']}</textarea><input type='submit' value='change' name='agech'></td></tr>
                </table></form>";
			}else{

				$text = "               You don't have acces to this account, if it is yours,<br>
                  1) <a href='4ade.uuuq.com/login.php'>login</a><br>
                  2) <a href='4ade.uuuq.com/forum'>Meld een probleem aan de administrator op het forum</a><p>
                  If it isn't yours,<br>
                  1) <a href='4ade.uuuq.com/members.php?user_id={$user_id}&type=info'>go to the info page from {$row['user_name']}</a><br>
                  2) <a href='4ade.uuuq.com/index.html'>Go to the home page</a><br>
                              ";
			}
			$text = "Sorry there has went something wrong.<p>
                  <a href='4ade.uuuq.com/index.html'>go to the homepage</a><br>
                <a href='4ade.uuuq.com/members.php?user_id={$user_id}&type=info'>go to the info page from {$row['user_name']}</a><br>
                <a href='4ade.uuuq.com/help.php'>go to the help-page</a>";
		}
		break;
}
}
?>
<html dir="ltr">
    <head>
        <title>MEMBERS</title>
        <link href="../../standard.css" type="text/css" rel="stylesheet" />
   <link href='dichtkunst.css' type='text/css' rel="stylesheet" />
    </head>
    <body>
        <table class="look" height="100%" width="100%" border="1">
            <tbody>
                <tr>
                    <td width="10%" height="100%"><iframe class="frames" src="../../functieknoppen/functieknoppendichtkunst.htm" frameborder="0" width="100%" height="100%" scrolling="no"></iframe>
                    </td>
                    <td><center>
<?php echo $text; ?>
                    </center></td>
                </tr>
            </tbody>
        </table>
    </body>
</html>

Link to comment
Share on other sites

If I do print_r it gives me this:

Array ( [0] => 3 [user_id] => 3 [1] => test [user_name] => test [2] => 3 [ammount] => 3 [3] => 1f8582c31b117c4449c6cbf86bf406ae [user_pass] => 1f8582c31b117c4449c6cbf86bf406ae [4] => 2009-03-07 [last_login] => 2009-03-07 [5] => [forum_name] => [6] => => [7] => [tel] => [8] => [place] => [9] => 0 [age] => 0 )

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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