Good Morning,
This may be a simple yes or no, or hopefully if it is a no, someone can tell me how to work around it.
I have a table that includes 4 columns named the same with incremented numbers in the names
step1 / step2 / step3 / step4
I have a function in an obscure/remote place that I can't see the results of while it is being run, but don't seem to be getting the update that I expect from it.
I'm wondering if the structure of the update query is causing the problem or if I need to look somewhere else.
I'm trying to set the 'name' of the field to be updated through using a variable assigned in a switch case scenario.
// #################################################
// UPDATE earned date for step1 - step4 in rewards prime
switch($prime_reward_step){
case 1:
$step_value = 'step1';
break;
case 2:
$step_value = 'step2';
break;
case 3:
$step_value = 'step3';
break;
default:
$step_value = 'step4';
break;
}
$sql_u = "
UPDATE rewards_prime
SET ".$step_value."='".$created."'
WHERE pid='".$prime_reward_pid."'
";
mysql_query($sql_u);
// #################################################
everything up before this point works, and the values assigned and updated, but not this one.
I'd like to know if using the $step_value as the column name is an acceptable format, and if not what would be a reasonable way to work around it.
thanks
Douglas