Overwrite MySQL database entry problem :(
Posted: Tue Feb 09, 2010 10:17 am
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! 
Page One:
Page Two:
Anyone see whats going wrong?
Page One:
Code: Select all
<html>
<body>
<form id="detailchange" name="detailchange" method="post" action="fnameedit-exec.php">
<?php
$memid = $_GET["memid"];
$fname = $_GET["fname"];
echo "<input type=hidden name=memid value=$memid>";
echo "<input type=hidden name=fname value=$fname>";
?>
<p><input type="text" id="detail" name="detail" class="textfield" /> <input type="submit" class="button" value="Change"></p>
</form>
</body>
</html>Code: Select all
<?php
//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();
?>Anyone see whats going wrong?