473,396 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Bizarre problem when trying to write to a csv

2
I'm obtaining a weird message when I try to add the capability to write to a csv file into the formmail script that I'm using. Everything is fine initially and the email comes through to me perfectly from the simple HTML form I've designed. However, when I add the path to the CSV directory into the appropriate section in the php script being called, I get the following when I run the script:

Parse error: parse error, unexpected ';' in /home/myaccount/public_html/suggest/Feedback.php on line 5439


The $CSVDIR section looks like this:

Expand|Select|Wrap|Line Numbers
  1. $CSVDIR = "/home/myaccount/public_html/csvdir";                        // directory for csv files; empty string to
  2.                                     // disallow csv files
  3. $CSVSEP = ",";        // comma separator between fields (columns)
  4. $CSVINTSEP = ";";    // semicolon is the separator for fields (columns)
  5.                     // with multiple values (checkboxes, etc.)
  6. $CSVQUOTE = '"';    // all fields in the CSV are quoted with this character;
  7.                     // default is double quote.  You can change it to
  8.                     // single quote or leave it empty for no quotes.
  9. //$CSVQUOTE = "'";    // use this if you want single quotes
  10. $CSVOPEN = "";        // set to "b" to force line terminations to be
  11.                     // kept as $CSVLINE setting below, regardless of
  12.                     // operating system.  Keep as empty string and
  13.                     // leave $CSVLINE unchanged, to get text file
  14.                     // terminations for your server's operating system.
  15.                     // (Line feed on UNIX, carriage-return line feed on Windows).
  16. $CSVLINE = "\n";    // line termination for CSV files.  The default is
  17.                     // a single line feed, which may be modified for your
  18.                     // server's operating system.  If you want to change
  19.                     // this value, you *must* set $CSVOPEN = "b".

The section giving the error looks like this with the "if" part being Line 5439:

Expand|Select|Wrap|Line Numbers
  1. {
  2.     global    $TARGET_URLS;
  3.  
  4.     foreach ($TARGET_URLS as $s_prefix)
  5.         if (!empty($s_prefix) &&
  6.                 strtolower(substr($s_url,0,strlen($s_prefix))) ==
  7.                 strtolower($s_prefix))
  8.             return (true);
  9.     return (false);
  10. }

I don't know what's wrong with this. More bizarrely, when I remove this CSV modification and revert to the original script, this error stays! I'm not a programmer so I'm a bit stuck here. I'm just trying to use the script as an "out-of-the-box" solution.

Any help greatly appreciated.

Dave
Aug 27 '07 #1
3 1668
mwasif
802 Expert 512MB
Replace && with && in the below code.
[PHP]if (!empty($s_prefix) &&
strtolower(substr($s_url,0,strlen($s_prefix))) ==
strtolower($s_prefix))[/PHP]
It will become
[PHP]if (!empty($s_prefix) &&
strtolower(substr($s_url,0,strlen($s_prefix))) ==
strtolower($s_prefix))[/PHP]
Aug 27 '07 #2
compuv
2
Thank you.

I think I see what's happened here. I opened the PHP file in a web editing program and it appears to have put all these wacky characters in as replacements for &, ", <, >. It doesn't look like it was anything to do with the script at all. Looks like some painstaking editing with Notepad is looming! Thanks again for your help.

Dave
Aug 27 '07 #3
pbmods
5,821 Expert 4TB
Heya, Dave.

I award 15 points for creative use of [b] tags. However, I have to deduct 15 points for not using [code] tags.

Better luck next time.

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.
Aug 28 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Alan Little | last post by:
This is very bizarre. Could someone else have a look at this? Maybe you can see something I'm overlooking. Go here: http://www.newsletters.forbes.com/enews/admin/deliver.php4 U: bugtest P:...
11
by: Frances Del Rio | last post by:
this is so bizarre, and don't even know if this is right place to ask, but don't know where else: about two days I changed webhosting, changed DNS for my domain, francesdelrio.com, now when I...
36
by: Rolloffle | last post by:
A short time ago my fiancée Kimmy found out that she had gotten pregnant. We had a long, hard talk about what to do, if anything. I was in favour of her getting an abortion, though she was...
1
by: Richard | last post by:
Here's a Bizarre one: I have a C# service program. The service registers and runs fine on one machine but when I copy the EXE to a second machine and try to use InstallUtil to register the...
1
by: Michael Carr | last post by:
I have created a website that responds to the following two domain names: logintest.carr-engineering.com logintest.onualumni.org If you open either of these websites on their own, everything...
26
by: the.tarquin | last post by:
Okay, this one has me totally baffled. I have a function, getParsedKey(char* key, char* returnString). I pass in the key I want, it retrieves it from a data structure and puts the value in...
3
by: jethro_uk | last post by:
Hi all, I'm having a hard time with the Day() function. Basically, it appears to be picking and choosing which part of a date string it uses to return the result ... heres some code : ...
9
by: ckfan.painter | last post by:
I've run into a seemingly bizarre problem with insert() for std::vector. (This was done on Microsoft Visual C++ 2005 express version 8...maybe it is a compiler specific bug?) Here's the code: ...
3
by: Peter | last post by:
Hi! I am having some very strange behavior with my databound controls. It's taken a long time to isolate exactly what is provoking the problem, but I'm still leagues away from solving it. I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.