473,808 Members | 2,852 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bizarre problem when trying to write to a csv

2 New Member
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 1691
mwasif
802 Recognized Expert Contributor
Replace && with && in the below code.
[PHP]if (!empty($s_pref ix) &&a mp;
strtolower(subs tr($s_url,0,str len($s_prefix)) ) ==
strtolower($s_p refix))[/PHP]
It will become
[PHP]if (!empty($s_pref ix) &&
strtolower(subs tr($s_url,0,str len($s_prefix)) ) ==
strtolower($s_p refix))[/PHP]
Aug 27 '07 #2
compuv
2 New Member
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 Recognized Expert Expert
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
2173
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: test Enter 1 for "How many files in this delivery?" and select a file to upload, in one of the listed formats. Scroll down and click "Test Email".
11
1745
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 view my site, www.francesdelrio.com from work it looks fine, just like it should (black bg, a bunch of links in green fonts sitting on a green-tone graffiti-graphic..) and all links work.. but: when I view it from home it takes me to old server!!...
36
1977
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 initially reluctant. After a short discussion, we came to a mutual agreement; I arranged a private appointment at our local clinic. I tagged along with Kim for moral support. After registering at reception and sitting around for a few minutes, a nurse...
1
1307
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 service on the second machine it bails out with: "No publicly exported Installers with RunInstaller attribute set to Yes" This is bizarre since the EXE does register on one machine. I checked and I am an Administrator on the target install machine...
1
1354
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 works fine. However, if you open both of them simultaneously in two frames of a frameset, wierdness ensues. To demonstrate this, open the following link: http://logintest.onualumni.org/frametest.htm
26
2336
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 returnString. The problem is that returnString points to the correct value in the function, but after the function has finished, the string that it points to is empty. ..... char* radioList = NULL; ini->getParsedKey("Radio",radioList);
3
1478
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 : <HTML> <HEAD>
9
6552
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: //=================== // vector tester 3.cpp : main project file.
3
1890
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 have a DataView which filters a DataSet. Bound to this dataview is a ListBox, via its DataSource property. The DisplayMember is the name property of the row. Simple enough so far?
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10628
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10373
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10113
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9195
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5547
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.