I started with the following code in an included file:
$CompanyBlock =
"$Company (Booth#: $Booth)\n".
"$Address\n ".
"$City, $State $PostalCode\n".
"$Website\n ".
"$Contact1, $Title1\n".
"Tel: $Phone\n".
"Fax: $Fax\n".
"Email: $Email1\n".
"Products/Services: $ProductService \n".
"Objectives : ";
I wanted to make some of the items conditional, but in so doing, I forgot
to change some of the . to ; and ended up with:
$CompanyBlock = $Company;
if ($Booth) $CompanyBlock.= " (Booth#: $Booth)";
$CompanyBlock.=
"\n".
"$Address\n ".
"$City, $State $PostalCode\n";
if ($Website) $CompanyBlock.= "$Website\n ";
if ($Contact1) $CompanyBlock.= "$Contact1" ;
if ($Title1) $CompanyBlock.= ", $Title1"; $CompanyBlock.= "\n";
if ($Phone) $CompanyBlock.= "Tel: $Phone\n".
if ($Fax) $CompanyBlock.= "Fax: $Fax\n".
if ($Email1) $CompanyBlock.= "Email: $Email1\n".
if ($ProductServic e)
$CompanyBlock.= "Products/Services: $ProductService \n".
$CompanyBlock.= "Objectives : ";
The result? The file returns with no execution, not even of code before
the problem, and with no error message, not so much as a notice. It took
me a good while to narrow it down and spot the problem (there's quite a
bit of code before this in the file). I knew the file was being called,
but even an echo statement at the very beginning produced no output. The
execution of the main script was not affected.
I thought this might save someone else a bit of time if they happen to
have the same problem.
--
Alan Little
Phorm PHP Form Processor http://www.phorm.com/ 8 1455
Alan Little wrote: I started with the following code in an included file:
$CompanyBlock = "$Company (Booth#: $Booth)\n". "$Address\n ". "$City, $State $PostalCode\n". "$Website\n ". "$Contact1, $Title1\n". "Tel: $Phone\n". "Fax: $Fax\n". "Email: $Email1\n". "Products/Services: $ProductService \n". "Objectives : ";
I wanted to make some of the items conditional, but in so doing, I forgot to change some of the . to ; and ended up with:
$CompanyBlock = $Company; if ($Booth) $CompanyBlock.= " (Booth#: $Booth)";
$CompanyBlock.= "\n". "$Address\n ". "$City, $State $PostalCode\n";
if ($Website) $CompanyBlock.= "$Website\n "; if ($Contact1) $CompanyBlock.= "$Contact1" ; if ($Title1) $CompanyBlock.= ", $Title1"; $CompanyBlock.= "\n"; if ($Phone) $CompanyBlock.= "Tel: $Phone\n". if ($Fax) $CompanyBlock.= "Fax: $Fax\n". if ($Email1) $CompanyBlock.= "Email: $Email1\n". if ($ProductServic e) $CompanyBlock.= "Products/Services: $ProductService \n".
$CompanyBlock.= "Objectives : ";
The result? The file returns with no execution, not even of code before the problem, and with no error message, not so much as a notice. It took me a good while to narrow it down and spot the problem (there's quite a bit of code before this in the file). I knew the file was being called, but even an echo statement at the very beginning produced no output. The execution of the main script was not affected.
I thought this might save someone else a bit of time if they happen to have the same problem.
Sorry, I think you code in a weird way..
What do you expect from if($varname) ?
Does your script rely on registerglobals = on?
Of course I cannot see the rest of your setup, so maybe I am talking bull.
;-)
Regards,
Erwin Moller
Carved in mystic runes upon the very living rock, the last words of
Erwin Moller of comp.lang.php make plain: The result? The file returns with no execution, not even of code before the problem, and with no error message, not so much as a notice. It took me a good while to narrow it down and spot the problem (there's quite a bit of code before this in the file). I knew the file was being called, but even an echo statement at the very beginning produced no output. The execution of the main script was not affected.
I thought this might save someone else a bit of time if they happen to have the same problem. Sorry, I think you code in a weird way..
Perhaps, but it has no bearing on the issue. That is, if I used isset()
instead, perhaps it wouldn't tickle this particular bug, but it is in
fact a bug. Which reminds me, I should report it.
What do you expect from if($varname) ?
I expect PHP to tell me if it has a problem. While if ($var) may not be
ideal coding practice, it is legal.
--
Alan Little
Phorm PHP Form Processor http://www.phorm.com/
If you checked the php error log it would have printed out something
like:
[27-Nov-2005 16:04:12] PHP Parse error: syntax error, unexpected T_IF
in etc......
i.e.
if ($Phone) $CompanyBlock.= "Tel: $Phone\n".
if ($Fax) $CompanyBlock.= "Fax: $Fax\n".
if ($Email1) $CompanyBlock.= "Email: $Email1\n".
Take this section of code, your concatenating IF statements like
strings so of course it's not going to work.
You should start by going to http://www.php.net/manual/en/
Alan Little wrote: Perhaps, but it has no bearing on the issue. That is, if I used isset() instead, perhaps it wouldn't tickle this particular bug, but it is in fact a bug. Which reminds me, I should report it.
It's not a bug, it's illegal code. You can't terminate a line with a
dot, and you can't concatenate an if statement into a string. It
produces a parse error and stops execution. If you don't get an error
message it is because of your settings. It is still an error, though. What do you expect from if($varname) ?
I expect PHP to tell me if it has a problem. While if ($var) may not be ideal coding practice, it is legal.
Legal, yes. Useful in this situation, no. What you are saying in effect
is "if the website name can be converted to a non-zero number, then..."
I don't mean to give offence, but you should consider coding like other
people do, at least until you understand the consequences of not doing
so.
Ian
Carved in mystic runes upon the very living rock, the last words of Ian
B of comp.lang.php make plain: Alan Little wrote: Perhaps, but it has no bearing on the issue. That is, if I used isset() instead, perhaps it wouldn't tickle this particular bug, but it is in fact a bug. Which reminds me, I should report it. It's not a bug, it's illegal code. You can't terminate a line with a dot,
Sure you can, unless you mean you can't terminate a statement with a
dot. Nothing wrong with terminating a line with a dot, if your intention
to to concatenate whatever's on the next line.
and you can't concatenate an if statement into a string.
Of course. As mentioned originally, I inserted the if's, and forgot the
change the appropriate dots to semicolons.
It produces a parse error and stops execution.
It does neither. No error, and execution resumes in the main code (this
was in an included file).
If you don't get an error message it is because of your settings.
error_reporting = E_ALL > What do you expect from if($varname) ?
I expect PHP to tell me if it has a problem. While if ($var) may not be ideal coding practice, it is legal.
Legal, yes. Useful in this situation, no. What you are saying in effect is "if the website name can be converted to a non-zero number, then..."
I understand. And it is useful in this situation. It basically is a
shortcut of if(strlen(trim( $Website)))
I don't mean to give offence,
None taken.
you should consider coding like other people do, at least until you understand the consequences of not doing so.
Well, I do understand exactly what the code is doing, but to be honest I
don't believe I've heard all the arguments against using it; I just know
there are some.
--
Alan Little
Phorm PHP Form Processor http://www.phorm.com/
Carved in mystic runes upon the very living rock, the last words of Sean
of comp.lang.php make plain: If you checked the php error log it would have printed out something like:
[27-Nov-2005 16:04:12] PHP Parse error: syntax error, unexpected T_IF in etc......
Assuming error logging is on, which it isn't in this case, but error
reporting is, and there was no error.
if ($Phone) $CompanyBlock.= "Tel: $Phone\n". if ($Fax) $CompanyBlock.= "Fax: $Fax\n". if ($Email1) $CompanyBlock.= "Email: $Email1\n".
Take this section of code, your concatenating IF statements like strings so of course it's not going to work.
I understand that. As stated in my original post, the code was initially
a single block of concatenation; I added the if's, and forgot to change
the appropriate dots to semicolons.
You should start by going to http://www.php.net/manual/en/
Gosh, a whole new world of enlightenment I hadn't seen before!
--
Alan Little
Phorm PHP Form Processor http://www.phorm.com/
Its display_errors in the php.ini which needs to be turned on that
displays errors as part of the output.
Carved in mystic runes upon the very living rock, the last words of Sean of
comp.lang.php make plain: Its display_errors in the php.ini which needs to be turned on that displays errors as part of the output.
Ah yes, that's turned off. It's still odd that it would continue execution
of the main code though, with a parse error in the included file. Even with
display_errors off, that is not the normal behavior.
Oh well.
--
Alan Little
Phorm PHP Form Processor http://www.phorm.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: redneck_kiwi |
last post by:
Hi all:
I have a really weird problem. I am developing a customer catalog
system for my company and as such have delved into sessions for
authentication and access levels. So far, I have managed to get a
working system just about finished.
I am building an interface for our customer service folks to use to
manage registered customers and am seeing some weird behavior.
|
by: newgene |
last post by:
Hi, group,
A weird clipboard behavior for your help:
==============Code==============
from Tkinter import *
import tkMessageBox
root=Tk()
root.withdraw()
root.clipboard_clear()
|
by: python newbie |
last post by:
hey,
okay, I'm trying to figure out why my books: Quick Python, Python in a
Nutshell, Python Cookbook and Learning Python don't say anything about the
weird behavior of a list when you have one as an object instance member.
for instance (my first pun of 2004), if I have,
test.py
----------------
|
by: ThunderMusic |
last post by:
Hi,
I'm trying to have a MSN Messenger like form/app closing behavior. When I
click on the X button, I only want the form to disappear and when I
double-click on the notify icon or right-click on it and choose Open from
the context menu, I want the form to reappear. For that, I got the point
covered. Even when the form is minimize, the behavior is like MSN Messenger.
But one problem arose. When I close the form (the first time), it...
|
by: Shaul Feldman |
last post by:
Hello,
I have a couple of things:
1)
a page contains a button that has some JS code attached to it
programmatically.
Also the page loads a web user control with LoadControl method. In UC I
have a text box where user can type some text. The weird behavior is that
when user presses enter in UC textbox, the postback of the page occurs AND
the JS code attached to the button is running ...
why does it happen? Help anyone?
| |
by: XYZ |
last post by:
I need to pass the address of a variableto some win32 API functions like
RTLMoveMemory
I noticed some weird behavior when pinning objects and using the handle's
pointer to write data to the memory location.
it seems as if after pinning an object the memory and the object are not
updated at the same time anymore
|
by: Pupeno |
last post by:
Hello,
I am experiencing a weird behavior that is driving me crazy. I have module
called Sensors containing, among other things:
class Manager:
def getStatus(self):
print "getStatus(self=%s)" % self
return {"a": "b", "c": "d"}
and then I have another module called SensorSingleton that emulates the
|
by: elias.farah |
last post by:
Hello Everyone,
I'm having some very weird behavior on a couple of Access forms. (Not
all forms, just some of them).
The forms have been working for years, under Access XP/2003 etc, and
last week upgraded from Windows XP/Office 2003 to Vista x64/Office
2007.
Under Access 2007, a couple of forms are now taking 60 seconds to
|
by: =?Utf-8?B?TU5C?= |
last post by:
Hi there!
We are near the ending stage of an ASP.NET + IIS project, and started doing
stress testing on the servers. We find ourselves with a very strange
behavior, that can’t figure out since several days ago. Hitting the websites
with 500 user clicks every 1 second, in ANY of the interior pages (those are
not the default one), takes the ASP.NET process to about 80% of CPU usage. If
instead we just go to the root, the CPU doesn’t...
|
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...
|
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...
| |
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |