Forum Moderators: coopster

Message Too Old, No Replies

what is wrong here?

but there's nothi wron with usig clustered if constructs rite?

         

nil111

7:15 am on Jul 10, 2008 (gmt 0)

10+ Year Member



here's the error I get;

Parse error: parse error, unexpected T_IF on line 25

<?php

include("new_login.php");
Global $username;
global $userID, $usergroup,$username1, $userpass, $firstname, $lastname;

$conn1 = mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db('saberplex', $conn1) or die(mysql_error());

function display($username1)
{
$username = $_POST['user'];

$query1= "select * from users where u_user_name = '$username'";
$result = mysql_query($query1);
$dbarray = mysql_fetch_array($result);
if(!$result)
{
echo "Could not establish connection with the database server";
}
else
(

if($dbarray['u_user_status']==0)
{
echo "Your profile has been terminated! Please contact the administrator!";
}

else
{
$userID = $dbarray["u_user_id"];
$usergroup = $dbarray["u_user_group"];
$username1 = $dbarray["u_user_name"];
$userpass = $dbarray["u_user_password"];
$firstname = $dbarray["u_user_first_name"];
$lastname = $dbarray["u_user_last_name"];

echo "$username1";
}

}
}

?>

<?php if(isset($_POST['View'])): ?>

<?php endif; ?>

<html>
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<strong>Click here to view your profile:</strong>
<label>
<input type="submit" name="View" value="View Profile">
</label>
</form>
</html>

[edited by: eelixduppy at 1:54 pm (utc) on July 10, 2008]

ixod

7:40 am on Jul 10, 2008 (gmt 0)

10+ Year Member



have you tried:
if(){
}
ifelse(){
}
ifelse(){
}
else(){
}
instead:
if(){
}else{
if(){
}
}

or in your code:
if(!$result)
{
echo "Could not establish connection with the database server";
}
else !try <b>else{ }</b>
(
if($dbarray['u_user_status']==0) { \

it was just after quick examining, so best way is to check manual for
good if(){
}else{
}
syntax.
Hope it help a little bit;.

xize

7:49 am on Jul 10, 2008 (gmt 0)

10+ Year Member



Hi,

Check this part here:

echo "Could not establish connection with the database server";
}
else
(

Aren't that supposed to be a bracket { . You are using a parenthesis. Also try to use if, elseif.

'xize

nil111

8:58 am on Jul 10, 2008 (gmt 0)

10+ Year Member



nope { is wat should be used not (

I cant c wats wron here. pls help

ixod

9:27 am on Jul 10, 2008 (gmt 0)

10+ Year Member



you replaced () brackets with {} and still same error or another one?

have you tried to change whole if(){
}else{
}
syntax?

mrscruff

9:56 am on Jul 10, 2008 (gmt 0)

10+ Year Member



try:

if(!$result)
{
echo "Could not establish connection with the database server";
}
elseif ($dbarray['u_user_status']== 0)
{
echo "Your profile has been terminated! Please contact the administrator!";
}
else
{
$userID = $dbarray["u_user_id"];
$usergroup = $dbarray["u_user_group"];
$username1 = $dbarray["u_user_name"];
$userpass = $dbarray["u_user_password"];
$firstname = $dbarray["u_user_first_name"];
$lastname = $dbarray["u_user_last_name"];

echo "$username1";
}

g1smd

4:32 pm on Jul 13, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



else
(
if

should be

else
{
if