FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » initial value
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
initial value [message #171152] Tue, 28 December 2010 16:30 Go to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
$year=$_GET(yearID)
echo $year

Works just fine except for one thing.
When the page is initially loaded, there is nothing in the space.
I want to show a year in the space as the default.
So that $year should have a value other than null.
How is that done?
Re: initial value [message #171153 is a reply to message #171152] Tue, 28 December 2010 16:44 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 28-12-10 17:30, richard wrote:
> $year=
> echo $year
>
> Works just fine except for one thing.
> When the page is initially loaded, there is nothing in the space.
> I want to show a year in the space as the default.
> So that $year should have a value other than null.
> How is that done?

if (isset($_GET(yearID)) {
$year=$_GET(yearID)
} else {
$year=2010
}

http://php.net/manual/en/function.isset.php

--
Luuk
Re: initial value [message #171154 is a reply to message #171152] Tue, 28 December 2010 16:47 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
On Dec 28, 4:30 pm, richard <mem...@newsguy.com> wrote:
> $year=$_GET(yearID)
> echo $year
>
> Works just fine except for one thing.
> When the page is initially loaded, there is nothing in the space.
> I want to show a year in the space as the default.
> So that $year should have a value other than null.
> How is that done?

I assume that since it is you coding this, you haven't actually
defined yearID as a constant!
Re: initial value [message #171155 is a reply to message #171153] Tue, 28 December 2010 17:08 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 28-12-10 17:44, Luuk wrote:
> On 28-12-10 17:30, richard wrote:
>> $year=
>> echo $year
>>
>> Works just fine except for one thing.
>> When the page is initially loaded, there is nothing in the space.
>> I want to show a year in the space as the default.
>> So that $year should have a value other than null.
>> How is that done?
>
> if (isset($_GET["yearID"]) {
> $year=$_GET["yearID"]
> } else {
> $year=2010
> }
>
> http://php.net/manual/en/function.isset.php
>

changeD code above, because of:
http://php.net/manual/pt_BR/reserved.variables.get.php

--
Luuk
Re: initial value [message #171156 is a reply to message #171153] Tue, 28 December 2010 17:15 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
On Tue, 28 Dec 2010 17:44:48 +0100, Luuk wrote:

> On 28-12-10 17:30, richard wrote:
>> $year=
>> echo $year
>>
>> Works just fine except for one thing.
>> When the page is initially loaded, there is nothing in the space.
>> I want to show a year in the space as the default.
>> So that $year should have a value other than null.
>> How is that done?
>
> if (isset($_GET(yearID)) {
> $year=$_GET(yearID)
> } else {
> $year=2010
> }
>
> http://php.net/manual/en/function.isset.php

Thanks for the offer. Just one problem, I get this error message.
Fatal Error, Can't use function return value in write context.
Re: initial value [message #171157 is a reply to message #171154] Tue, 28 December 2010 17:16 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
On Tue, 28 Dec 2010 08:47:31 -0800 (PST), Captain Paralytic wrote:

> On Dec 28, 4:30 pm, richard <mem...@newsguy.com> wrote:
>> $year=$_GET(yearID)
>> echo $year
>>
>> Works just fine except for one thing.
>> When the page is initially loaded, there is nothing in the space.
>> I want to show a year in the space as the default.
>> So that $year should have a value other than null.
>> How is that done?
>
> I assume that since it is you coding this, you haven't actually
> defined yearID as a constant!

I tried that too.
Re: initial value [message #171158 is a reply to message #171152] Tue, 28 December 2010 17:20 Go to previous messageGo to next message
Helmut Chang is currently offline  Helmut Chang
Messages: 22
Registered: September 2010
Karma: 0
Junior Member
Am 28.12.2010 17:30, schrieb richard:
> $year=$_GET(yearID)
> echo $year
>
> Works just fine except for one thing.

Don't think so.

1. $_GET is an array and elements in an array are accessed by square
brackets:

$_GET[] not $_GET()

2. As long, as yearID is not defined as constants, but you mean the
string 'yearID', you should use '':

$_GET['yearID'] instead of $_GET[yearID]

> When the page is initially loaded, there is nothing in the space.
> I want to show a year in the space as the default.
> So that $year should have a value other than null.
> How is that done?

In initializing the variable with a default value:

$year = 2010;

if (isset($_GET['yearID']))
$year = $_GET['yearID'];

Helmut
Re: initial value [message #171159 is a reply to message #171157] Tue, 28 December 2010 17:25 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
On Dec 28, 5:16 pm, richard <mem...@newsguy.com> wrote:
> On Tue, 28 Dec 2010 08:47:31 -0800 (PST), Captain Paralytic wrote:
>> On Dec 28, 4:30 pm, richard <mem...@newsguy.com> wrote:
>>> $year=$_GET(yearID)
>>> echo $year
>
>>> Works just fine except for one thing.
>>> When the page is initially loaded, there is nothing in the space.
>>> I want to show a year in the space as the default.
>>> So that $year should have a value other than null.
>>> How is that done?
>
>> I assume that since it is you coding this, you haven't actually
>> defined yearID as a constant!
>
> I tried that too.

I wasn't suggesting that that was the cause of this problem, just that
it was yet another bit of extremely basic php that you haven't
bothered to master.

Your scatter gun approach to programming would be funny if it wasn't
so tragic.
Re: initial value [message #171160 is a reply to message #171158] Tue, 28 December 2010 17:37 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
On Dec 28, 5:20 pm, Helmut Chang <use...@helmutchang.at> wrote:
> Am 28.12.2010 17:30, schrieb richard:
>
>> $year=$_GET(yearID)
>> echo $year
>
>> Works just fine except for one thing.
>
> Don't think so.
>
> 1. $_GET is an array and elements in an array are accessed by square
>     brackets:
>
> $_GET[] not $_GET()
>
> 2. As long, as yearID is not defined as constants, but you mean the
>     string 'yearID', you should use '':
>
> $_GET['yearID'] instead of $_GET[yearID]
>
>> When the page is initially loaded, there is nothing in the space.
>> I want to show a year in the space as the default.
>> So that $year should have a value other than null.
>> How is that done?
>
> In initializing the variable with a default value:
>
> $year = 2010;
>
> if (isset($_GET['yearID']))
>    $year = $_GET['yearID'];
>
> Helmut

Ahh but Richard and that other rather famous lady JRough don't program
in normal php. They use the infinite monkeys variant. That's the one
where you type random characters and hope that eventually a working
php program will be produced.
Re: initial value [message #171161 is a reply to message #171160] Tue, 28 December 2010 18:04 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 28-12-10 18:37, Captain Paralytic wrote:
>
> Ahh but Richard and that other rather famous lady JRough don't program
> in normal php. They use the infinite monkeys variant. That's the one
> where you type random characters and hope that eventually a working
> php program will be produced.

?

--
Luuk
Re: initial value [message #171162 is a reply to message #171161] Tue, 28 December 2010 18:13 Go to previous messageGo to next message
Kim Andr Aker is currently offline  Kim Andr Aker
Messages: 17
Registered: September 2010
Karma: 0
Junior Member
PÃ¥ Tue, 28 Dec 2010 19:04:23 +0100, skrev Luuk <Luuk(at)invalid(dot)lan>:

> On 28-12-10 18:37, Captain Paralytic wrote:
>>
>> Ahh but Richard and that other rather famous lady JRough don't program
>> in normal php. They use the infinite monkeys variant. That's the one
>> where you type random characters and hope that eventually a working
>> php program will be produced.
>
> ?

So you've never heard about the infinite monkeys variant?

Here's some reading material for you, then:
http://en.wikipedia.org/wiki/Infinite_monkey_theorem

Or, more simplified:
http://simple.wikipedia.org/wiki/Infinite_monkey_theorem

--
Kim André Akerø
- kimandre(at)NOSPAMbetadome(dot)com
(remove NOSPAM to contact me directly)
Re: initial value [message #171163 is a reply to message #171162] Tue, 28 December 2010 18:22 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 28-12-10 19:13, Kim André Akerø wrote:
> PÃ¥ Tue, 28 Dec 2010 19:04:23 +0100, skrev Luuk <Luuk(at)invalid(dot)lan>:
>
>> On 28-12-10 18:37, Captain Paralytic wrote:
>>>
>>> Ahh but Richard and that other rather famous lady JRough don't program
>>> in normal php. They use the infinite monkeys variant. That's the one
>>> where you type random characters and hope that eventually a working
>>> php program will be produced.
>>
>> ?
>
> So you've never heard about the infinite monkeys variant?
>
> Here's some reading material for you, then:
> http://en.wikipedia.org/wiki/Infinite_monkey_theorem
>
> Or, more simplified:
> http://simple.wikipedia.org/wiki/Infinite_monkey_theorem
>

No, i heard that one, although it was some years ago....

--
Luuk
Re: initial value [message #171164 is a reply to message #171162] Tue, 28 December 2010 18:59 Go to previous messageGo to next message
Beauregard T. Shagnas is currently offline  Beauregard T. Shagnas
Messages: 154
Registered: September 2010
Karma: 0
Senior Member
Kim André Akerø wrote:

> skrev Luuk <Luuk(at)invalid(dot)lan>:
>> Captain Paralytic wrote:
>>> Ahh but Richard and that other rather famous lady JRough don't
>>> program in normal php. They use the infinite monkeys variant.
>>> That's the one where you type random characters and hope that
>>> eventually a working php program will be produced.
>>
>> ?
>
> So you've never heard about the infinite monkeys variant?

Don't forget to add, say, Googling for: "richard the st00pid" !!
The Captain's note about scattergun programming is spot on, too.

--
-bts
-Four wheels carry the body; two wheels move the soul
Re: initial value [message #171165 is a reply to message #171159] Tue, 28 December 2010 19:02 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
On Tue, 28 Dec 2010 09:25:48 -0800 (PST), Captain Paralytic wrote:

> On Dec 28, 5:16 pm, richard <mem...@newsguy.com> wrote:
>> On Tue, 28 Dec 2010 08:47:31 -0800 (PST), Captain Paralytic wrote:
>>> On Dec 28, 4:30 pm, richard <mem...@newsguy.com> wrote:
>>>> $year=$_GET(yearID)
>>>> echo $year
>>
>>>> Works just fine except for one thing.
>>>> When the page is initially loaded, there is nothing in the space.
>>>> I want to show a year in the space as the default.
>>>> So that $year should have a value other than null.
>>>> How is that done?
>>
>>> I assume that since it is you coding this, you haven't actually
>>> defined yearID as a constant!
>>
>> I tried that too.
>
> I wasn't suggesting that that was the cause of this problem, just that
> it was yet another bit of extremely basic php that you haven't
> bothered to master.
>
> Your scatter gun approach to programming would be funny if it wasn't
> so tragic.

Ah yes, we forget how we learn things don't we?
When you first got that amazing contraption called a computer, you were
such an expert with it and all of it's magical wonders.

As a child we see our friends all riding their bicycles. You want to do it
too. So the expert you are, you just get up on the thing and start pedaling
around. Never once falling down and getting hurt.

So knowing that you are such an expert in everything, I must bow to your
superior intelligence, and run off to the porcelain bowl to puke my brains
out.
Re: initial value [message #171166 is a reply to message #171160] Tue, 28 December 2010 19:06 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
On Tue, 28 Dec 2010 09:37:13 -0800 (PST), Captain Paralytic wrote:

> On Dec 28, 5:20 pm, Helmut Chang <use...@helmutchang.at> wrote:
>> Am 28.12.2010 17:30, schrieb richard:
>>
>>> $year=$_GET(yearID)
>>> echo $year
>>
>>> Works just fine except for one thing.
>>
>> Don't think so.
>>
>> 1. $_GET is an array and elements in an array are accessed by square
>>     brackets:
>>
>> $_GET[] not $_GET()
>>
>> 2. As long, as yearID is not defined as constants, but you mean the
>>     string 'yearID', you should use '':
>>
>> $_GET['yearID'] instead of $_GET[yearID]
>>
>>> When the page is initially loaded, there is nothing in the space.
>>> I want to show a year in the space as the default.
>>> So that $year should have a value other than null.
>>> How is that done?
>>
>> In initializing the variable with a default value:
>>
>> $year = 2010;
>>
>> if (isset($_GET['yearID']))
>>    $year = $_GET['yearID'];
>>
>> Helmut
>
> Ahh but Richard and that other rather famous lady JRough don't program
> in normal php. They use the infinite monkeys variant. That's the one
> where you type random characters and hope that eventually a working
> php program will be produced.

Before I go asking questions here, I do tons of research. Do you know what
a bitch it is looking for a simple answer through google? Weeding through
hundreds of links that wind up having nothing to my benefit?

Oh, but you're the expert and never ask questions.

Even expert mechanics who work on multimillion dollar race cars carry
manuals with them. Why? In case they don't have the immediate answer in
their brain.
Re: initial value [message #171167 is a reply to message #171164] Tue, 28 December 2010 19:24 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
On Tue, 28 Dec 2010 13:59:50 -0500, Beauregard T. Shagnasty wrote:

> Kim André Akerø wrote:
>
>> skrev Luuk <Luuk(at)invalid(dot)lan>:
>>> Captain Paralytic wrote:
>>>> Ahh but Richard and that other rather famous lady JRough don't
>>>> program in normal php. They use the infinite monkeys variant.
>>>> That's the one where you type random characters and hope that
>>>> eventually a working php program will be produced.
>>>
>>> ?
>>
>> So you've never heard about the infinite monkeys variant?
>
> Don't forget to add, say, Googling for: "richard the st00pid" !!
> The Captain's note about scattergun programming is spot on, too.

The other resident expert on all subjects speaks.
BTS graduated from college with a masters degree in everything at the age
of two.
Re: initial value [message #171168 is a reply to message #171167] Tue, 28 December 2010 19:55 Go to previous messageGo to next message
Beauregard T. Shagnas is currently offline  Beauregard T. Shagnas
Messages: 154
Registered: September 2010
Karma: 0
Senior Member
richard the sto0pid wrote:

> Beauregard T. Shagnasty wrote:
>> Don't forget to add, say, Googling for: "richard the st00pid" !!
>> The Captain's note about scattergun programming is spot on, too.
>
> The other resident expert on all subjects speaks.

Thank you for the compliment.

> BTS graduated from college with a masters degree in everything at the
> age of two.

No, you're wrong. I was 23. And I'll even tell you which college if you
will list your truck driver's school.

--
-bts
-It's "its", not "it's"
Re: initial value [message #171169 is a reply to message #171156] Tue, 28 December 2010 20:01 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On 28/12/10 17:15, richard wrote:
> On Tue, 28 Dec 2010 17:44:48 +0100, Luuk wrote:
>
>> On 28-12-10 17:30, richard wrote:
>>> $year=
>>> echo $year
>>>
>>> Works just fine except for one thing.
>>> When the page is initially loaded, there is nothing in the space.
>>> I want to show a year in the space as the default.
>>> So that $year should have a value other than null.
>>> How is that done?
>>
>> if (isset($_GET(yearID)) {
>> $year=$_GET(yearID)
>> } else {
>> $year=2010
>> }
>>
>> http://php.net/manual/en/function.isset.php
>
> Thanks for the offer. Just one problem, I get this error message.
> Fatal Error, Can't use function return value in write context.

// default value
$year = "2020";
// over-ride with content of get if defined
if (isset($_GET["yearID"])) $year=$_GET["yearID"];

Rgds

Denis McMahon
Re: initial value [message #171171 is a reply to message #171158] Tue, 28 December 2010 20:41 Go to previous messageGo to next message
Chuck Anderson is currently offline  Chuck Anderson
Messages: 63
Registered: September 2010
Karma: 0
Member
Helmut Chang wrote:
> Am 28.12.2010 17:30, schrieb richard:
>> $year=$_GET(yearID)
>> echo $year
>>
>> Works just fine except for one thing.
>
> Don't think so.
>
> 1. $_GET is an array and elements in an array are accessed by square
> brackets:
>
> $_GET[] not $_GET()
>
> 2. As long, as yearID is not defined as constants, but you mean the
> string 'yearID', you should use '':
>
> $_GET['yearID'] instead of $_GET[yearID]
>
>> When the page is initially loaded, there is nothing in the space.
>> I want to show a year in the space as the default.
>> So that $year should have a value other than null.
>> How is that done?
>
> In initializing the variable with a default value:
>
> $year = 2010;

Just a minor addition. Make it perpetual and change that to:

$year = date('Y);

And note: The word "initial" in the subject is they key here. Even
though Php does not require it, it is always best to initialize
("define") your variables before using them, usually near the top of the
script where it easy to see what variables are used (documentation).

>
> if (isset($_GET['yearID']))
> $year = $_GET['yearID'];
>
Re: initial value [message #171172 is a reply to message #171165] Tue, 28 December 2010 20:57 Go to previous messageGo to next message
Sherm Pendley is currently offline  Sherm Pendley
Messages: 33
Registered: September 2010
Karma: 0
Member
richard <member(at)newsguy(dot)com> writes:

> On Tue, 28 Dec 2010 09:25:48 -0800 (PST), Captain Paralytic wrote:
>
>> Your scatter gun approach to programming would be funny if it wasn't
>> so tragic.
>
> Ah yes, we forget how we learn things don't we?

No. Quite the opposite in fact - I remember quite well how I learned
to program. The scatter gun approach you're taking isn't it.

> When you first got that amazing contraption called a computer, you were
> such an expert with it and all of it's magical wonders.

No, but I *was* willing to take a methodical, scientific approach to
learning about it. I didn't just hammer away at random and hope for
the best. I thought about what I wanted to write, then, when (not if)
what I wrote didn't do what I expected, I carefully examined what it
*did* do, to learn why my expectations were inaccurate.

> As a child we see our friends all riding their bicycles. You want to do it
> too. So the expert you are, you just get up on the thing and start pedaling
> around. Never once falling down and getting hurt.
>
> So knowing that you are such an expert in everything, I must bow to your
> superior intelligence, and run off to the porcelain bowl to puke my brains
> out.

You seem to have missed the point. Captain P. isn't chastising you for
needing to learn; he's pointing out that the approach you're taking isn't
a very effective way to go about it.

A million monkeys hammering away at random may eventually produce the
complete works of Shakespeare. But they'd have learned nothing by doing
so, and they'd be no better equipped to tackle another project than
they were before they started.

sherm--

--
Sherm Pendley
<http://camelbones.sourceforge.net>
Cocoa Developer
Re: initial value [message #171176 is a reply to message #171165] Tue, 28 December 2010 22:32 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
On Dec 28, 7:02 pm, richard <mem...@newsguy.com> wrote:
> On Tue, 28 Dec 2010 09:25:48 -0800 (PST), Captain Paralytic wrote:
>> On Dec 28, 5:16 pm, richard <mem...@newsguy.com> wrote:
>>> On Tue, 28 Dec 2010 08:47:31 -0800 (PST), Captain Paralytic wrote:
>>>> On Dec 28, 4:30 pm, richard <mem...@newsguy.com> wrote:
>>>> > $year=$_GET(yearID)
>>>> > echo $year
>
>>>> > Works just fine except for one thing.
>>>> > When the page is initially loaded, there is nothing in the space.
>>>> > I want to show a year in the space as the default.
>>>> > So that $year should have a value other than null.
>>>> > How is that done?
>
>>>> I assume that since it is you coding this, you haven't actually
>>>> defined yearID as a constant!
>
>>> I tried that too.
>
>> I wasn't suggesting that that was the cause of this problem, just that
>> it was yet another bit of extremely basic php that you haven't
>> bothered to master.
>
>> Your scatter gun approach to programming would be funny if it wasn't
>> so tragic.
>
> Ah yes, we forget how we learn things don't we?
> When you first got that amazing contraption called a computer, you were
> such an expert with it and all of it's magical wonders.

Ahh but we are not talking about the same thing here. Your first post
in CLP was in August 2008, with a large gap till November 2009. You
have thus been "learning" php for over a year. I do not consider that
"over a year" can be considered as "first getting a computer".

In over a year, you still do not know the basics. This is typical for
people such as you and JRough who show no aptitude for computer
programming. Neither of you have been able to pick up the basics and
both of you just type any old thing and then post here when,
surprisingly, the stuff you typed didn't work.

I am certainly far from an expert in php, but it didn't take me more
than a couple of weeks to pick up the basic syntax after I read the
manual.
Re: initial value [message #171177 is a reply to message #171166] Tue, 28 December 2010 22:34 Go to previous messageGo to next message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma: 0
Senior Member
On Dec 28, 7:06 pm, richard <mem...@newsguy.com> wrote:
> On Tue, 28 Dec 2010 09:37:13 -0800 (PST), Captain Paralytic wrote:
>> On Dec 28, 5:20 pm, Helmut Chang <use...@helmutchang.at> wrote:
>>> Am 28.12.2010 17:30, schrieb richard:
>
>>>> $year=$_GET(yearID)
>>>> echo $year
>
>>>> Works just fine except for one thing.
>
>>> Don't think so.
>
>>> 1. $_GET is an array and elements in an array are accessed by square
>>>     brackets:
>
>>> $_GET[] not $_GET()
>
>>> 2. As long, as yearID is not defined as constants, but you mean the
>>>     string 'yearID', you should use '':
>
>>> $_GET['yearID'] instead of $_GET[yearID]
>
>>>> When the page is initially loaded, there is nothing in the space.
>>>> I want to show a year in the space as the default.
>>>> So that $year should have a value other than null.
>>>> How is that done?
>
>>> In initializing the variable with a default value:
>
>>> $year = 2010;
>
>>> if (isset($_GET['yearID']))
>>>    $year = $_GET['yearID'];
>
>>> Helmut
>
>> Ahh but Richard and that other rather famous lady JRough don't program
>> in normal php. They use the infinite monkeys variant. That's the one
>> where you type random characters and hope that eventually a working
>> php program will be produced.
>
> Before I go asking questions here, I do tons of research. Do you know what
> a bitch it is looking for a simple answer through google? Weeding through
> hundreds of links that wind up having nothing to my benefit?
>
> Oh, but you're the expert and never ask questions.
>
> Even expert mechanics who work on multimillion dollar race cars carry
> manuals with them. Why? In case they don't have the immediate answer in
> their brain.

So true, which is why I constantly refer to the php manual.

A pity you don't do the same. Or if you do but you simply do not
understand it, that should be telling you something important.
Re: initial value [message #171179 is a reply to message #171166] Wed, 29 December 2010 00:04 Go to previous messageGo to next message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
richard wrote:

> On Tue, 28 Dec 2010 09:37:13 -0800 (PST), Captain Paralytic wrote:
>> On Dec 28, 5:20 pm, Helmut Chang <use...@helmutchang.at> wrote:
>>> Am 28.12.2010 17:30, schrieb richard:
>>>
>>>> $year=$_GET(yearID)
>>>> echo $year
>>>
>>>> Works just fine except for one thing.
>>>
>>> Don't think so.
>>>
>>> 1. $_GET is an array and elements in an array are accessed by square
>>> brackets:
>>>
>>> $_GET[] not $_GET()
>>> […]
>>
>> Ahh but Richard and that other rather famous lady JRough don't program
>> in normal php. They use the infinite monkeys variant. That's the one
>> where you type random characters and hope that eventually a working
>> php program will be produced.
>
> Before I go asking questions here, I do tons of research. [snip whining]

You have not even managed to post executable code.


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(at)news(dot)demon(dot)co(dot)uk>
Re: initial value [message #171180 is a reply to message #171169] Wed, 29 December 2010 00:20 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
Denis McMahon wrote:
> On 28/12/10 17:15, richard wrote:
>> On Tue, 28 Dec 2010 17:44:48 +0100, Luuk wrote:
>>
>>> On 28-12-10 17:30, richard wrote:
>>>> $year=
>>>> echo $year
>>>>
>>>> Works just fine except for one thing.
>>>> When the page is initially loaded, there is nothing in the space.
>>>> I want to show a year in the space as the default.
>>>> So that $year should have a value other than null.
>>>> How is that done?
>>> if (isset($_GET(yearID)) {
>>> $year=$_GET(yearID)
>>> } else {
>>> $year=2010
>>> }
>>>
>>> http://php.net/manual/en/function.isset.php
>> Thanks for the offer. Just one problem, I get this error message.
>> Fatal Error, Can't use function return value in write context.
>
> // default value
> $year = "2020";
> // over-ride with content of get if defined
> if (isset($_GET["yearID"])) $year=$_GET["yearID"];
>
> Rgds
>
> Denis McMahon

$year = isset($_GET['yearID']) ? $_GET['yearID'] : date('Y');

--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
Re: initial value [message #171187 is a reply to message #171165] Wed, 29 December 2010 04:39 Go to previous messageGo to next message
Evan Platt is currently offline  Evan Platt
Messages: 124
Registered: November 2010
Karma: 0
Senior Member
On Tue, 28 Dec 2010 12:02:02 -0700, richard <member(at)newsguy(dot)com>
wrote:

> off to the porcelain bowl to puke my brains out.

What brains?
--
To reply via e-mail, remove The Obvious and .invalid from my e-mail address.
Re: initial value [message #171195 is a reply to message #171164] Wed, 29 December 2010 07:15 Go to previous messageGo to next message
Kim Andr Aker is currently offline  Kim Andr Aker
Messages: 17
Registered: September 2010
Karma: 0
Junior Member
PÃ¥ Tue, 28 Dec 2010 19:59:50 +0100, skrev Beauregard T. Shagnasty
<a(dot)nony(dot)mous(at)example(dot)invalid>:

> Kim André Akerø wrote:
>
>> skrev Luuk <Luuk(at)invalid(dot)lan>:
>>> Captain Paralytic wrote:
>>>> Ahh but Richard and that other rather famous lady JRough don't
>>>> program in normal php. They use the infinite monkeys variant.
>>>> That's the one where you type random characters and hope that
>>>> eventually a working php program will be produced.
>>>
>>> ?
>>
>> So you've never heard about the infinite monkeys variant?
>
> Don't forget to add, say, Googling for: "richard the st00pid" !!
> The Captain's note about scattergun programming is spot on, too.

You're stilling going on and on with that one, eh?

Whenever I see someone using that particular spelling of "stupid", I tend
to imagine a blabbering idiot with poor drool control. To be honest,
you're about to negate your own education here, in the sense that your
attempt to drag the other person into the mud makes you go way beyond low
(more of a lower life form than the person you're trying to offend,
actually).

The mere thought of typing that spelling variant is cringeworthy in itself
(even copy+pasting it makes me uneasy), I hope you improve on yourself and
rise above such troll behavior in the future. For all I know, this
"richard" may be a bastard of some sorts, but your approach in bringing
said information to the public is even worse.

For everyone else out there reading this, I apologize. There comes a time
where something like this just makes me want to let out the steam for a
bit. I'm done now (at least, for a while). There, I said it.

--
Kim André Akerø
- kimandre(at)NOSPAMbetadome(dot)com
(remove NOSPAM to contact me directly)
Re: initial value [message #171198 is a reply to message #171180] Wed, 29 December 2010 11:48 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
Norman Peelman wrote:
> Denis McMahon wrote:
>> On 28/12/10 17:15, richard wrote:
>>> On Tue, 28 Dec 2010 17:44:48 +0100, Luuk wrote:
>>>
>>>> On 28-12-10 17:30, richard wrote:
>>>> > $year=
>>>> > echo $year
>>>> >
>>>> > Works just fine except for one thing.
>>>> > When the page is initially loaded, there is nothing in the space.
>>>> > I want to show a year in the space as the default.
>>>> > So that $year should have a value other than null.
>>>> > How is that done?
>>>> if (isset($_GET(yearID)) {
>>>> $year=$_GET(yearID)
>>>> } else {
>>>> $year=2010
>>>> }
>>>>
>>>> http://php.net/manual/en/function.isset.php
>>> Thanks for the offer. Just one problem, I get this error message.
>>> Fatal Error, Can't use function return value in write context.
>>
>> // default value
>> $year = "2020";
>> // over-ride with content of get if defined
>> if (isset($_GET["yearID"])) $year=$_GET["yearID"];
>>
>> Rgds
>>
>> Denis McMahon
>
> $year = isset($_GET['yearID']) ? $_GET['yearID'] : date('Y');
>

I should add that you should ensure that $_GET['yearID'] (or $year at
this point) actually contains what you think it should by use of a
sanitizing function as well.

--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
Re: initial value [message #171219 is a reply to message #171195] Wed, 29 December 2010 16:57 Go to previous messageGo to next message
Evan Platt is currently offline  Evan Platt
Messages: 124
Registered: November 2010
Karma: 0
Senior Member
On Wed, 29 Dec 2010 08:15:06 +0100, Kim André Akerø
<kimandre(at)nospambetadome(dot)com> wrote:

> You're stilling going on and on with that one, eh?
>
> Whenever I see someone using that particular spelling of "stupid", I tend
> to imagine a blabbering idiot with poor drool control.

That's an accurate picture of richard. That's HIS title, self
proclaimed. He's proud of it, too.

He believes men have more ribs than women, that women don't have Adams
Apples, and that Dubai is in Africa.

> For everyone else out there reading this, I apologize. There comes a time
> where something like this just makes me want to let out the steam for a
> bit. I'm done now (at least, for a while). There, I said it.

I think most of us are fed up with bullshit bullis (richard), and not
willing to help him.

Just recently, in an other group, he asked for help with a image he
wanted to OCR (convert into text). Someone actually converted it for
him and pasted the entire contents of the page.
His response was something close to "Thanks, asshole, now do the other
47 pages".

A week later, he asked for help in finding a song. Ignoring the
suggestions of others not to help the bastard, someone found the song
he wanted, compressed it into a RAR file, and put it on a file share
site, and replied with the link.

richard's reply: "I don't do RAR. Put it in another format."

So I think you'll find most people aren't willing to help the prick.

I have NEVER once seen him say "Thanks for your help."
--
To reply via e-mail, remove The Obvious and .invalid from my e-mail address.
Re: initial value [message #171266 is a reply to message #171166] Wed, 29 December 2010 22:41 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <qkb0c7gf2cwh(dot)dlg(at)evanplatt(dot)sux>,
richard <member(at)newsguy(dot)com> wrote:

> On Tue, 28 Dec 2010 09:37:13 -0800 (PST), Captain Paralytic wrote:
>
>> On Dec 28, 5:20
Re: initial value [message #171286 is a reply to message #171219] Thu, 30 December 2010 01:30 Go to previous messageGo to next message
Kim Andr Aker is currently offline  Kim Andr Aker
Messages: 17
Registered: September 2010
Karma: 0
Junior Member
PÃ¥ Wed, 29 Dec 2010 17:57:55 +0100, skrev Evan Platt
<evan(at)theobvious(dot)espphotography(dot)com>:

> On Wed, 29 Dec 2010 08:15:06 +0100, Kim André Akerø
> <kimandre(at)nospambetadome(dot)com> wrote:
>
>> You're still going on and on with that one, eh?
>>
>> Whenever I see someone using that particular spelling of "stupid", I
>> tend
>> to imagine a blabbering idiot with poor drool control.
>
> That's an accurate picture of richard. That's HIS title, self
> proclaimed. He's proud of it, too.
>
> He believes men have more ribs than women, that women don't have Adams
> Apples, and that Dubai is in Africa.
>
>> For everyone else out there reading this, I apologize. There comes a
>> time
>> where something like this just makes me want to let out the steam for a
>> bit. I'm done now (at least, for a while). There, I said it.
>
> I think most of us are fed up with bullshit bullis (richard), and not
> willing to help him.
>
> Just recently, in an other group, he asked for help with a image he
> wanted to OCR (convert into text). Someone actually converted it for
> him and pasted the entire contents of the page.
> His response was something close to "Thanks, asshole, now do the other
> 47 pages".
>
> A week later, he asked for help in finding a song. Ignoring the
> suggestions of others not to help the bastard, someone found the song
> he wanted, compressed it into a RAR file, and put it on a file share
> site, and replied with the link.
>
> richard's reply: "I don't do RAR. Put it in another format."
>
> So I think you'll find most people aren't willing to help the prick.
>
> I have NEVER once seen him say "Thanks for your help."

Honestly, I'm only vaguely familiar with the name Richard Bullis (and I do
mean /vaguely/), and just about every story I've read about him while I've
been on Usenet comes from the keyboards of people such as yourself.

If he's such an asshole about gratitude, and your unwillingness to help
comes from that, just ignore him, then. Nobody has said that you *have* to
write a helpful response to any newsgroup thread. But to reply to the
thread to criticize people who *do* write helpful responses, just because
the person being helped is usually a prick, now that takes a special kind
of asshole. If you're only coming out of the woodwork in an otherwise
professional forum (or, in this case, newsgroup) just to point out that
someone's an asshole, you're pretty much giving yourself that label as
well. Just let someone else deal with his behavior and see it for
themselves rather than pointing it out beforehand to provoke some sort of
reaction.

Aaaaand I'm done responding to the response to my vent from earlier.

--
Kim André Akerø
- kimandre(at)NOSPAMbetadome(dot)com
(remove NOSPAM to contact me directly)
Re: initial value [message #171295 is a reply to message #171165] Thu, 30 December 2010 03:05 Go to previous message
Leonardo Azpurua is currently offline  Leonardo Azpurua
Messages: 46
Registered: December 2010
Karma: 0
Member
"richard" <member(at)newsguy(dot)com> escribió en el mensaje
news:1axql81cttzz6(dot)dlg(at)evanplatt(dot)sux...
> On Tue, 28 Dec 2010 09:25:48 -0800 (PST), Captain Paralytic wrote:

> Ah yes, we forget how we learn things don't we?
> When you first got that amazing contraption called a computer, you were
> such an expert with it and all of it's magical wonders.

I know how things are learnt and you seem doomed to ethernal ignorance.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Problem Connecting to PHP
Next Topic: Open Session Variables
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 03:31:37 GMT 2024

Total time taken to generate the page: 0.03650 seconds