Jump to content

[SOLVED] problem can't find fault


DEVILofDARKNESS

Recommended Posts

I got a problem with this piece of code: it gives me the next error:

Parse error: syntax error, unexpected T_VARIABLE in /www/uuuq.com/4/a/d/4ade/htdocs/members.php on line 36

 

elseif($type == "edit") {
	$text = "<?php if($user_id = '$own_id') {
	            if(isset($_POST['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);
				} ?>
				<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><?php
			}else{
				?>
				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>
				<?php
			}"

 

I will give you the full code also, in case it is needed.:

<?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);
while($row = mysql_fetch_array($result)) :
if($type == "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>";
} elseif($type == "edit") {
	$text = "<?php if($user_id = '$own_id') {
	            if(isset($_POST['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);
				} ?>
				<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><?php
			}else{
				?>
				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>
				<?php
			}"
} else {
	$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>";
}
endwhile;
}
?>
<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

It's hard to follow all of your brackets, you should have a syntax highlighting editor to easily catch your errors.

 

Anyway, you need to escape your double quotes in the $text variables for the queries.

 

You also don't need to start $text off with <?php and end with ?> because you're already echoing it within those tags.

Link to comment
Share on other sites

Think I unescaped them all, still gives me an error

<?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);
while($row = mysql_fetch_array($result)) :
if($type == "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>";
} elseif($type == "edit") {
	$text = "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);
				}
				<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{

				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>
								}"
} else {
	$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>";
}
endwhile;
}
?>
<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

Alright changed again a lot of code,

now it gives me this error:

Parse error: syntax error, unexpected T_ENDWHILE in /www/uuuq.com/4/a/d/4ade/htdocs/members.php on line 84

 

this is the code...

<?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);
while($row = mysql_fetch_array($result)) :
if($type == "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>";
} elseif($type == "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>
								";}
} else {
	$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>";
}
endwhile;
}
?>
<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

It also would go if I just put the hp in the body syntax,

but I was already bedun that way, and I'm too lazy :P

 

it gives me one more error: that it has an unexpected $end

 

Somewhere a ; or } probably...

 

<?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);
while($row = mysql_fetch_array($result)) {
if($type == "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>";
} elseif($type == "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>
								";}
} else {
	$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>";
}
};
}
?>
<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

I deleted it, ut still an unexpected $end...

I already checkt if there was a semicolon after every command, and that is so, but can't find what's the real problem

 

<?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);
while($row = mysql_fetch_array($result)) {
if($type == "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>";
} elseif($type == "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>
								";}
} else {
	$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>";
}
}
}
?>
<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

First is a suggestionto change your query updates into a switch staement to make it easier to track bracket sets which is the cause of the missing bracket, hence the unexpexted end.

 

 

Second is more out of curiosity since I don't know your table strucutre, why are you updating the same field within the database with different value types: "forum_name" i.e. place, age, tel?

 

					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);

Link to comment
Share on other sites

Hi

 

You are still on short

 

Those 3 line up with } else {, elseif($type == "edit") { and while($row = mysql_fetch_array($result)) { respectively. There is no closing brace for if(isset($user_id)) {.

 

I am using Notepad++, and when you put the cursor by one brace it highlights it and its matching brace in red. Makes it quite obvious.

 

All the best

 

Keith

Link to comment
Share on other sites

Crap , it works fine, except if I type in the address bar ...type=edit

it show me the text that should appear if the type isn't info or edit...

 

<?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 user_name = '$username'";
$result = mysql_query($query);
list($own_id) = mysql_fetch_row($result);
/*$query = "select count(*) as rank from
    (select * from users where ammount >
       (select ammount from users where user_id='$user_id') order by ammount desc)as s;";
$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);
while($row = mysql_fetch_array($result)) {
if($type == "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>";
} elseif($type == "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='../login.php'>login</a><br>
				2) <a href='../forum'>Meld een probleem aan de administrator op het forum</a><p>
				If it isn't yours,<br>
				1) <a href='../members.php?user_id={$user_id}&type=info'>go to the info page from {$row['user_name']}</a><br>
				2) <a href='../index.html'>Go to the home page</a><br>
								";}
} else {
	$text = "Sorry there has went something wrong.<p>
	         <a href='../index.html'>go to the homepage</a><br>
			 <a href='../members.php?user_id={$user_id}&type=info'>go to the info page from {$row['user_name']}</a><br>
			 <a href='../forum'>Ask for help on the forum</a>";
}
}
}
}
?>
<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

Hi

 

Possibly you have put the brace in the wrong place. Logically it would seem to me there should be one at the end of :-

 

	            if(isset($forumch)) {
					$forum = $_POST['forum'];
					$query = "UPDATE users SET forum_name = '$forum' WHERE user_id = '$user_id'";
					$result = mysql_query($query);

 

All the best

 

Keith

Link to comment
Share on other sites

Try using clearer tabs, makes it easier to follow, some programs will indent for you. Control Shift F in Zend.

 

Also you might want to try using switch(){

 

I dunno if it will help but it may bake find the problem a bit easier.

 

<?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);
while($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

Now, this is solved, I have a problem with the type=edit part,

it shows me 4 textareas but only in the age-textarea there is a value.

(I thought first it was because my tables where wrong defined, but they are right.)

 

the problem lays into the query SELECT * from users where user_id = '$user_id'

<?php
session_start();/*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 user_name = '$username'";
$result = mysql_query($query);
list($own_id) = mysql_fetch_row($result);
/*$query = "select count(*) from users where ammount >
       (select ammount from users where user_id='$user_id') order by 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);
while($row = mysql_fetch_array($result)) {
if($type == "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>";
} elseif($type == "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='../login.php'>login</a><br>
				2) <a href='../forum'>Meld een probleem aan de administrator op het forum</a><p>
				If it isn't yours,<br>
				1) <a href='../members.php?user_id={$user_id}&type=info'>go to the info page from {$row['user_name']}</a><br>
				2) <a href='../index.html'>Go to the home page</a><br>
								";}
} else {
	$text = "Sorry there has went something wrong.<p>
	         <a href='../index.html'>go to the homepage</a><br>
			 <a href='../members.php?user_id={$user_id}&type=info'>go to the info page from {$row['user_name']}</a><br>
			 <a href='../forum'>Ask for help on the forum</a>";
}
}
}
?>
<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

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.