[PHP] Re: [PHP-WIN] More bzip woes! No file written...

2002-07-12 Thread Michael Davey

 Use full path for every filename.

I have now changed my code to do this, see below.

 Use ls -als to figure the permissions on each file.

I am running this on a windows box for now, and although I have cygwin and
can run ls and chmod, they don't seem to have any affect on the actual
permissions.  From an NT perpsective, I have given the local system account
(which Apache runs as) full permissions on the folder in question.  Thing
is, I am running a tar command before I run bzip and this manages to create
a file in this folder without any problems - wouldn't that too fail if it
was apermissions problem?

 If the World user (last of the three) can't do the thing to the file
 (read/write/execute) that you want PHP to do, then PHP can't do it.

This appears to be the case, but as I have said, I can't seem to get write
perms set via cygwin :-(

Here is my modified code...

   $data = implode (, file ($filename.tar));
   if ($DEBUG) echo BZip filename: .$SITE_ROOT./$filename.bz2br;
   $bz = bzopen ($SITE_ROOT./$filename.bz2, wb);
   bzwrite ($bz, $data);
   bzclose ($bz);

regards,

Mikey



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Generating word documents based on fields in a browser

2002-07-11 Thread Michael Davey

 ?
 $word=new COM(word.application) or die(Cannot start MS Word);
 print Loaded word version ($word-Version)\n;
 $word-visible = 1 ;
 $word-Documents-Add();
 $word-Selection-Typetext(This is a test);
 ?

 does anyone recognise this?

Oh yes - this would be Word via COM - if you are having problems getting
this to work, I would suggest consulting the VBA reference manual that comes
with Office - it will give you the methods/objects available to you, as well
as examples of how to use them...

Mikey



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: MS SQL Server and ODBC

2002-07-11 Thread Michael Davey

I don't really know much about freetds so this could all be wrong, but...
when you set-up a DSN on a server, the database is specified there - hope
this helps.

Mikey

Tim Nields [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I am attempting to connect to a MSSQL 2000 database from a linux box.  I
 have installed freetds successfully and configured php with sybase as
 directed by freetds.

 I configured the freetds .conf file.  However this is where I have
 questions.  The freetds.conf file only asks for the ip address of the
 database server.  I have mulitple databases on my database server.  How do
I
 specify the database that I'm trying to reach?

 Are there any configuration flags that I could be missing to use
 odbc_connect, etc.?

 Any help would be greatly appreciated.

 Tim





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MS SQL Server and ODBC

2002-07-11 Thread Michael Davey

Errr - doesn't that function apply to mySQL databases only?

Mikey

Adam Voigt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Check out the mssql_select_db function.
 Call it right after the connection open.

 Adam Voigt
 [EMAIL PROTECTED]

 On Thu, 2002-07-11 at 12:31, Tim Nields wrote:
  I am attempting to connect to a MSSQL 2000 database from a linux box.  I
  have installed freetds successfully and configured php with sybase as
  directed by freetds.
 
  I configured the freetds .conf file.  However this is where I have
  questions.  The freetds.conf file only asks for the ip address of the
  database server.  I have mulitple databases on my database server.  How
do I
  specify the database that I'm trying to reach?
 
  Are there any configuration flags that I could be missing to use
  odbc_connect, etc.?
 
  Any help would be greatly appreciated.
 
  Tim
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MS SQL Server and ODBC

2002-07-11 Thread Michael Davey

doh!

Adam Voigt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I wouldn't have said it if it did.
 Notice that it's MSSQL_select_db not MYSQL_select_db.

 Adam Voigt
 [EMAIL PROTECTED]

 On Thu, 2002-07-11 at 10:03, Michael Davey wrote:
  Errr - doesn't that function apply to mySQL databases only?
 
  Mikey
 
  Adam Voigt [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Check out the mssql_select_db function.
   Call it right after the connection open.
  
   Adam Voigt
   [EMAIL PROTECTED]
  
   On Thu, 2002-07-11 at 12:31, Tim Nields wrote:
I am attempting to connect to a MSSQL 2000 database from a linux
box.  I
have installed freetds successfully and configured php with sybase
as
directed by freetds.
   
I configured the freetds .conf file.  However this is where I have
questions.  The freetds.conf file only asks for the ip address of
the
database server.  I have mulitple databases on my database server.
How
  do I
specify the database that I'm trying to reach?
   
Are there any configuration flags that I could be missing to use
odbc_connect, etc.?
   
Any help would be greatly appreciated.
   
Tim
   
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
  
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] MS SQL Server and ODBC

2002-07-11 Thread Michael Davey

However, this still wouldn't work for ODBC...

Adam Voigt [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I wouldn't have said it if it did.
 Notice that it's MSSQL_select_db not MYSQL_select_db.

 Adam Voigt
 [EMAIL PROTECTED]

 On Thu, 2002-07-11 at 10:03, Michael Davey wrote:
  Errr - doesn't that function apply to mySQL databases only?
 
  Mikey
 
  Adam Voigt [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Check out the mssql_select_db function.
   Call it right after the connection open.
  
   Adam Voigt
   [EMAIL PROTECTED]
  
   On Thu, 2002-07-11 at 12:31, Tim Nields wrote:
I am attempting to connect to a MSSQL 2000 database from a linux
box.  I
have installed freetds successfully and configured php with sybase
as
directed by freetds.
   
I configured the freetds .conf file.  However this is where I have
questions.  The freetds.conf file only asks for the ip address of
the
database server.  I have mulitple databases on my database server.
How
  do I
specify the database that I'm trying to reach?
   
Are there any configuration flags that I could be missing to use
odbc_connect, etc.?
   
Any help would be greatly appreciated.
   
Tim
   
   
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
  
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Table Making

2002-07-11 Thread Michael Davey

How about working out the length of the column (by dividing the number of
rows by the number of cols you want), dump your results into an array and
using the col length as an offset to pick through the resulting table?

// $data is an array of results

$rows = count ($data)
$row_len = round ($rows / 3); // three cols

print table;
for ($i = 0; $i  $row_len; $i++)
{
print tr;
print td.$data[$i]./td;
print td.($row_len + $i  $rows)?$data[$row_len +
$i]:nbsp;./td;
print td.((2 * $row_len) + $i  $rows)?$data[(2 * $row_len) +
$i]:nbsp;./td;
print /tr
}
print /table;

This is off the cuff code and I think the row length's might need some extra
checking, but sth like this should work... (crosses fingers)

Mikey



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Can't Connect to INFORMIX DB

2002-06-06 Thread Michael Davey

Remove the semi-c0lon from the following line in php.ini:

;extension=php_ifx.dll

And then restart your web-server if your run PHP as a module...

Mikey

GastóN [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Thanks for the answer..

 But this is the story now..

 I've finally made Informix  PHP work using ODBC. That's working fine now.

 And about native functions, i've downloaded the manual instalation of
PHP,
 and now i have the extensions, dlls, and all that stuff. But still can't
 make it work.

 I've set my extension_dir, from php.ini, like this:

 extension_dir = C:\Php421\extensions\

 And of course, that's the path where i have those files.

 Any help will we appreciated!

 Bye
 Gastón.

 Juraj Hasko [EMAIL PROTECTED] escribió en el mensaje
 001f01c20c5b$dd6c8870$ec01db0a@HASKO">news:001f01c20c5b$dd6c8870$ec01db0a@HASKO...
  Hi,
 
  1. PHP native function for Informix will not work, because there is
 missing php_ifx.dll extension in latest PHP 4.2.1 bundle for win32.
 
  2. you have probably error in instalation of Infomix ODBC drivers. The
 file 'csql.iem' is part of standart instalation. Check your instalation
...
 
  Juraj
  System Administrator
 
  CAC LEASING Slovakia, a.s.
  mailto:[EMAIL PROTECTED]
  http://www.cacleasing.sk
 
  -Original Message-
  From: Gastón [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, June 04, 2002 8:19 PM
  To: [EMAIL PROTECTED]
  Subject: Can't Connect to INFORMIX DB
  
  
  Hi,
  I need some help (or maybe a lot), to get PHP connecting to my
  Informix DB.
  I'm pretty new to PHP, and i don't have a clue of what i'm doing wrong.
  
  I'm using IIS 4.0 under Win NT 4.0.
  with PHP 4.2.1
  
  I've tried to connect throw ODBC driver, and directly from
  native functions
  but both fail.
  The messages are:
  When i use ODBC:
  Warning: SQL error: [INTERSOLV][ODBC Informix
  driver][Informix]Cannot open
  file 'csql.iem' , SQL state S1000 in SQLConnect
  
  When i use native functions:
  PHP Warning: Unable to load dynamic library
  'C:\Php421\extensions\php_ifx.dll' - The specified procedure
  could not be
  found. in Unknown on line 0
  
  
  Thanks,
  Gastón.
  
  
  





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: php and javascript question

2002-06-05 Thread Michael Davey

Not unless you pass the variable to the next page explicitly.  You can do
this by either encoding it into the URL of the next page:
http://your.com/page.php?var=value or by putting the variable into an HTML
form and submitting it.

regards,

Mikey

Kemu [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have a page first he generates a var in javascript
 my next question is
 is it possible to use that var in php on the same page
 first he does the javascript then the php ?






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Finding out how a variable was registered

2002-06-05 Thread Michael Davey

Iff you asre using the latest version of PHP, use the $_GET/$_POST
superglobals

regards,

Mikey

Joe Pemberton [EMAIL PROTECTED] wrote in message
000f01c20cc1$1df6f320$9b6ee60c@c1195782a">news:000f01c20cc1$1df6f320$9b6ee60c@c1195782a...
Is there a function call to figure out how a variable was registered?  I am
writing a page that handles a form and I need to know whether or not a
variable was created using the GET or POST method (I don't want the user to
be able to to 'foo.php?var=value' and mess with the results)
- - Joe

[EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Passing variable to new page and pulling the rest of info from database

2002-06-05 Thread Michael Davey

By reading the manual section relevant to your specific database...


Igor Portnoy [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hello,



I am passing a variable to the new page, when user clicks on the link.
Something like that:

a href=showimage.php?ID=38img src=/some/image.jpg/a



How can I extract all other information out of my database for that ID
in the next page (showimage.php)?



Thanks






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Re: Passing variable to new page and pulling the rest of info from database

2002-06-05 Thread Michael Davey

Sure - first of all what database do you use?

Hopefully it is mySQL, as support for this is built in.  Then go the the
database specific section of the manual, e.g. mySQL Function Reference.

This will give you example code for connecting to a database.

There are also some good tutorials over at
http://www.phpbuilder.com/columns/ if you need more help...

Mikey

BTW - reply to the list

 -Original Message-
 From: Igor Portnoy [mailto:[EMAIL PROTECTED]]
 Sent: 05 June 2002 19:59
 To: Michael Davey
 Subject: RE: [PHP] Re: Passing variable to new page and pulling the rest
 of info from database


 Hello Michael,

 By reading the manual section relevant to your specific database...

 I am new to PHP. Can you be a little bit more specific?

 Thanks


 Igor Portnoy [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello,



 I am passing a variable to the new page, when user clicks on the link.
 Something like that:

 a href=showimage.php?ID=38img src=/some/image.jpg/a



 How can I extract all other information out of my database for that ID
 in the next page (showimage.php)?



 Thanks






 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: currency rounding issues

2002-06-05 Thread Michael Davey

I have found that the best way to work with currencies is to avoid using any
type of floating point math.

If you multiply your start amount by 100, then perform your calculations as
integers and then divide by 100 again at the end, it should work out OK...

(Heh, at least it has worked for me when doing tax calcs and stuff - who
know what you are doing?!?!?!?)

Mikey

Paul Berg [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 I am putting together an app that involves the adding together of rounded
 numbers and displaying in a currency format.
 The round() function is causing errors of 1 cent to appear after addition.
 Does anyone know of any routines that might assist?

 Thanks in advance...
 Paul





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] RE: notice:undefined variable

2002-06-04 Thread Michael Davey

OK - couple of things first:

a) The PHP mailing list is for programmers of PHP looking for help making
their own scripts - not for people who want support for implementing someone
else's script.  There is a link on the site where I found a copy of your
script offering support, this is where you should have gone first.

b) This is a mailing list, and as such replies should be made to the list -
not to individuals who subscribe the list.

c) You still didn't send the source code for the form - I had to go and look
for it myself on the net.

 Hi Michael,

 Our client uses the formmail.php script. He said to me that he
 used it as is
 with his previous ISP - it was not necessary for him to change anything.
 I configured the php.ini in the NTWin directory correctly. As a test I do
 not add anything to the email field (on the form) but it does not make any
 difference in the errror message.

 The page can be found at www.reservationhouse.co.za and then the
 link on the
 lefthand side: bookings and information.

However, the problem appears to be quite simple - if you create a simple
script like the one below and run it on your server, you should see a
setting called register_globals.  This setting need to be On for your
script to work.  Newer versions of PHP disable this by default as it
compromises both speed and security.

List config script:

?
phpinfo();
?


If you are leasing space, you will probably not have access to the php.ini
file to make this change.  You can however specify php settings in a file
named .htaccess placed in your root web directory, eg:

.htaccess:
php_value register_globals On

regards,

Mikey


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: notice:undefined variable

2002-06-04 Thread Michael Davey

Ooops, now I feel silly - sent this to the wrong list!

Hangs head in shame! :-)

Michael Davey [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 OK - couple of things first:

 a) The PHP mailing list is for programmers of PHP looking for help making
 their own scripts - not for people who want support for implementing
someone
 else's script.  There is a link on the site where I found a copy of your
 script offering support, this is where you should have gone first.

 b) This is a mailing list, and as such replies should be made to the
list -
 not to individuals who subscribe the list.

 c) You still didn't send the source code for the form - I had to go and
look
 for it myself on the net.

  Hi Michael,
 
  Our client uses the formmail.php script. He said to me that he
  used it as is
  with his previous ISP - it was not necessary for him to change anything.
  I configured the php.ini in the NTWin directory correctly. As a test I
do
  not add anything to the email field (on the form) but it does not make
any
  difference in the errror message.
 
  The page can be found at www.reservationhouse.co.za and then the
  link on the
  lefthand side: bookings and information.

 However, the problem appears to be quite simple - if you create a simple
 script like the one below and run it on your server, you should see a
 setting called register_globals.  This setting need to be On for your
 script to work.  Newer versions of PHP disable this by default as it
 compromises both speed and security.

 List config script:

 ?
 phpinfo();
 ?


 If you are leasing space, you will probably not have access to the php.ini
 file to make this change.  You can however specify php settings in a file
 named .htaccess placed in your root web directory, eg:

 .htaccess:
 php_value register_globals On

 regards,

 Mikey




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Printing Large Blocks of Text

2002-06-04 Thread Michael Davey

print END
Lots
of
text
in
a
block
END;

Jason Wong [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Tuesday 04 June 2002 17:34, [EMAIL PROTECTED] wrote:
  What is the best way to print large blocks of text within a PHP
function?

 echo(), print()?

 Perhaps you can elaborate on what you want to do and what you want to
know.

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 In Tulsa, Oklahoma, it is against the law to open a soda bottle without
 the supervision of a licensed engineer.
 */




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] php4win.com

2002-06-03 Thread Michael Davey

I originally posted this to the PHP-WIN list but there doesn't seem to be
anyone there... maybe you guys can help?

Does anyone know what has happened to the php4win.com web-site?  I have been
trying to get there now for the best part of a month and still get site
errors.

regards,

Mikey



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] massive words

2002-06-02 Thread Michael Davey

Also, if you are really worried about placing too much load on the server,
you could use JavaScript to check the form submission on the client side
using the same technique...

Mikey

Bogdan Stancescu [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 First, you don't need to explode and then implode - just use a different
 var for the exploded array and use the original after the test.

 My suggestion for testing (but you really must test it and see if it's
 faster or slower than your method) is using wordwrap() with your max
 word length and then check if any line is longer than your max allowed
 length. The advantage may be that you probably use 10-15 as the max
 length in real life and you would skip quite a few checks because you're
 going to end up with several words on a typical line. I guess it *might*
 be slightly fatser because wordwrap() is native to PHP - the job however
 is more complicated, so you may end up with a slower version than your
 current one.

 Bogdan

 Justin French wrote:

 hi all,
 
 looking for some advice on the best way to approach this:
 
 i have a guestbook running on a few sites, and occasionally we get
 creative people who think it's a good idea to post messages with really
 long words or URLs into the text, which totally mess up the layout of the
 page.
 
 what I need is an efficient way of checking the input for extremely long
 words (say about 60-odd characters +)
 
 I assume I just split the input by   (space) into an array, and check
that
 each word isn't longer than 60 chars, but this seems like a lot of work
 for the server... although I am limiting the entire input to 2000 chars,
so
 maybe this isn't too much work for the server?
 
 
 this is what I'm using:
 ?
 $word_length = 5;
 $error = 0;
 
 $str = cat dog bird mouse elephant; // illegal
 $str = explode( , $str);
 
 foreach($str as $key = $word)
 {
 if(strlen($word)  $word_length)
 { $error = 1; }
 }
 if($error)
 { echo sorry; }
 else
 {
 $str = implode( , $str);
 echo $str.BR;
 }
 ?
 
 any ways to improve it?
 
 
 Justin
 
 
 
 






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Variables - Using The Contents Of A Varibale Name Built Dynamically

2002-06-02 Thread Michael Davey

 Won't that treat all radio buttons on the page as one group, instead of
 being separate groups for each form?

No - the form/form tags enclose the data that is being submitted -
nothing outside of the tags will reach the script that handles the request.

Mikey



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Michael Davey

However...

From the point of view of someone who has worked in a company where diesign
is separated from development, it is much better to have separate files with
HTML templates with special markers (in the library I use, it is HTML
comments !--element_to_replace--) so that the two processes are adequately
separated.

When all of the HTML is embedded in PHP staements, minor changes to HTML
layout involve a PHP developer, whereas with template based strategies all
they have to do is change the template.

I believe that 'smarty' is the approved template libray, but there are
several other worth investigating.

Mikey
Bogdan Stancescu [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 No *real* reason - just two not-so-important ones:

 1. Clarity
 Please compare these two:
 -- MIXED
 td bgcolor=?php echo $td_col; ? class=?php echo $prefclass; ?
 ?php $fldcontent=$myrow[0]?$myrow[0]:no data; ?
 input type=text name=fname size=50 value=?php echo $fldcontent;
 ?
 /td

 -- PURE
 ?php
   echo(td bgcolor='$td_col' class='$prefclass'\n);
   $fldcontent=$myrow[0]?$myrow[0]:no data;
   echo(input type='text' name='fname' size='50'
value='$fldcontent'\n);
 ?

 The second is much easier to read and understand, you must agree.

 2. Speed
 There's an urban legend saying that switching php tags on and off would
 slow parsing down. I don't know if that's true and try to write pure
 php as you call it due to the first reason.

 Bogdan

 Andre Dubuc wrote:

 I've noticed that many people on the list code in 'pure' php, i.e.
 
 ?
 print input type='text' name='fname' size='50';
 
 // etc
 ?
 
 Since most of my code is a mixture (the early stuff is 'mixed' html +
php),
 I've been wondering why code in 'pure' php? Is there some compelling
reason
 (that I'm unaware of) for doing so? Should I rewrite all my earlier code
into
 its 'pure' form? If so, what do I do with the '! DOCTYPE . . . 
statement
 -- put it in quotes too?
 
 I would like to understand the reasons for writing code in this manner,
when
 all my code works fine, displays great: am I missing something important
 here? Btw, I use the 'php' ending for all file names.
 
 Your thoughts, opinions and suggestions would be greatly appreciated --
I'd
 like to do what is best.
 
 Tia,
 Andre
 
 
 






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] 'Pure' php vs 'mixed' (html + php)

2002-06-02 Thread Michael Davey

 Point well-made. I suppose doing it the mixed way might have repercussions
 later on if/when the site grows. Perhaps while the code is still fresh in
my
 mid, it might be worth the effort to separate it.

 However, for a good part of the site, I've used CSS for appearance
details,
 and controlling a lot of stuff that changes from page-to-page. It's very
easy
 to change all or some of the pages from the CSS scripts. But, for the most
 part, not much of the actual php scripts COULD change, so that's why I've
 never bothered to separate html from php. Perhaps I wrong, but  . . .

I think it is a case of horses for courses - you are working on what sounds
like a fairly small project, and templatizing your code may be more
trouble than it is worth, so whatever feels best for you...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Variables - Using The Contents Of A Varibale Name Built Dynamically

2002-06-01 Thread Michael Davey

You could give the button the same name in each form - only the fields in
between the form/form tags is actually submitted, then put a hidden field
in the form that uniquely identifies the data being submitted.

Just a thought... it is what I usually do...

Mikey

Jason Teagle [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have found an alternate way of achieving what I want, but I'm wondering
if
 there was an easier way. I have a PHP file that builds a Web page that
 includes forms. The forms are built dynamically based on the contents of a
 file, and thus there may be one or two or more forms on the page at any
 time. This means that I have controls named $btnChoice1 (first form),
 $btnChoice2 (second form), etc. (radio buttons). All of these forms are of
a
 similar format, and so lead to the same PHP page in their action - a
 parameter is passed in the URL to identify which form it came from.

 When the form passes to its action file, another PHP file, there are two
 ways to get form data: $_POST[control_name] or $control_name. The
problem
 is, the control name I need has to be built dynamically based on which
form
 it came from. So I need this:

 $btnName = btnChoice . $form_number ;

 But now I have the tricky bit - $_POST[$btnName] doesn't work because it
 requires nested substitution of variables, and similarly I can't echo
 $btnName because that will of course use btnChoice2 instead of the
 _contents_ of the control named btnChoice2.

 Is it possible to 'dereference' (whatever the term is) the variable name
 twice? I tried

 $$btnName

 in the stupid hope that it would first interpret that to

 $btnChoice2

 and then interpret that to the contents of the control, but of course it
 failed.

 I ended up using foreach on $_POST to pull out control names and their
 contents, and comparing the control name to my built-up name - but I was
 wondering if there's a more elegant way of doing what I wanted?

 Promise my next question to the group will be short {:v)


 --
 
 _ _
 o oJason Teagle
[EMAIL PROTECTED]
  v
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Possible to convert from Hex string to integer?

2002-06-01 Thread Michael Davey

Does anyone know of a function within PHP that will convert a hexadecimal
string (without the leading 0x) into an integer?

regards,

Mikey



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Possible to convert from Hex string to integer?

2002-06-01 Thread Michael Davey

Which is so easy to find in the offline manual...

Stuart Dallas [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Saturday, June 1, 2002 at 6:29:59 PM, you wrote:
  Does anyone know of a function within PHP that will convert a
hexadecimal
  string (without the leading 0x) into an integer?

 FFS!! http://www.php.net/hexdec

 --
 Stuart




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Run php function with user click

2002-05-31 Thread Michael Davey

Not really, seeing as PHP is executed at the server and not on the client -
you would need JavaScript for this.

Mikey

Dave Shacket [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I know how to have my php code run a function within itself. But is there
a
 way that upon an event (clicking a button, etc.), you could run a php
 function without having to go to a new page?





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: PHP can not connect to mysql

2002-05-31 Thread Michael Davey

Check permissions on '/var/lib/mysql/mysql.sock'  I seem to remember having
this problem in the past...

Mikey

Andy [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi there,

 I am runningn suse72 and there was a mysql installation with the rpm
 installed. so I did try to get rid of all the stuff I found from the old
 mysql installation (with yast) and compiled mysql from source. Server is
 running now. Unfotuantelly php is still trying to connect to the old
 version. phpinfo tells me the old mysql version number.

 This is what I am gettinng from php:

 Warning: Can't connect to local MySQL server through socket
 '/var/lib/mysql/mysql.sock' (2) in

 Server is definatelly running. Not the old one though! I killed the old
 process which was anyhow running.

 Can anybody help on that?

 Thank you very much in advance,

 Andy





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: PHP can not connect to mysql

2002-05-31 Thread Michael Davey

Or edit php.ini:

mysql.default_socket = /tmp/mysql.sock


James Holden [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 @mysql_connect(localhost:/tmp/mysql,user,pass);


 - James
 --
 W: www.londontown.com
 @: [EMAIL PROTECTED]
 --

 -Original Message-
 From: andy [mailto:[EMAIL PROTECTED]]
 Sent: 31 May 2002 15:19
 To: Michael Davey; [EMAIL PROTECTED]
 Subject: [PHP] Re: PHP can not connect to mysql


 That is the wron socket. I found out that my mysql version is running on
 socket /tmp/mysql.sock while the old one is running on
 /var/lib/mysql/mysql.sock.

 How can I tell php to connect with the other socket?

 Thanx,

 Andy



 - Original Message -
 From: Michael Davey [EMAIL PROTECTED]
 Newsgroups: php.general
 To: [EMAIL PROTECTED]
 Sent: Friday, May 31, 2002 4:05 PM
 Subject: Re: PHP can not connect to mysql


  Check permissions on '/var/lib/mysql/mysql.sock'  I seem to remember
 having
  this problem in the past...
 
  Mikey
 
  Andy [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   Hi there,
  
   I am runningn suse72 and there was a mysql installation with the rpm
   installed. so I did try to get rid of all the stuff I found from the
old
   mysql installation (with yast) and compiled mysql from source. Server
is
   running now. Unfotuantelly php is still trying to connect to the old
   version. phpinfo tells me the old mysql version number.
  
   This is what I am gettinng from php:
  
   Warning: Can't connect to local MySQL server through socket
   '/var/lib/mysql/mysql.sock' (2) in
  
   Server is definatelly running. Not the old one though! I killed the
old
   process which was anyhow running.
  
   Can anybody help on that?
  
   Thank you very much in advance,
  
   Andy
  
  
 
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Class variables and scope

2002-05-31 Thread Michael Davey

Can anyone here shed some light on this issue?

I have a class which is responsible for it's own database access and (some
of it) is initalised as below:

?
class myClass
{
var $conn;
var $sth;
// etc...

function myClass ($db)
{
$host = localhost;
$user = user_name;
$password = password;
$this-conn = mysql_connect ($host, $user, $pwd)
or die (Unable to connect to database);
$sel = mysql_select_db ($db, $this-conn);
if (!$sel) die (Unable to select database);
return true;
}

// rest of the class
}
?

Now, say for example the class is used as per the script below:

?
require (myClass.class);
$c1 = new myClass (first_database);
$c2 = new myClass (second_database);

// error here
$c1-doSomething();
?

When I try to work with the first instance of my class, I get an error which
I finally tracked down to it trying to run it's SQL queries against the
database defined in $c2.  Now, I was under the impression that class
variables were private to each instance, however, this seems to be acting
like a static var.

Help?!?

Mikey



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: apache2filter.dll

2002-05-31 Thread Michael Davey

It is called php4apache2.dll

Mikey

Herman Pool [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi all,

 I have downloaded PHP4.2.1 because I want to use it with apache 2.0.36
 But there is no php/experimental/apache2filter.dll  file in PHP4.2.1
 Did I miss something?

 With kind regards,

 Herman





 **
 Dit bericht en alle eventueel meegestuurde documenten
 zijn vertrouwelijk en alleen bestemd voor degene aan wie
 het bericht geadresseerd is. Indien u dit bericht heeft
 ontvangen terwijl u niet de geadresseerde bent, verzoeken
 wij u het bericht te vernietigen en ons daarvan in kennis te
 stellen.

 Dit bericht is tevens gecontroleerd op computervirussen.

 This e-mail and any files transmitted with it are confidential
 and intended solely for the use of the individual or entity to
 whom they are addressed. If you have received this e-mail
 in error, please delete the message and notify us.

 This e-mail message has been swept by MIMEsweeper for
 the presence of computer viruses.
 **



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Class variables and scope

2002-05-31 Thread Michael Davey

I am doing that - sorry, should have given you a bit more code...

?
class myClass
{
var $conn;
var $sth;
// etc...

function myClass ($db)
{
$host = localhost;
$user = user_name;
$password = password;
$this-conn = mysql_connect ($host, $user, $pwd)
or die (Unable to connect to database);
$sel = mysql_select_db ($db, $this-conn);
if (!$sel) die (Unable to select database);
return true;
}

function doSomething ()
{
$sql = select * from table;
$this-sth = mysql_query ($sql, $this-conn);
// do something with query...
}
}
?

Is there something inherently static about msql connections?

Mikey

Stuart Dallas [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Friday, May 31, 2002 at 4:11:42 PM, you wrote:
  When I try to work with the first instance of my class, I get an error
which
  I finally tracked down to it trying to run it's SQL queries against the
  database defined in $c2.  Now, I was under the impression that class
  variables were private to each instance, however, this seems to be
acting
  like a static var.

 You need to specify $this-conn in each mysql_* function you call
otherwise it
 will be called against the last connection made.

 --
 Stuart




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: gd project question

2002-05-31 Thread Michael Davey

I believe you will need to use sin and cos to do this...

I experimented with drawing circles in javascript (sorry, it's not PHP but
you can see the concept) and ended up with this:

  for (j = 0; j = 360; j += (360 / 10))
  {
// x1  y1 are offset values
var s = x1 + radius * Math.cos (j);
var t = y1 + radius * Math.sin (j);
setLayer (layer_count, s, t);
layer_count++;
  }

You would be able to work out the angle by making it a percentage of 180
degrees - although for horizontal gauges, you would need to offset it
by -90.

Hope this helps...

Mikey

Michael Geier [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have the following issue:

 I am making a gas guage based on a percentage.
 ie.
 - a 180 degree arc is created
 - the range will be 0 to n (undetermined ammount)
 - there will be x number of entries
 - the needle will pount to a a percentage
   for (int)floor((x / n) * 100)

 The issue is, I have the starting pt for the needle (imagefilledarc
 needs the center of the 'circle' as the starting pt, which is where
 the needle will start too), but how would I get the x|y coordinates
 for the end of the needle based on a perentage of a half-circle
 (180 degree arc)?

 Appreciate any clues or ideas.

 ---
 Michael Geier




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] bzip/zlib question

2002-05-31 Thread Michael Davey

I have been looking through the documentation for using Bzip2 or zlib
compression and have a couple of questions for the group...

1.Which is best to use on terms of: resultant file size, availability of
decompression clients  ease of use?

2.Both bzip  zlib documentation makes use of *write() functions to add
strings to the file, but can this be used to add files?

3.I intend to add two or more zip files to the archive so that the
client only needs to download one file rather than several- which is most
suited to this - zlib or bzip2?

Mikey



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Class/Objects

2002-05-31 Thread Michael Davey

I believe so - but why are you passing a the object a reference to itself?

 $bar-db_obj-run_some_code($bar);
 $bar-tpl_obj-do_this_for_me($bar);

If you need to access parts of the object from within, use the $this-
pointer.

 It works but was wondering if its 'legal' to use it like this -
 $lcre-db_obj-run_some_code($bar);
 $lcre-tpl_obj-do_this_for_me($bar);

This looks like it makes more sense as you are passing a reference to $bar
into $lcre - as long as your function is setup to accept this type of object
and knows what to do with it.

Mikey



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Newbie question : PHP variables are not posted by this

2002-05-31 Thread Michael Davey

Can you send the code that is failing to the list - it will help in working
out the problem...

Mikey

FréDéRick St-Hilaire [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 It a BASIC question,

 With the following:

 FORM NAME='Job_Application' ACTION=job_action.php METHOD=post
 ENCTYPE=multipart/form-data
 INPUT TYPE=text NAME=name
  Name : BR
 INPUT TYPE=HIDDEN NAME=MAX_FILE_SIZE VALUE=20
 INPUT TYPE=FILE NAME=userfileBRBR
 INPUT TYPE=submit NAME=enter VALUE=SendBR
 INPUT TYPE=reset value=reset name=resetBR
 /FORM

 With the job_action.php I want to display the resaults to the user.

 But the variable name is empty.

 What's the problem?

 Thanks

 Frédérick St-Hilaire





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: diplaying the path

2002-05-31 Thread Michael Davey

$_SERVER['HTTP_REFERRER']

Kris Vose [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Is there a variable/function in php that will display the url location of
the hyper-link that brought them to the current page.  Thanks in advance.

 Kris Vose




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] bzip/zlib question

2002-05-31 Thread Michael Davey

So does anyone have any advice on adding files rather than strings?

On Fri, 31 May 2002, Michael Davey wrote:

 I have been looking through the documentation for using Bzip2 or zlib

 compression and have a couple of questions for the group...



 1. Which is best to use on terms of: resultant file size, availability

 of decompression clients  ease of use?

File size: bzip2 wins, hands down

Client availability: zlib wins, hands down

Easy of use: tie.

miguel

 2.Both bzip  zlib documentation makes use of *write() functions to
add
 strings to the file, but can this be used to add files?

 3.I intend to add two or more zip files to the archive so that the
 client only needs to download one file rather than several- which is most
 suited to this - zlib or bzip2?

 Mikey




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Parsing file's

2002-05-31 Thread Michael Davey

You should normalise your data - have a field in the second csv that links
to the first csv and then you can have as many rows as you want associated
with the record in the first file.

Mikey

Scott [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have a csv file that I am parsing, formatting and then writting to a new
 file.  I am currently using an array, but I have some lines that might
 contain more data than others.  I know for sure that columns 0-33 will
 always be there, but the customer has the option to add another set of
 columns to the row if needed.  I do know that the addition's will always
 be 18 columns and I do know that they can add up to 15 set's of 18.  So,
 the row length could be 0-33 or 0-51 if they add one additional set or 303
 columns if they go up to 15.

 The tricky part is I have to format each column for the new file that is
 created, I do this using sprintf.  I have so far tried to use array_slice
  for the first 18 columns, then I do another array_slice starting at 18
 and using the column count to get the last column in the row.  Here is the
 code:

 array_slice($fields, 18,$lineCount);
 foreach ($fields as $key = $value){
 print $key|$value\r\n;
 }

 The format of the new file will be this:
 01-Customer information
 02-Other information
 03a Required Info (that can repeat up to 15 times per line)
 03b 
 04b 
 04-Close Customer Record

 Repeat cycle for each row.  The inner loop happens between the 02 and 04
 records.  Remember, I need to format each individual column, they are
 different format options.

 If you have some thoughts, I would be all ears as I have been starring at
 this too long and too hard.

 Thanks,

 -Scott





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Was: [PHP-WIN] GD Freetype on W2K/Apache1.3.2/PHP4.2.0

2002-05-30 Thread Michael Davey

I know this is cross-posting, but I have no luck with finding a solution to
this problem on PHP-WIN, and I have since tried running my code on a Linux
server and have had the same problems... so here goes!

-- Original Post --
Sorry if this has been posted a hundred times already - but I am trying to

use TrueType fonts with GD.

I can create images fine, and have managed to gather from previous postings

that there was an error with post-4.0.5 versions of php_gd.dll that cause

Freetype to fail, but the install of PHP I have installs php_gd2.dll and any

attempts to use php_gd.dll fail when I restart the server.

Has anyone else has experience of this issue?

Mikey




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: SQL question, getting error and not sure why

2002-05-30 Thread Michael Davey

 insert into acteursenc (nuacteur,nomacteur)
 (select AA, BB from
 (select max(nuacteur)+1 AA from acteursenc),
 (select 'Michael Sweeney' BB from acteursenc))

 produces an ORA-1: unique constraint error.

 The primary key is nuacteur, but by setting AA to max(nuacteur)+1 I should
 be getting a new key that is unique, however it does not seem that way.

 What am I doing wrong here?

I'm not an Oracle expert, but surely max(field) + 1 is one higher than the
maximum value possible for the column?

(Probably irrelevant snippet from mySQL manual:
MAX(expr)
Returns the minimum or maximum value of expr. MIN() and MAX() may take a
string argument; in such cases they return the minimum or maximum string
value.)

regards,

Mikey



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: SQL question, getting error and not sure why

2002-05-30 Thread Michael Davey

Is the key a numeric sequence (1001, 1002, etc...)?

If so, you could do a select count(*) from table and add your offset to
that (1000 from the example above)

Does this help?

Mikey

Michael Sweeney [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 lol sorry, buttons are too close together in OE.

 Anyon ehave a sugestion on a different way of doing what I want to do?
 Should be easy but i;m starting to get a headache from this (6-7 years not
 doing SQL doesn't help either)



 [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Maybe it does in Oracle - you should check your documentation though...
 
  BTW, please post your replies to the list rather than me personally :-)
 
   -Original Message-
   From: Michael Sweeney [mailto:[EMAIL PROTECTED]]
   Sent: 30 May 2002 15:58
   To: Michael Davey
   Subject: Re: SQL question, getting error and not sure why
  
  
   I thought it gave you the highest record value, IE recrods
   containing values
   1-10, it would return 10
  
  
   - Original Message -
   From: Michael Davey [EMAIL PROTECTED]
   Newsgroups: php.general
   To: [EMAIL PROTECTED]
   Sent: Thursday, May 30, 2002 10:52 AM
   Subject: Re: SQL question, getting error and not sure why
  
  
 insert into acteursenc (nuacteur,nomacteur)
 (select AA, BB from
 (select max(nuacteur)+1 AA from acteursenc),
 (select 'Michael Sweeney' BB from
acteursenc))

 produces an ORA-1: unique constraint error.

 The primary key is nuacteur, but by setting AA to max(nuacteur)+1
I
   should
 be getting a new key that is unique, however it does not seem
   that way.

 What am I doing wrong here?
   
I'm not an Oracle expert, but surely max(field) + 1 is one
   higher than the
maximum value possible for the column?
   
(Probably irrelevant snippet from mySQL manual:
MAX(expr)
Returns the minimum or maximum value of expr. MIN() and MAX() may
take
 a
string argument; in such cases they return the minimum or maximum
 string
value.)
   
regards,
   
Mikey
   
   
  
  
  
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: [PHP-WIN] GD Freetype on W2K/Apache1.3.2/PHP4.2.0

2002-05-30 Thread Michael Davey

Ignore this - I have managed to get them to work in Unix - now onto
Windows... sigh!
Michael Davey [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I know this is cross-posting, but I have no luck with finding a solution
to
 this problem on PHP-WIN, and I have since tried running my code on a Linux
 server and have had the same problems... so here goes!

 -- Original Post --
 Sorry if this has been posted a hundred times already - but I am trying to

 use TrueType fonts with GD.

 I can create images fine, and have managed to gather from previous
postings

 that there was an error with post-4.0.5 versions of php_gd.dll that cause

 Freetype to fail, but the install of PHP I have installs php_gd2.dll and
any

 attempts to use php_gd.dll fail when I restart the server.

 Has anyone else has experience of this issue?

 Mikey






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: I want a script to run after a page already loads.

2002-05-30 Thread Michael Davey

It would be possible to flush the output of your page (i.e. your HTML) and
then put the PHP code after this... however, the page wouldn't appear to be
fully loaded until the script had finished processing...

Mikey

Phil Schwarzmann [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 I have a script that takes a VERY long time to run.  So the page just
 kinda hangs for a minute if not longer before the script is complete.

 I want a page to fully load, then I want this script to run.  Is this
 possible?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Posting to a form - When user hits BACK button all the data isgone

2002-05-30 Thread Michael Davey

The best way to do this is to register your form data as session variable
when it is processed on the second page.  Then add some scripting in the
first page to check for these variables and pre-populate the form as
necessary...

Mikey

Phil Schwarzmann [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 When a user is posting data to a form and hits SUBMIT the user is taken
 to another page.  But when the user hits the BACK button on his browser,
 all the posted data is gone.

 How can I get this data to remain there when a user hits BACK ?

 Thanks!!




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Help with example session class (second request)

2002-05-30 Thread Michael Davey

Not quite sure where you got this $login class instance from, but it appears
to be from thin air.  If you have a session class then you would need to
instantiate it first with:

$login = new XYZSessionClass(); // plus any constructor arguments

However, I am a bit confused as you mention using PHP session management -
this doesn't require any objects at all, and definately doesn't invlove a
getSessionVar() method.

To register a session var, use:

session_register (var_name);

And then you just simply use it as you would any normal variable on other
pages.

regards,

Mikey

Daevid Vincent [EMAIL PROTECTED] wrote in message
001801c2080d$b67c4630$45193e04@telecom">news:001801c2080d$b67c4630$45193e04@telecom...
 Sorry for posting this again so soon, but until I get sessions working,
 I'm blocked on this project.

 D.
 ---

 I'm just learning sessions, and thought the class looked interesting on
 this page: http://www.php.net/manual/en/ref.session.php

 So I have this on an index.phtml page and I can see the variables are
 being set and all looks good there, however upon successful login I
 wish to redirect to content.phtml At the very top of content.phtml I
 have:

 ?php
 if( $login-getSessionVar(login) )
 {
 $booth_id = $login-getSessionVar(booth_id);
 $booth_name = $login-getSessionVar(booth_name);
 echo \nBRbooth_id = $booth_id and booth_name =
 $booth_nameBR\n;
 }
 else
 {
 Header(Location: ../index.phtml\n\n);
 exit;
 }
 ?

 But it doesn't seem that $login exists or is defined now on this page?

 So my question is basically, how can I use the class and the session
 variables across multiple pages? Do I need to move the class to an
 include file? Do I need to re-create it on each page somehow? Can
 someone show me a real working example of this scenario?

 Daevid Vincent
 http://daevid.com





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Help with example session class (second request)

2002-05-30 Thread Michael Davey

Oops - should have read down a lot further...


Michael Davey [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Not quite sure where you got this $login class instance from, but it
appears
 to be from thin air.  If you have a session class then you would need to
 instantiate it first with:

 $login = new XYZSessionClass(); // plus any constructor arguments

 However, I am a bit confused as you mention using PHP session management -
 this doesn't require any objects at all, and definately doesn't invlove a
 getSessionVar() method.

 To register a session var, use:

 session_register (var_name);

 And then you just simply use it as you would any normal variable on other
 pages.

 regards,

 Mikey

 Daevid Vincent [EMAIL PROTECTED] wrote in message
 001801c2080d$b67c4630$45193e04@telecom">news:001801c2080d$b67c4630$45193e04@telecom...
  Sorry for posting this again so soon, but until I get sessions working,
  I'm blocked on this project.
 
  D.
  ---
 
  I'm just learning sessions, and thought the class looked interesting on
  this page: http://www.php.net/manual/en/ref.session.php
 
  So I have this on an index.phtml page and I can see the variables are
  being set and all looks good there, however upon successful login I
  wish to redirect to content.phtml At the very top of content.phtml I
  have:
 
  ?php
  if( $login-getSessionVar(login) )
  {
  $booth_id = $login-getSessionVar(booth_id);
  $booth_name = $login-getSessionVar(booth_name);
  echo \nBRbooth_id = $booth_id and booth_name =
  $booth_nameBR\n;
  }
  else
  {
  Header(Location: ../index.phtml\n\n);
  exit;
  }
  ?
 
  But it doesn't seem that $login exists or is defined now on this page?
 
  So my question is basically, how can I use the class and the session
  variables across multiple pages? Do I need to move the class to an
  include file? Do I need to re-create it on each page somehow? Can
  someone show me a real working example of this scenario?
 
  Daevid Vincent
  http://daevid.com
 
 





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Help with example session class (second request)

2002-05-30 Thread Michael Davey

As I said...

Not quite sure where you got this $login class instance from, but it
appears to be from thin air.  If you have a session class then you would
need to instantiate it first with:

$login = new XYZSessionClass(); // plus any constructor arguments

And to quote from the manual page you gave the link to:

To use this class, simply create a new object $login = new
mySession(name);

Daevid Vincent [EMAIL PROTECTED] wrote in message
003c01c20826$451f3dd0$45193e04@telecom">news:003c01c20826$451f3dd0$45193e04@telecom...
 Thank you john for the prompt reply, however I must be completely
 retarded. I do this:

 ?php
 session_start();

 if( $login-getSessionVar(login) )
 {
 $booth_id = $login-getSessionVar(booth_id);
 $booth_name = $login-getSessionVar(booth_name);
 echo \nBRbooth_id = $booth_id and booth_name =
 $booth_nameBR\n;
 }
 else
 {
 Header(Location: ../index.phtml\n\n);
 exit;
 }

 echo this session is named: .session_name().BR\n;

 include(../globalassets/include/header.phtml);
 ?

 And I get this error:

 Fatal error: Call to a member function on a non-object in content.phtml
 on line 4

  -Original Message-
  From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, May 30, 2002 12:19 PM
  To: Daevid Vincent; PHP general mailing list
  Subject: Re: [PHP] Help with example session class (second request)
 
 
  Call session_start() on your second page...
 
  ---John Holmes...
 
  - Original Message -
  From: Daevid Vincent [EMAIL PROTECTED]
  To: PHP general mailing list [EMAIL PROTECTED]
  Sent: Thursday, May 30, 2002 3:10 PM
  Subject: [PHP] Help with example session class (second request)
 
 
   Sorry for posting this again so soon, but until I get sessions
   working, I'm blocked on this project.
  
   D.
   ---
  
   I'm just learning sessions, and thought the class looked
  interesting
   on this page: http://www.php.net/manual/en/ref.session.php
  
   So I have this on an index.phtml page and I can see the
  variables are
   being set and all looks good there, however upon successful
  login I
   wish to redirect to content.phtml At the very top of content.phtml I
   have:
  
   ?php
   if( $login-getSessionVar(login) )
   {
   $booth_id = $login-getSessionVar(booth_id);
   $booth_name = $login-getSessionVar(booth_name);
   echo \nBRbooth_id = $booth_id and booth_name =
   $booth_nameBR\n;
   }
   else
   {
   Header(Location: ../index.phtml\n\n);
   exit;
   }
   ?
  
   But it doesn't seem that $login exists or is defined now on
  this page?
  
   So my question is basically, how can I use the class and
  the session
   variables across multiple pages? Do I need to move the class to an
   include file? Do I need to re-create it on each page somehow? Can
   someone show me a real working example of this scenario?
  
   Daevid Vincent
   http://daevid.com
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Help with a trivial session example.

2002-05-30 Thread Michael Davey

Hmm...

I can't say that I have moved over to the new superglobals yet - I prefer
register_globals cos I am lazy ;)

But it does seem that there are two possible variables that you need to
use - the one in your script ($HTTP_SESSION_VARS), but this is only for
4.0.6 or less, it is $_SESSION otherwise - what version do you have
installed?

regards,

Mikey

Daevid Vincent [EMAIL PROTECTED] wrote in message
003d01c20830$3d814690$45193e04@telecom">news:003d01c20830$3d814690$45193e04@telecom...
 Okay, now I'm completely confused...

 I made a very simple test page, and even that doesn't work:

 http://daevid.com/examples/index.phtml

 Notice how I have the right session_id, but the variable didn't pass
 onto the second page.

 Can someone please explain to me what I am doing wrong?

 Do I not have PHP.ini configured properly or something?

 D.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Help with a trivial session example.

2002-05-30 Thread Michael Davey

 Given $myvar = 5;

 If you use session_register('myvar');

 Then on another page, do you just access it via $myvar?

That is exactly how it works - I also have session.auto_start turned on as
well.

 And if that's the case, isn't it the same to set

 $HTTP_SESSION_VARS['myvar'] = $myvar;
 Or even
 $GLOBALS['myvar'] = $myvar;
 Or
 $_SESSION['myvar'] = $myvar;

 Not that ANY of these are working for me *sigh*

As I said - I wouldn't know as I haven't used them yet - but it seems like
it should having read the manual briefly.

 4.0.6 according to the phpinfo link on the page ;-)

I realised that just after I sent the mail - doh!

Mikey



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php