473,221 Members | 1,806 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,221 software developers and data experts.

Bizarre problem when trying to write to a csv

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;
  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.

Aug 27 '07 #1
3 1661
802 Expert 512MB
Replace && with && in the below code.
[PHP]if (!empty($s_prefix) &&
strtolower(substr($s_url,0,strlen($s_prefix))) ==
It will become
[PHP]if (!empty($s_prefix) &&
strtolower(substr($s_url,0,strlen($s_prefix))) ==
Aug 27 '07 #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.

Aug 27 '07 #3
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

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:...
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...
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...
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...
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...
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...
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 : ...
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: ...
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...
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.