Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding on top of an existing variable...

Status
Not open for further replies.

youradds

Programmer
Joined
Jun 27, 2001
Messages
817
Location
GB
Hi. I'm trying to add another value onto a variable. I currently have;

// check if the thing we have
if ($_sliced_cats == "wedding") {

$wedding .= &quot;<tr><td vAlign=\&quot;top\&quot; bgColor=\&quot;#FFFFFF\&quot;><font face=\&quot;arial,helvetica\&quot; size=\&quot;2\&quot;>$sliced_titles[$count]</font><font class=\&quot;text\&quot; face=\&quot;arial,helvetica\&quot; size=\&quot;2\&quot;>  <br> </font></td><td vAlign=\&quot;top\&quot; bgColor=\&quot;#FFFFFF\&quot;><font class=\&quot;text\&quot; face=\&quot;arial,helvetica\&quot; size=\&quot;2\&quot;>$dropdown</font></td> <td vAlign=\&quot;top\&quot; bgColor=\&quot;#FFFFFF\&quot;> <font class=\&quot;text\&quot; face=\&quot;arial,helvetica\&quot; size=\&quot;2\&quot;>£ $sliced_ourest[$count]</font></td> <td vAlign=\&quot;top\&quot; bgColor=\&quot;#FFFFFF\&quot;> <font class=\&quot;text\&quot; face=\&quot;arial,helvetica\&quot; size=\&quot;2\&quot;>£ <input size=\&quot;5\&quot; value=\&quot;$sliced_theirest[$count]\&quot; name=\&quot;your_estimate[$count]\&quot;> </font></td> <td vAlign=\&quot;top\&quot; width=\&quot;64\&quot; bgColor=\&quot;#FFFFFF\&quot;> <font class=\&quot;text\&quot; face=\&quot;arial,helvetica\&quot; size=\&quot;2\&quot;>£ <input size=\&quot;5\&quot; value=\&quot;$sliced_actualcost[$count]\&quot; name=\&quot;your_actual[$count]\&quot;> </font></td>&quot;;
$wedding_actual =+ your_actual[$count];
$wedding_their =+ your_estimate[$count];
$wedding_estinate =+ sliced_ourest[$count];

}

This gives a parse error. I'm assuming it has something to do with the =+ , as it seems to disappear when I get rid of them. Is there a function that would do the following;

$wedding == 50;
$wedding_actual = $wedding_actual + $wedding;
echo &quot;\$wedding_actual => $wedding_actual&quot;;

Cheers

Andy
 
The operator you are looking for is [tt]+=[/tt].

//Daniel
 
Tried that already (as in Perls function)...gives;


Parse error: parse error in /home/askweddi/public_html/a/budget_planner.inc on line 101

Any other ideas? :-/

Cheers

Andy
 
Do you have the dollar signs before those arrays in the real code?

//Daniel
 
No. It is just a figure like 4.50 , 4, 6.70 etc.

Cheers

Andy
 
>>>Do you have the dollar signs before those arrays in the real code? <<<

OMG...it was the missing $$$'s. How stupid I feel now!

Cheers

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top