Would be greatfull if anyone can advise. I am trying to put a secure logon that opens a connection and then populates a form once a password has been submitted but i keep getting 'Parse error: parse error, unexpected $end in update.php on line 56' Can someone advise before i loose all hope! One virtual pint available, or probably a barrel Regards <html> <head> <title>Update</title> </head> <body> <?php if (!isset($PHP_AUTH_USER)) { // If empty, send header causing dialog box to appear header('WWW-Authenticate: Basic realm="My Private Stuff"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; } else if (isset($PHP_AUTH_USER)) { if (($PHP_AUTH_USER != "a") || ($PHP_AUTH_PW != "ab")) { header('WWW-Authenticate: Basic realm="My Private Stuff"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; } else { //connect to database $id = $HTTP_GET_VARS['pageid']; $dbConnection = @mysql_connect ("localhost","root","") OR die ('could not connect:'.mysql_error()); // select the database to use @mysql_select_db ("accessibility") OR die ('could not connect to database:'.mysql_error()); $SQL = "INSERT INTO subscribers (Firstname, Surname, Email)"; $result = mysql_query ("SELECT * FROM content WHERE id ='$id'") or die ("could not retrieve"); $update = mysql_query ("UPDATE content SET WHERE id ='$id'") or die ("could not retrieve"); $database_record = mysql_fetch_row($result); //$database_record = $database_record[1]; // mysql_fetch_row returns an array. we only want the content so we just set it excluseively. }?> <form action="updated.php" method="post"> <?php echo $id;?></br> content a<input type="text" name="contenta" value="<?php Echo $database_record [1]; ?>"><br> CONTENT B<input type="text" name="contentb" value="<?php Echo $database_record [2]; ?>"><br> Image a<input type="text" name="iamgea" value="<?php Echo $database_record [3]; ?>"><br> Image b<input type="text" name="imageb" value="<?php Echo $database_record [4]; ?>"><br> script<input type="text" name="script" value="<?php Echo $database_record [5]; ?>"><br> Links<input type="text" name="links" value="<?php Echo $database_record [6]; ?>"><br> <input type="submit" value="Update"> </form> </body> </html> ?were did it all go wrong
I think it's because } else if (isset($PHP_AUTH_USER)) { PHP: is missing the end } this should work: <html> <head> <title>Update</title> </head> <body> <?php if (!isset($PHP_AUTH_USER)) { // If empty, send header causing dialog box to appear header('WWW-Authenticate: Basic realm="My Private Stuff"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; } else if (isset($PHP_AUTH_USER)) { if (($PHP_AUTH_USER != "a") || ($PHP_AUTH_PW != "ab")) { header('WWW-Authenticate: Basic realm="My Private Stuff"'); header('HTTP/1.0 401 Unauthorized'); echo 'Authorization Required.'; exit; } else { //connect to database $id = $HTTP_GET_VARS['pageid']; $dbConnection = @mysql_connect ("localhost","root","") OR die ('could not connect:'.mysql_error()); // select the database to use @mysql_select_db ("accessibility") OR die ('could not connect to database:'.mysql_error()); $SQL = "INSERT INTO subscribers (Firstname, Surname, Email)"; $result = mysql_query ("SELECT * FROM content WHERE id ='$id'") or die ("could not retrieve"); $update = mysql_query ("UPDATE content SET WHERE id ='$id'") or die ("could not retrieve"); $database_record = mysql_fetch_row($result); //$database_record = $database_record[1]; // mysql_fetch_row returns an array. we only want the content so we just set it excluseively. } }?> <form action="updated.php" method="post"> <?php echo $id;?></br> content a<input type="text" name="contenta" value="<?php Echo $database_record [1]; ?>"><br> CONTENT B<input type="text" name="contentb" value="<?php Echo $database_record [2]; ?>"><br> Image a<input type="text" name="iamgea" value="<?php Echo $database_record [3]; ?>"><br> Image b<input type="text" name="imageb" value="<?php Echo $database_record [4]; ?>"><br> script<input type="text" name="script" value="<?php Echo $database_record [5]; ?>"><br> Links<input type="text" name="links" value="<?php Echo $database_record [6]; ?>"><br> <input type="submit" value="Update"> </form> </body> </html> PHP:
Thanks for taking a look Unfortunately im still gettin parse error even with the code that you provided?