0

I've been trying for a few hours now, and to be honest I'm getting fed up of it not updating the table!!!:icon_sad:

$sql="UPDATE list SET title='$_POST[title]', console='$_POST[console]', system='$_POST[system]', tv='$_POST[tv]', sram='$_POST[sram]', chips='$_POST[chips]', size='$_POST[size]', md5='$_POST[md5]', sha1='$_POST[sha1]', work='$_POST[work]', error='$_POST[error]', retrode='$_POST[retrode]', comments='$_POST[comments]' WHERE ID='$_POST[id]'";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record edited";
mysql_close($con);

Any help please?

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by hielo
0

read the comments and copy and paste the following:

//NOTE: if a field is of type INT, then do NOT put apostrophes around the value.
//For example, if ID is an integer then simply use
// ... WHERE ID=%s
//the same rationale applies for other fields (like size)
//Lastly ALWAYS enclose your fields in backticks (the character that shares the same key as the ~)
$sql= sprintf("UPDATE `list` SET `title`='%s', `console`='%s', `system`='%s', `tv`='%s', `sram`='%s', `chips`='%s', `size`='%s', `md5`='%s', `sha1`='%s', `work`='%s', `error`='%s', `retrode`='%s', `comments`='%s' WHERE `ID`='%s'"
			,mysql_real_escape_string($_POST['title'])
			,mysql_real_escape_string($_POST['console'])
			,mysql_real_escape_string($_POST['system'])
			,mysql_real_escape_string($_POST['tv'])
			,mysql_real_escape_string($_POST['sram'])
			,mysql_real_escape_string($_POST['chips'])
			,mysql_real_escape_string($_POST['size'])
			,mysql_real_escape_string($_POST['md5'])
			,mysql_real_escape_string($_POST['sha1'])
			,mysql_real_escape_string($_POST['work'])
			,mysql_real_escape_string($_POST['error'])
			,mysql_real_escape_string($_POST['retrode'])
			,mysql_real_escape_string($_POST['comments'])
			,mysql_real_escape_string($_POST['id'])
			);
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record edited";
mysql_close($con);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.