Help Unexecpted TString/T Variable

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
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Help Unexecpted TString/T Variable

Post by darkfreaks »

it says unexcpected t string or variable. on line 18 ill post the codes in and around that line. hopefully someone here can point out my syntax mistake.
8O

$qty = 0;
$totalamount = 0.00;

$totalqty = $NNSQTY+$CBFNQTY+$AKNQTY+$CFNQTY+$CVNQTY

$totalamount = $NNSQTY* Necklace of the Night Sky
+$CBFNQTY* Chainmaile Beaded Fancy Necklace
+$AKNQTY* Antique Key Necklace
+$CFNQTY* Chainmaile Fancy Necklace
+$CVNQTY* Chainmaile V Necklace
User avatar
GeertDD
Forum Contributor
Posts: 274
Joined: Sun Oct 22, 2006 1:47 am
Location: Belgium

Post by GeertDD »

Check the semicolons.

Note that you should use

Code: Select all

tags around the code.[/size]
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Post by darkfreaks »

i did use php tags and i think it wants a semicolon somewhere before or after where it adds up everything. just not sure where.
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Post by darkfreaks »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


i edited it abit

Code: Select all

< ?PHP

$qty = 0; 
$totalamount = 0.00; 

$totalqty = $NNSQTY+$CBFNQTY+$AKNQTY+$CFNQTY+$CVNQTY ;

$totalamount = $NNSQTY* Necklace of the Night Sky 
+$CBFNQTY* Chainmaile Beaded Fancy Necklace 
+$AKNQTY* Antique Key Necklace 
+$CFNQTY* Chainmaile Fancy Necklace 
+$CVNQTY* Chainmaile V Necklace;

?>
now it gives me unexected t string on line 18. 8O


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
GeertDD
Forum Contributor
Posts: 274
Joined: Sun Oct 22, 2006 1:47 am
Location: Belgium

Post by GeertDD »

Is the text at the end of the last lines (e.g. "Necklace of the Night Sky") supposed to be comments?
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

The code you have posted is not even close to being valid..


For instance, here is your code:

Code: Select all

<?PHP 

$qty = 0; 
$totalamount = 0.00; 

$totalqty = $NNSQTY+$CBFNQTY+$AKNQTY+$CFNQTY+$CVNQTY ; 

$totalamount = $NNSQTY* Necklace of the Night Sky 
+$CBFNQTY* Chainmaile Beaded Fancy Necklace 
+$AKNQTY* Antique Key Necklace 
+$CFNQTY* Chainmaile Fancy Necklace 
+$CVNQTY* Chainmaile V Necklace; 

?>
#1, $totalamount is being set to a bunch of multiplication statments and text, all bunched into one.

Code: Select all

$totalamount = $NNSQTY* Necklace of the Night Sky 
+$CBFNQTY* Chainmaile Beaded Fancy Necklace 
+$AKNQTY* Antique Key Necklace 
+$CFNQTY* Chainmaile Fancy Necklace 
+$CVNQTY* Chainmaile V Necklace;
There is no way that is valid unless you are using the DEFINE statement that you aren't showing us.

instead, $totalamount is only valid if it looks like this

Code: Select all

<?php
$Necklace_of_the_Night_Sky = 123123123;
$Chainmaile_Beaded_Fancy_Necklace = 123123123123;
$Antique_Key_Necklace = 123123123123;
$Chainmaile_Fancy_Necklace = 123123123123;
$Chainmaile_V_Necklace = 123123123123;
$totalamount = $NNSQTY * $Necklace_of_the_Night_Sky + $CBFNQTY * $Chainmaile_Beaded_Fancy_Necklace + $AKNQTY * $Antique_Key_Necklace + $CFNQTY * $Chainmaile_Fancy_Necklace + $CVNQTY * $Chainmaile_V_Necklace; 

?>
or this :

Code: Select all

<?php
DEFINE(Necklace_of_the_Night_Sky, 123123123);
DEFINE(Chainmaile_Beaded_Fancy_Necklace, 123123123123);
DEFINE(Antique_Key_Necklace,123123123123);
DEFINE(Chainmaile_Fancy_Necklace, 123123123123);
DEFINE(Chainmaile_V_Necklace, 123123123123);
$totalamount = $NNSQTY * Necklace_of_the_Night_Sky + $CBFNQTY * Chainmaile_Beaded_Fancy_Necklace + $AKNQTY * Antique_Key_Necklace + $CFNQTY * Chainmaile_Fancy_Necklace + $CVNQTY * Chainmaile_V_Necklace; 

?>
That's it.
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Post by darkfreaks »

everything was defined in the code above it with the price. so i just have to redo it with everything added up under total amount instead of having it at 0.
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Post by darkfreaks »

it works now that i put the underscores for spaces :) now im missing a opening ( somewhere in the following line
<?PHP
if mail('mowtripleh@hotmail.com',"From: $name <$email>","Total Amount:$totalamount","Quantity Ordered:$qty") ?>
darkfreaks
Forum Commoner
Posts: 59
Joined: Sat Sep 09, 2006 3:59 pm

Post by darkfreaks »

nvm found it there needs to be an extra ) after ) and an extra ( before mail.
Post Reply