[PHP] Re: cleaning up the uri

2001-09-10 Thread Jon Thompson Coon

 ... so make the two pieces the same file... have the script redirect to
 itself minus the parameters.

I did, but somehow it soesn't feel like an elegant way of doing things, with
that extra reloading and all. But it'll do. Thanks.

- jon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Mod-function?

2001-09-09 Thread Jon Thompson Coon

 It is an operator in PHP: %

 ie. echo 3 % 2;

 -Rasmus

 On Sat, 8 Sep 2001, Ville Mattila wrote:

Eli jakojäännös (modulo) lasku. PHP:ssä voi tulla ongelmia oikeiden vastausten kanssa, 
kun se muuttelee muuttujatyyppiä tarvittaessa. Eli kokonaisluvuista reaaleja jne.
Kannattaa tarkistaa, ennen kuin luottaa.

- Jon Thompson Coon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] cleaning up the uri

2001-09-09 Thread Jon Thompson Coon

I don't want to ask all these silly questions constantly time, but being
lazy overcomes the urge not to do so.

Having a page somethin/somewhere/index.php?do=thisand=that. This page
does some updating and database queries. Hitting the reload button makes
these things happen again (obviously). My question is, what are the
usual ways of dealing with this problem?

I don't want to separate my code into separe files, i.e. linking into a
script that does the updating and redirects to the original page without
the do=thisand=that part. When you require a html page modify itself,
is it possible to remove the GET stuff from the result? By, f. ex. using
header(whatnot: where) and then builing the material?

I might not be very clear about this, but hopefully the meaning filters
through.

- Jon Thompson Coon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Iffy W2K, dodgy PHP or sketchy programmer?

2001-09-07 Thread Jon Thompson Coon

Been up for four f**g hours too late trying to find something
wrong with my code, lately finding out, that there apparently is nothing
wrong with it (in this particular case). I wish for verification.

As a developement box I run a W2K, newest Apache and PHP 4.0.whatnot.
Had this problem of first page loaded not getting a SID. It required
reloading once, before sessions started working for itself. Impossible
to accept, since login (through a different file) is possible straight
from this page. Header(location: referer etc) sending me back to the
unsessioned page. No amount of forceful SID entries helped. Got very
annoyed and pulled one of those sure-to-work hello world programs:

?
session_start();
session_register(SESSION);

if (! isset($SESSION)) {
 $SESSION[count] = 0;
 echo liCounter initialized, please reload this page to see it
increment;
} else {
 echo liWaking up session $PHPSESSID;
 $SESSION[count]++;
}
echo liThe counter is now $SESSION[count] ;
?

Guess what, it did not work either. Except that it did, uploaded to the
providers server (basic unix stuff. More or less the same version on
PHP), as did my own script. Now why is that?

Does someone know a explanation/remedy for this, since it makes
developing slightly inconsistent with this requiring that gimmick and
that not.

Regards to anyone caring to answer.

- Jon Thompson Coon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] passing variables between scripts?

2001-08-31 Thread Jon Thompson Coon

I can't cope the fact that I loose my variables every time I reload the
page. If someone could point me to the right direction, I'd be grateful.

Present problem:

I have a script that has some globals (surprise). Within this script,
pretty deep in a function call tree, a function saves a query into an
array and saves it to a global. Then an user makes an selection and the
script reloads itself. After this I'd like to my hands on the saved
query, but the global variable where it's saved seems to get initialised
on reload. How to get around this? Sessions? I'm pretty new (a
forthnight and wery little documentation) to server side programming, so
I'm probably misunderstanding some basics.

Most of my problems are related to this area, so anyone bold enough to
anwer will probably pounded with several questions more.

Thank you in advance
Jon Thompson Coon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: passing variables between scripts? End of story

2001-08-31 Thread Jon Thompson Coon

Thank you. Question answered. Several times over.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Might just be a typo, but...

2001-08-31 Thread Jon Thompson Coon

Hey, you people are great. 5 reasonable answers to a 1 silly problem
within the hour. I'll exploit your goodwill. Here's the next one, this
is about objects (in finnish):

class Example {
   var $list;   // Here I set the problem
   var $hinta;
var $määrä;

function Example()
{
$hinta = 0;
$määrä = 0;
$list  = array();  // Initialised
}

function addToExample($object)
{
array_push($this-list, $object); // I've been over it a hundred
times, but...
}
}

when I call the function instanceOfExample-addToExample($object) I get:

Warning: First argument to array_push() needs to be an array in xxx on
line xx

I know what this means, I also 'know' that there should not be any
mistakes in that code. Mebbe a peculiarity I don't know of?

Thanks
- jon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Might just be a typo, but...

2001-08-31 Thread Jon Thompson Coon

 Here are your mistakes! This lines should be:

  $this-hinta = 0;
  $this-määrä = 0;
  $this-list  = array();  // Initialised

 Thats because you haven't initiallized $this-list, but $list, that is
 internal to the Example function (in this case the constructor).

Thats just it. I'm blind to these kinds of mistakes with PHP and other
assorted languages. I'm a java guy, and the syntax in that language is just
wonderful for dysleksic guys like me. Guess how many hours i've been looking
for missing $:s.

Soon I'll come up with a demanding question.

- jon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]