>>Applying all these things your line should look like this: >>$sql = "UPDATE wo SET status = 1 WHERE ticket = {$_POST['ticketed']}";
$_POST['ticketed'] : this is not an array but value isn't it ? .b -----Original Message----- From: Chris W. Parker [mailto:[EMAIL PROTECTED] Sent: 09 October 2003 17:08 To: Davy Campano; [EMAIL PROTECTED] Subject: RE: [PHP] problem transferring a variable using POST Davy Campano <mailto:[EMAIL PROTECTED]> on Thursday, October 09, 2003 8:57 AM said: > This statement works: > $sql = 'UPDATE wo SET status = 1 WHERE ticket = 1' > > This statement does not: > $sql = 'UPDATE wo SET status = 1 WHERE ticket = > $HTTP_POST_VARS[ticketed]' > > Any suggestions... > > If I do "echo "$HTTP_POST_VARS[ticketed]"; > It returns a 1 First of all you should be using $_POST and not $HTTP_POST_VARS (that is of course if your version of php supports it). Secondly, it's not working because (1) you are wrapping the sql statement in single quotes which does not evaluate variables, it's a string literal. You should change all those ' to ", and (2) arrays are treated differently than regular variables inside a string. They MUST be wrapped with { } to be evaluated. Third, it's a bad practice to not properly quote your array references. In other words, the word ticketed should have single quotes around it. Applying all these things your line should look like this: $sql = "UPDATE wo SET status = 1 WHERE ticket = {$_POST['ticketed']}"; hth. chris. p.s. it's a Very Bad Idea(tm) to grab data directly from $_GET or $_POST and put it to work before doing any validation on it. p.p.s. I'm not positive about this but I'd be willing to bet that every value gathered from $_GET or $_POST is considered a string and not numeric. Think about it, how would $_POST know that "ticketed" is meant to be an integer or a string? -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php