Hi,

Friday, October 10, 2003, 1:56:43 AM, you wrote:
DC> I am having a problem with a form.  I am trying to have a form pass a
DC> variable so that I can update an item.  I think the problem is that the
DC> variable (ticketed) is being read as text instead of a number.  These
DC> are the tests I have run.  
 
DC> This statement works:
DC> $sql = 'UPDATE wo SET status = 1 WHERE ticket = 1'
 
DC> This statement does not:
DC> $sql = 'UPDATE wo SET status = 1 WHERE ticket =
DC> $HTTP_POST_VARS[ticketed]'
 
DC> Any suggestions...
 
DC> If I do "echo "$HTTP_POST_VARS[ticketed]"; 
DC> It returns a 1

if you put variables in the string you need to use double quotes to get PHP to
do the substitution or get out of the string and use the dot operator.

$sql = "UPDATE wo SET status = 1 WHERE ticket = $HTTP_POST_VARS[ticketed]";
$sql = 'UPDATE wo SET status = 1 WHERE ticket = '.$HTTP_POST_VARS[ticketed];

The other good habit is to put the value in single quotes:

$sql = "UPDATE wo SET status = 1 WHERE ticket = '$HTTP_POST_VARS[ticketed]'";
$sql = "UPDATE wo SET status = 1 WHERE ticket = '".$HTTP_POST_VARS[ticketed]."'";

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to