Ri1es Posted August 7, 2012 Share Posted August 7, 2012 I am pulling my hair out at this simple problem, sorry to waste your time with something like this but I really don't know where I have gone wrong. Here is error message: Parse error: syntax error, unexpected T_VARIABLE in /home/abc/public_html/members/profile/updatebio.php on line 10 Here is my code: <html> <body> <?php session_start(); //CONNECT TO DATABASE// $hostname = "abc"; $username = "abc"; $password = "abc"; $db_name = "abc"; $tbl_name = "accounts"; $connect = mysql_connect($hostname,$username,$password); if (!$connect) { die("Connection to database failed.<br />" . " Please contact an Administrator and show them the code above.<br />"); } //SELECT CORRECT DATABASE// mysql_select_db("$db_name", $connect)or die("Cannot select database."); //////////////////////// $currentusr = $_SESSION['usr']; $currentema = $_SESSION['ema']; $newbio = $_POST['changebio']; $updatebio = mysql_query("UPDATE accounts SET bio='$newbio' WHERE usr='$currentusr' AND ema='$currentema'"); if($updatebio) { header(Location:"http://www.blu-byte.co.cc/members/profile/edit.php"); } else { echo "Sorry about this but we have unsuccessfully changed your biography."; } ?> </body> </html> What is the problem? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 7, 2012 Share Posted August 7, 2012 Since the line number where the error is occurring at is in your database connection details, which you edited for the post, I'll guess you were missing a quote or had an extra quote somewhere in the first or second setting. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 7, 2012 Share Posted August 7, 2012 header(Location:"http://www.blu-byte.co.cc/members/profile/edit.php"); This isn't line 10 but it should produce an error too. Change to. header("Location: http://www.blu-byte.co.cc/members/profile/edit.php"); Quote Link to comment Share on other sites More sharing options...
Ri1es Posted August 7, 2012 Author Share Posted August 7, 2012 Already changed it, . Anyway I found the problem, it's really annoying. Go ahead and highlight the line with the variable hostname on, notice the space. He was the little gremlin in the works. Thanks anyway for your time. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 7, 2012 Share Posted August 7, 2012 Having a space after your ; will not cause a syntax error. Extra whitespace where you're allowed to have whitespace won't cause issues in PHP. Whitespace can cause issues when you can't have ANY but that is not your problem. 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.