|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Me again! I am trying to create a currency converter function for my
eCommerce that still pet treats. I am a little short on money recently and so cannot afford a programmer. Can somebody tell me why my script tells me that I have a syntax error on the "CONST" line. I am trying to follow the article below. Article: http://www.talkphp.com/showthread.php?t=1503 The error I get is: Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION'... My server is CentOS 4 or 5, I forget which, running PHP 4.1.0 with MySQL 5, I think. The line that it shows me the error on is: const OPT_FILE = 'talkphp_conversion_rates.json'; Please ! Also, somebody mentioned something about cross-posting on newsgroups so that I can post to more than 1 group in case I do not get a good answer in 1. Could somebody tell me how to do this with Google Groups please!! Thannk you. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
adam.timberlake@gmail.com wrote:
> Me again! I am trying to create a currency converter function for my > eCommerce that still pet treats. I am a little short on money recently > and so cannot afford a programmer. Can somebody tell me why my script > tells me that I have a syntax error on the "CONST" line. I am trying > to follow the article below. > > Article: http://www.talkphp.com/showthread.php?t=1503 > > The error I get is: > > Parse error: parse error, expecting `T_OLD_FUNCTION' or > `T_FUNCTION'... > > My server is CentOS 4 or 5, I forget which, running PHP 4.1.0 with > MySQL 5, I think. The line that it shows me the error on is: > > const OPT_FILE = 'talkphp_conversion_rates.json'; > 'const' is not a valid PHP keyword. Maybe you want: define('OPT_FILE', 'talkphp_conversation_rates.json'); But not having the rest of your code, it's hard to tell. > Please ! Also, somebody mentioned something about cross-posting on > newsgroups so that I can post to more than 1 group in case I do not > get a good answer in 1. Could somebody tell me how to do this with > Google Groups please!! > I have no idea how to do it through GG - get yourself a real newsreader. Your ISP most probably has access to usenet. It's much better. > Thannk you. > -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
adam.timberlake@gmail.com wrote:
> My server is CentOS 4 or 5, I forget which, cat /etc/issue That should tell you a bit about which version you are using > running PHP 4.1.0 with > MySQL 5, I think. The line that it shows me the error on is: This makes me believe it's NOT CentOS5. > const OPT_FILE = 'talkphp_conversion_rates.json'; > Parse error: parse error, expecting `T_OLD_FUNCTION' or > `T_FUNCTION'... const can only be used in a class, so <?PHP const OPT_FILE = 'talkphp_conversion_rates.json'; ?> will genereate your error message <?PHP class something { const OPT_FILE = 'talkphp_conversion_rates.json'; } ?> This would be ok. If you want to use a "constatn" outside a class, you have to use define as Jerry suggested. -- //Aho |
|
![]() |
| Outils de la discussion | |
|
|