PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hey all, this is my first post here as ive only been using php for about a week, and ive come across a minor problem. OK, what i want is one page with a textbox and button for the user to enter their details they want changed (they already have an "account" stored on mysql db. I have another page where the details get sent and (hopefully soon), processed. Im getting a "Unexpected $end" error for the last line, ?> of the second page, i know this means something about brackets, too many or not enough or in the wrong place but i cant figure it out. Any help about general php programming be much appreciated!
//Start session
session_start();
//Include database connection details
require_once('config.php');
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server:');
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die('Unable to select database');
}
//Sanitize the POST value
$detail = clean($_POST['detail']);
$memid = clean($_POST['memid']);
$qry = "UPDATE members SET firstname = '$detail' WHERE member_id = '$memid';
session_write_close();
exit();
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
This may just be me being a bit thick, ive tried what you mentioned but still cant seem to find anything wrong!? I know its just because im new at php but any ideas??
enter-music wrote:This may just be me being a bit thick, ive tried what you mentioned but still cant seem to find anything wrong!? I know its just because im new at php but any ideas??
If you look at what I posted and you follow the code, do you see a point at which it seems that the color coding "breaks"? Maybe at session_write_close()? Then look at just before session_write_close(). Check for a semicolon terminating the previous line, and If you have anything that needs to be "matched" in pairs (parentheses, quotes, braces), count those and make sure they are matched.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.