farban Posted March 14, 2009 Share Posted March 14, 2009 I dont understand why i run this page and it comes up with Parse error: parse error in C:\xampp\htdocs\testsite\community\editprofile.php on line 217 I have checked line 217 but cant see no errors if (mysqli_num_rows($result) == 1) { editprofile.php <?php session_start(); if (!isset($_SESSION['user_id'])) { $url = absolute_url(); header("Location: $url"); exit(); } include("includes/start.php"); echo "<h1>Update Profilet</h1><p>Update the profile</p>"; if ((isset($_GET['user_id'])) && (is_numeric($_GET['user_id']))) { $user_id = $_GET['user_id']; } else if ((isset($_POST['user_id'])) && (is_numeric($_POST['user_id']))) { $user_id =$_POST['user_id']; } else { echo '<p>This page has been accessed in error</p>'; include("includes/footer.php"); exit(); } require_once ("includes/_connect.inc.php"); if (isset($_POST['submitted'])) { $errors = array(); if (empty($_POST['user_first_name'])) { $errors[] ='You forgot to enter your first name'; } else { $user_first_name = mysqli_real_escape_string($dbc, trim($_POST['user_first_name'])); } if (empty($_POST['user_surname'])) { $errors[] ='You forgot to enter surname'; } else { $user_surname = mysqli_real_escape_string($dbc, trim($_POST['user_surname'])); } if (empty($_POST['user_age'])) { $errors[] ='You forgot to enter your age'; } else { $user_age = mysqli_real_escape_string($dbc, trim($_POST['user_age'])); } if (empty($_POST['user_email'])) { $errors[] ='You forgot to enter your email address'; } else { $user_email = mysqli_real_escape_string($dbc, trim($_POST['user_email'])); } if (empty($_POST['user_sex'])) { $errors[] ='You forgot to enter your gender'; } else { $user_sex = mysqli_real_escape_string($dbc, trim($_POST['user_sex'])); } if (empty($_POST['user_city'])) { $errors[] ='You forgot to enter your city'; } else { $user_city = mysqli_real_escape_string($dbc, trim($_POST['user_city'])); } if (empty($_POST['user_home_phone'])) { $errors[] ='You forgot to enter your home'; } else { $user_home_phone = mysqli_real_escape_string($dbc, trim($_POST['user_home_phone'])); } if (empty($_POST['user_mobile_phone'])) { $errors[] ='You forgot to enter your mobile phone'; } else { $user_mobile_phone = mysqli_real_escape_string($dbc, trim($_POST['user_mobile_phone'])); } if (empty($_POST['user_profession'])) { $errors[] ='You forgot to enter your profession'; } else { $user_profession = mysqli_real_escape_string($dbc, trim($_POST['user_profession'])); } if (empty($_POST['user_specialist_area'])) { $errors[] ='You forgot to enter your specialist area'; } else { $user_specialist_area = mysqli_real_escape_string($dbc, trim($_POST['user_specialist_area'])); } if (empty ($errors)) { $query = "SELECT user_id FROM user WHERE user_email='$user_email' AND user_id ! =$user_id"; $result =@mysqli_query($dbc, $query); if (mysqli_num_rows($result) ==0) { $query = "UPDATE user SET user_first_name ='$user_first_name', user_surname='$user_surname', user_age='$user_age', user_email='$user_email', user_sex='$user_sex', user_city ='$user_city', user_home_phone='$user_home_phone', user_mobile_phone='$user_mobile_phone, user_proffesion='$user_profession', user_specialist_area='$user_specialist_area' WHERE user_id=$user_id LIMIT 1"; $result =@mysqli_query($dbc, $query); if (mysqli_affected_rows($dbc) ==1) { echo '<p>The user has been edited</p>'; } else { echo '<p>The user cannot be edited due to a system error</p>'; echo '<p>'.mysqli_error($dbc).'<br/>Query:'.$query.'</p>'; } } else { echo '<p>The email address has already been registered</p>'; } } else { echo '<p>The following errors occured:<br/>'; foreach ($errors as $msg) { echo "- $msg<br/>\n"; } echo '</p><p>Please try agian</p>'; } } $query = " SELECT user.user_first_name, user.user_surname, user.user_age, user.user_sex, user.user_city, user.user_home_phone, user.user_mobile_phone, user.user_profession, user.user_specialist_area, user.user_email FROM user WHERE user.user_id=$user_id"; $result =@mysqli_query($dbc, $query) if (mysqli_num_rows($result) == 1) { $row =mysqli_fetch_array($result, MYSQLI_NUM); echo '<form action="editpage.php" method="post"> <p>Firstname: <input type="text" name="user_first_name" size="20" maxlengh="80" value="'.$row[0].'"/> </p> <p>Surname: <input type="text" name="user_surname" size="20" maxlengh="80" value="'.$row[1].'"/> </p> <p>Age: <input type="text" name="user_age" size="20" maxlengh="80" value="'.$row[2].'"/> </p> <p>Email: <input type="text" name="user_email" size="20" maxlengh="80" value="'.$row[3].'" /> </p> <p>Sex: <input type="text" name="user_sex" size="20" maxlengh="80" value="'.$row[4].'"/> </p> <p>City: <input type="password" name="user_city" size="20" maxlengh="80" value="'.$row[5].'"/> </p> <p>Home Phone: <input type="text" name="user_home_phone" size="20" maxlengh="80" value="'.$row[6].'"/> </p> <p>Mobile Phone: <input type="text" name="user_mobile_phone" size="20" maxlengh="80" value="'.$row[7].'"/> </p> <p>Profession: <input type="text" name="user_profession" size="20" maxlengh="80" value="'.$row[8].'"/> </p> <p>Specialist Area: <input type="text" name="user_specialist_area" size="20" maxlengh="80" value="'.$row[9].'"/> </p> <p><input type="submit" name="submit" value="Update"/> </p> <input type="hidden" name="submitted" value="TRUE"/> <input type="hidden" name="user_id" value="'.$user_id.'"/> </form>'; } else { echo '<p>This page has been accessed in error</p>'; } mysqli_close($dbc); include("includes/footer.php"); ?> Quote Link to comment Share on other sites More sharing options...
Silverado_NL Posted March 14, 2009 Share Posted March 14, 2009 $result =@mysqli_query($dbc, $query) should be $result =@mysqli_query($dbc, $query); Quote Link to comment Share on other sites More sharing options...
farban Posted March 14, 2009 Author Share Posted March 14, 2009 Much thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.