Problem with Update statement

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!

Moderator: General Moderators

Post Reply
bazjones
Forum Newbie
Posts: 6
Joined: Mon Dec 13, 2004 8:47 am
Location: middlesborough

Problem with Update statement

Post 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>");
?>
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post 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).
Post Reply