Page 1 of 1

Problem with Update statement

Posted: Mon Dec 13, 2004 8:49 am
by bazjones
Hi ppl

Im having a few problmes when it comes to updating my data, once i have entered the data i wish to update and click submit it does not submit the data from taskdesc or nextstep!

I think this may have something to do with the fact that both of these fields are textareas in my form any ideas?

Code: Select all

<?
//display the info you want to edit in textboxes. 
//after it has been submitted do this: 
$query = "UPDATE `pcr` SET `PCRTitle` = '". $_POST&#1111;"pcrtitle"] ."', `RaisedBy` = '". $_POST&#1111;"raisedby"] ."', `taskdesc` = '". $_POST&#1111;"taskdesc"] ."', `Status` = '". $_POST&#1111;"status"] ."', `NextStep` = '". $_POST&#1111;"nextstep"] ."', `Engineer` = '". $_POST&#1111;"engineer"] ."', `PCRDate` = '". $_POST&#1111;"pcrdate"] ."' WHERE `pcrid` = '$pcrid'";
$result = mysql_query($query); 
        echo("<SCRIPT LANGUAGE='JavaScript'>
							window.alert('PCR Has Been Updated')
							</SCRIPT>");
?>

Posted: Mon Dec 13, 2004 9:14 am
by CoderGoblin
Couple of things...
Try echoing the SQL command your page creates. This frequently shows the problem (could be a quote in the text for instance. Try copying this information directly into the database and examine any error messages. This should help you.

2nd MAJOR problem.
Do you perform any validation of the text. Never trust data sent through POST or GET without validating it first. (Look up SQL Injection to see why).