|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
What the hell!?
I *keep* getting stupid errors like this, and I've no idea what's causing them. Am I following some bad coding practice? Anyway, the error is as follows:
Quote:
The actual code of that page is only this: PHP Code:
Unless I'm really dumb, I can't see a problem with it. I'm using Apache 2.0.4.3, PHP 4.30RC3 It happens no matter what variable I declare etc, so any help would be massively appreciated (as this is causing problems in any frickin script I write) ![]() |
|
#2
|
|||
|
|||
|
Re: What the hell!?
Quote:
Looks like PHP is seeing simon as a constant. First off, you never defined the constant if that's what you intented. Or if you want the username to be simon it should be $username="simon"; to define a constant PHP Code:
All constants should be upper, but you can get around that. |
|
#3
|
|||
|
|||
|
Well, hrm, I don't want it to be a constant, it should be variable, though doesn't PHP work such that:
PHP Code:
works such that if the variable does exist, it is assigned the value, and if it doesn't, it is initialised and then assigned the value? If that's so, I shouldn't be getting errors from that code, right? |
|
#4
|
|||
|
|||
|
Quote:
Surround the value of the variable in quotes -> $somevariable = 'somevalue'; Without quotes php will think you are asigning the value of a constant to that variable.....
__________________
~ Joe Penn We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set? Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you. |
|
#5
|
|||
|
|||
|
if you asign a string to a variable it MUST be encase in quotes otherwise PHP things the string is a constant.
|
|
#6
|
|||
|
|||
|
Is there an echo in here?
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > What the hell!? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|