p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: userviewer.php / chapter 12: Undefined variable: action in c:\inetpub\wwwroot\userviewer.php on line 246


Message #1 by "Anonymous" on Wed, 23 Jan 2002 21:52:22
Hello,





I am having problem running my script for reading information from 

database in chapter 12 under userviewer.php file.



I have also tried downloading original source code from the website, but 

error persists.



Running XP with IIS.



I first get IE error message window stating:

---------------------------------------------

Runtime Error: Unterminated String Constant.

---------------------------------------------



Then above the table displayed in browser, message:

---------------------------------------------

Warning: Undefined variable: action in c:\inetpub\wwwroot\userviewer.php 

on line 246

---------------------------------------------



If I try to click on "View Record" I get this message:

---------------------------------------------

Object Expected

---------------------------------------------



These errors occured when using original source code downloaded from WROX 

website.



If anybody knows how can I fix this, I would appreciate if you could drop 

me a line.





Message #2 by ""Anonymous" on Sun, 27 Jan 2002 22:07:39
I had exactly the same two problems, also running Win XP and IIS.



The first problem I solved by going into the file common_db.inc and 

changing the code from line 25 onwards as follows:



NEW_WIN = window.open ("", "RecordViewer", 

	  		toolbar="no", 

			width="<?php echo $new_win_width ?>", 

			height="<?php echo $new_win_height?>", 

			directories="no", 

			status="no", 

			scrollbars="yes", 

			resize="no", 

			menubar="no");



You could also put it all in one line.  The script now seems to work 

okay, but the warning message about the undefined variable: action on 

line 246 is still there.



Somebody please help!
Message #3 by "Anonymous" on Sun, 27 Jan 2002 22:47:33
Okay, I've found a solution.  



Go to your php.ini file (should be in your Windows directory).  Find the 

line "error_reporting= ..." and change it to:

"error_reporting=7"



For an explanation why this works, look at p.53 of the PHP manual (the 

pdf version).



Regards,

Anton

Message #4 by "Anonymous" on Mon, 28 Jan 2002 12:26:00
Hello,





Thank you for answering.



The problem is Javascript. It should be lined (in only one line). It looks 

like PHP or IE doesn't like it broken in few lines.
Message #5 by "Anonymous" on Mon, 28 Jan 2002 09:35:54 -0800

I wouldn't use numbers... the php.ini file lists a bunch of names for their

integer codes.



You should use E_ALL & ~E_NOTICE.



> -----Original Message-----

> From: "Anonymous" Sent: Sunday, January 27, 2002 10:48 PM

> To: beginning php

> Subject: [beginning_php] Re: userviewer.php / chapter 12: Undefined

> variable: action in c:\inetpub\wwwroot\userviewer.php on line 246

>

>

> Okay, I've found a solution.

>

> Go to your php.ini file (should be in your Windows directory).  Find the

> line "error_reporting= ..." and change it to:

> "error_reporting=7"

>

> For an explanation why this works, look at p.53 of the PHP manual (the

> pdf version).

>

> Change your mail options at http://p2p.wrox.com/manager.asp or

> to unsubscribe send a blank email to

> $subst('Email.Unsub').



Message #6 on Mon, 28 Jan 2002 19:21:14
> 

> I wouldn't use numbers... the php.ini file lists a bunch of names for 

their

> integer codes.

> 

> You should use E_ALL & ~E_NOTICE.



Thanks.  I've changed it like you suggested.  Is there any particular 

reason why this is better than the numbers (apart from the fact that it's 

easier to figure out what it does)?
Message #7 on Mon, 28 Jan 2002 11:29:44 -0800

It's just a programming convention, I suppose.  The reasoning behind it is

that you don't have "magic numbers" floating around that don't make sense.

A constant is given a name for a reason



If any future PHP implementations or versions should happen to change the

numerical values of named constants, then your code should continue to work

just fine.



The NAME of the number is what makes it significant, not the value.  In

fact, I'm surprised that 7 (binary 0111) is the bitmask WITHOUT notice level

errors, since I'd've assume that smaller numbers would be correspond to less

severe errors.





nik







> -----Original Message-----

> > Sent: Monday, January 28, 2002 7:21 PM

> To: beginning php

> Subject: [beginning_php] Re: userviewer.php / chapter 12: Undefined

> variable: action in c:\inetpub\wwwroot\userviewer.php on line 246

>

>

> >

> > I wouldn't use numbers... the php.ini file lists a bunch of names for

> their

> > integer codes.

> >

> > You should use E_ALL & ~E_NOTICE.

>

> Thanks.  I've changed it like you suggested.  Is there any particular

> reason why this is better than the numbers (apart from the fact that it's

> easier to figure out what it does)?

> ---

> Change your mail options at http://p2p.wrox.com/manager.asp or

> to unsubscribe send a blank email to

> $subst('Email.Unsub').




  Return to Index