Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error after moving code from Linux to Win32 1

Status
Not open for further replies.

cutley

Programmer
Jan 8, 2003
17
US
I'm having a difficult time figuring out what PHP setting is causing this problem to crop up when I moved an application from a Linux box to a Windows XP machine.

On my Linux box, I accessing them like so:
echo $row[last];

This same code on my XP box generates this error:
Notice: Use of undefined constant last - assumed 'last' in C:\Program Files\Apache Group\Apache2\htdocs\testdb.php on line 14

So I changed the code on the XP box to:
echo $row['last'];

No more error. So I have a few questions. First, is what I was doing on my Linux box poor style, perhaps even invalid code that somehow slips through? Also, is there a setting I can change on the XP box in my php.ini file that would allow the code from the Linux box to run as-is?

 
Yes this is bad coding.

a string of text is usually a constant value

define(YES,TRUE);
define(NO,FALSE);

will define YES as TRUE and NO as FALSE.

So placing the references in quotes works, as without this PHP expects a constant value giving you the error you mentioned
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top