php-general Digest 29 Apr 2006 23:42:40 -0000 Issue 4100

Topics (messages 235091 through 235123):

Re: PHP Standard style of writing your code
        235091 by: Porpoise
        235092 by: Robert Cummings
        235094 by: Satyam
        235096 by: Rafael
        235097 by: tedd
        235098 by: tedd
        235117 by: Richard Lynch
        235118 by: Miles Thompson
        235121 by: Robert Cummings

Re: cgi.fix_pathinfo and iis 5
        235093 by: Jochem Maas

Re: php <-> js (was Javascript Navigation)
        235095 by: tedd
        235104 by: Jochem Maas

Re: Help!
        235099 by: Jochem Maas
        235112 by: Martin Alterisio
        235114 by: Richard Lynch

XML Parsing, starting out.
        235100 by: sinai.simnet.is
        235113 by: Richard Lynch
        235119 by: Mattias Thorslund
        235122 by: Ólafur Waage

Re: RegExp for preg_split()
        235101 by: Weber Sites LTD
        235103 by: tedd
        235120 by: Rafael

undefined variable
        235102 by: Smart Software
        235111 by: Martin Alterisio
        235115 by: John Wells
        235116 by: Richard Lynch

Re: we are looking for experienced php programmers full time    freelance...
        235105 by: tedd
        235109 by: Paul Novitski
        235110 by: Dave Goodchild

Re: IPN error
        235106 by: Stephen Lake
        235107 by: Stephen Lake

php login
        235108 by: Schalk
        235123 by: chris smith

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---

"Rafael" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]

P.S. What, in your mind, is the advantage of replying after quoting the
original message and not before? :)

In an NG environment, it allows everyone to follow the logic and see clearly what is being replied to, in the correct context.

IMALOOPHO...
--- End Message ---
--- Begin Message ---
On Sat, 2006-04-29 at 03:17, Richard Lynch wrote:
>
> I'll also respond to another poster:
> 
> I personally have no less/more ease in aligning } with a logic
> statement or with another {, *IF* the code is indented properly.
> 
> In other words, the vertical alignment is more a function of the
> indentation, to me, then of a specific character I have to pick out.
> 
> If the code isn't indented properly, well, then, the alignment of
> whatever you do vertically doesn't matter much, eh?

Tis true, I think mostly I just prefer the visual appeal of v-aligned
braces, as you prefer visually the other. I used your style for about 7
years before I switched, and now for whatever internal appraisal reasons
I just find the inline style messy looking :) Although, I'll take it any
day over some of the other styles I've seen.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
On Sat, 2006-04-29 at 03:17, Richard Lynch wrote:

I'll also respond to another poster:

I personally have no less/more ease in aligning } with a logic
statement or with another {, *IF* the code is indented properly.

In other words, the vertical alignment is more a function of the
indentation, to me, then of a specific character I have to pick out.

If the code isn't indented properly, well, then, the alignment of
whatever you do vertically doesn't matter much, eh?

I prefer the opening brace at the end of the line as well. I rather see as much of the code as possible. Wasting one line for an openning brace, and not only function declarations but any opening brace, is a waste of screen space. My eyes are no longer good enough to have microscopic screen resolutions so within the resolution I use plus all the toolboxes, I still want to be able to see a good chunk of the code.

For me, the visual consequence of an opening brace is the indentation of the line following it. The brace by itself is just what tells the compiler to start the statement block. The visual clue, for me, is the indentation, something I am very strict about. The compiler cannot read indentations. So, since the brace is for the benefit of the compiler, not mine, I don't devote a whole line to it. Braces for the compiler, indentation for me.

And it is not that I don't like to waste space in general, I am generous with my lines before the function declaration or any other place where I feel it deserves it for clarity. In C I put one or more blank lines in between the local variable declaration and the first executable, that is a space that is worth for clarity sake. I would also put spaces before a #ifdef or after a #endif, those are spaces that say something to me.

A brace on its own line doesn't make sense to me.

Satyam

Satyam

--- End Message ---
--- Begin Message --- Thanks for your reply. Paul Novitski already "talked" with me about it (in private), and my conclusions were...
-----
I guess that has something to do with the way *I* read my mails, since I'm usually aware what people are talking about (since I've wrote the one they're responding, or I've been following the thread)

I think you have a pretty good reason, but I also think it doesn't work for me --since I have to skip the whole message I've already read, or what I wrote :) Thanks for your answer (and so fast)
-----
I guess this is just one more of the too-many-already debatible points out there. At the end, is a matter of taste, I can't see any as the right nor wrong option.

PS I'd ask you a favor: do not include the email in the quotation, since these message are usually available (via http) in some sites, and having my email there makes a lot easier for me to get (even) more spam
PPS     WTF is "IMALOOPHO"?

Porpoise wrote:
"Rafael" <email-was-here> wrote in message news:[EMAIL PROTECTED]

P.S. What, in your mind, is the advantage of replying after quoting the
original message and not before? :)

In an NG environment, it allows everyone to follow the logic and see clearly what is being replied to, in the correct context.

IMALOOPHO...
--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
http://www.innox.com.mx

--- End Message ---
--- Begin Message ---
At 2:12 AM -0500 4/29/06, Richard Lynch wrote:
But I'm totally serious here -- I made this decision in college circa
1981, and I wrote the same long program both ways, and hung the two
versions up on the wall side-by-side, and I liked the one with { on
the same lines better.

I even solicited my non-programmer roommates' opinions, and they also
preferred the braces on the same line as ASCII art.

Well, that settles it -- if non-programmers like it, then it must be correct. :-)

It reminds of a time where a large oil company's "Geophysicist" was evaluating other consulting Geophysicist's work (I was one -- see http://geophysics.com ). He took our work product (highly technical seismic displays) and hung them on a wall and had everyone in the office (accountants, secretaries, UPS delivery man, etc.) parade by and pick the display they thought looked the best. To the winner, he awarded a multimillion dollar contract!

It had to be the worst way to evaluate a Geophysicist I have ever witnessed.

-------
I daresay an experienced programmer is going to pick the style they
prefer as "prettier."

I don't know about prettier, but I certainly strive that every piece of code I write to have a consistent style that I recognize as mine. Plus, when I see another programmer use the same style, I naturally assume that he's very intelligent. :-)

Additionally, the style I've developed cuts across several languages I've known.

------
Though it would be an interesting experiment for some psychology
student to A/B compare with programmers, non-programmers, experienced
programmers, etc...

That may be an interesting study as to how we perceive and solve problems -- anal-retentive vs the free-will types and all variations in between. Each, I am sure, has their place in the overall scheme of things.

But, I will pass on to the group here that I have noticed (over the last 40 years ) in my programming that the size of my monitor is generally in direct relationship with the size of my functions.

In addition, the larger my monitors, the more white space I use in making my code "pretty" and documented. In my view, there is no wasted space -- just a way to reduce my confusion.

tedd
--
--------------------------------------------------------------------------------
http://sperling.com

--- End Message ---
--- Begin Message ---
A brace on its own line doesn't make sense to me.

Satyam

As the old lady said, as she kissed the cow "To each their own."

It make perfect sense to me to enclose all blocks of code within braces on their own line AND to indent that entire segment, like so.

function, if, while, switch, whatever...
  {
  // code
  }

But, like I said -- to each their own. The above just makes sense to me and that's what this entire thread should be about -- do whatever makes you comfortable and productive.

The last thing I would want is to have someone tell me what style I *must* use.

tedd
--
--------------------------------------------------------------------------------
http://sperling.com

--- End Message ---
--- Begin Message ---
On Sat, April 29, 2006 9:56 am, Satyam wrote:
> The compiler cannot read
> indentations.
> So, since the brace is for the benefit of the compiler, not mine, I

[pedantic]
Actually, a compiler could use indentation, and, in fact, compilers
for some languages do just that.
[/pedantic]

That style of language definitely sucks, imho, but let's not get THAT
far off-topic, eh?

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
At 03:19 AM 4/29/2006, Robert Cummings wrote:

On Sat, 2006-04-29 at 02:08, Paul Novitski wrote:
> >         IMHO, vertical aligned brackets can be messy when nesting
> >relatively-small blocks (and seems to me like a lot of wasted space)
>
><nsip>
> like a use, not a waste.
>
> OK, OK, I'll stop.  Think I'll go out and get wasted~

Drink with friends... that way you have someone to brace you when you're
fall down drunk.

Cheers,
Rob.

Poorstyle:

drunken(){
        echo "Lopsided me;
}

Goodstyle:

drunken()
{
        echo "Supported me";
}

But the question arises, in "goodstyle" - should one indent the braces?

I used to code "goodstyle", more and more it's "poorstyle" - nad the computer doesn't care, and Ultraedit can match braces, which helps when I get "lost". I wish UE would also fold code.

With tongue firmly in cheek - cheers - Miles



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.385 / Virus Database: 268.5.1/327 - Release Date: 4/28/2006

--- End Message ---
--- Begin Message ---
On Sat, 2006-04-29 at 10:56, Satyam wrote:
>
> A brace on its own line doesn't make sense to me.

This begs the question... Where do you place the closing brace?

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
Mariano Guadagnini wrote:
Mariano Guadagnini wrote:

Hi people,
I have the following issue: I´m using PHP 5 on IIS 5 and Windows XP Pro, and when trying to pass values through the path to my scripts, iis rejects them. After some googling, I found an advice to set AllowPathInfoForScriptMappings variable in iis, but it didn't work either. Finally, I ended up with a solution i found somewhere else, enabling cgi.fix_pathinfo in php.ini . The thing is, that when i restart the server, it seems that php doesn't recognize such variable, as it doesn't apper on phpinfo or ini_get() neither. That looks weird, because in documentation is clearly stated that this variable is available since PHP 4.3.0 .
What can I do to have that setting enabled?

seeing as it has the letters 'CGI' in the ini setting name would
make me think that it's a setting that is only relevant to the cgi
version of php - and I would wager that your probably running the ISS
php module instead - but you don't say which so I'm guessing.

for the rest refer to John Wells' post.

Thanks in advance,

Mariano Guadagnini.


Any ideas?

1 springs to mind: don't double post.




--- End Message ---
--- Begin Message ---
At 4:54 AM -0500 4/29/06, Richard Lynch wrote:

But trying to force JS <-> PHP communication the way you are
describing it is only going to make you very unhappy in the long run.

Been to that dance more than once. But, as Dirty Harry once said "A man's got to know his limitations."

Thanks for all your help -- you guys have been super.

tedd
--
--------------------------------------------------------------------------------
http://sperling.com

--- End Message ---
--- Begin Message ---
hi normally,

tedd wrote:
At 9:03 AM +0200 4/28/06, Barry wrote:

tedd schrieb:

At 5:09 PM +0200 4/27/06, Barry wrote:

tedd schrieb:

Hi gang:

Gang?


Gang, group, clan, community, organization, hive, pod, assembly, biocenosis -- what do you want to be called?


By my name normally.

can I shorten that to 'norm'? or did you mean 'usually' in which case
given that I'm odd/unusual/abnormal can I call you something else?

And if you adress everyone i prefer "everyone"

preferences are like standards - there alot of them.

Two things:

1. My post wasn't by name, but to the list.

2. And, in doing so, I prefer "gang". After all, this is an informal group and everyone is permitted their preferences, right?

tedd - you wanna say 'gang' you do that :-)
you had me a 'hi' ;-) [ok that was a crap Jerry Maguire reference I know.]

--- End Message ---
--- Begin Message ---
Dave Goodchild wrote:
All my variables are correctly delimited.

strings constants are delimited not variables, semantically speaking.

And don't make assumptions about what my code looks like

why not? besides how are you going to stop someone from assuming your
code looks like [x]?

- I am asking for help, not judgements, and my

Richard didn't judge, he merely aired a thought (and added 'if my
theories are correct' for good measure).

 besides you only control the question not the answer.

oh and Richard is one of the best people on this list to be helping you
- alienating him isn't in your best interests.

question was valid (unlike many you see here).

the validity of the question is a matter of consensus, again
something you don't control.

I am not a spammer either,
this is an application for the marketing department of a charity.

charities can potentially spam just as much as anybody - that they happen to
have a 'good cause' doesn't give them a 'get out of jail free' card, they have 
to
obey the email-marketing rules just like any other organization.

<ad>
'buy a lovely WNF cuddly toy to help protect endangered animals'
(hand made by an 8 y/o in china)
</ad>

...

--- End Message ---
--- Begin Message ---
That's ok, but then I can't help you more than I tried to.
Just check with what I told you about debug_backtrace(), at least that way
you can trace where the function was called with wrong arguments.

2006/4/29, Dave Goodchild <[EMAIL PROTECTED]>:

Misleading to who? I own the app and am the only person who will ever use
it. Rather anal.


On 29/04/06, Martin Alterisio < [EMAIL PROTECTED]> wrote:
>
> 2006/4/28, Barry < [EMAIL PROTECTED]>:
> >
> > Martin Alterisio schrieb:
> > > 2006/4/28, Dave Goodchild <[EMAIL PROTECTED]>:
> > >>
> > >> Hi all - I am attempting to solve some maddening behaviour that has
> me
> > >> totally stumped and before I take a blade to my throat I thought I
> > would
> > >> pick the brains of the group/hive/gang.
> > >>
> > >> I am working on a viral marketing application that uses multipart
> > emails
> > >> to
> > >> notify entrants of their progress in the 'game'. I have a demo
> version
> > >> which
> > >> works fine, and the current rebranded version was also fine until
> the
> > >> client
> > >> asked for some changes then POWWWWW!
> > >>
> > >> I will try and define the issue as simply as I can. I am passing 11
> > >> arguments to a function called sendSantaMail (don't ask) and as a
> > sanity
> > >> check I have called mail() to let me know the values just before
> they
> > are
> > >> passed in to the function. I get this result:
> > >
> > >
> > > sendSantaMail???? That's just not a *declarative* way of naming a
> > function.
> > Do you know what "santa" means? No? so how can you tell it's not
> > declarative.
> > Santa could be a coded Mailer and that functions uses that specific
> > Mailer Deamon called "santa" to send mails.
>
>
> Yeah you're right, I was thinking the exact same thing a while after I
> posted that. Maybe it was a correct name in the context used, but, I
> still
> think "Santa" is a really misleading name for a mailer, and not to
> mention
> that a mass mailer identifying itself as "Santa mailer" in the headers
> is
> asking to be send directly to spam. Anyway, I was wrong.
>
> > Then, 11 arguments???? Errr, passing an associative array with the
> email
> > > parameters wouldn't have been a cleaner and better option?
> >
> > He just told he passes 11 arguments, never told how he does that.
>
>
> Well, if somebody tells you a function has 11 arguments what would you
> think?
>
>


--

http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!


--- End Message ---
--- Begin Message ---
On Sat, April 29, 2006 11:11 am, Jochem Maas wrote:
> Dave Goodchild wrote:
>> All my variables are correctly delimited.
>
> strings constants are delimited not variables, semantically speaking.

Not to mention that they CANNOT be correctly delimited, or you would
NOT be seeing that error message.

It's that simple.

You SHOULD have the apostrophes (or quotes) on non-numeric array indices.

PHP issues an E_NOTICE error message if you don't.  You may have
suppressed that message, and chosen to ignore it, but that doesn't
"fix" the code.

After all, using the SAME mechanism of suppression, you can choose to
ignore ALL PHP errors, no matter how drastic.  Surely you cannot claim
that ignoring an error that halts the script in the middle of
execution is somehow "correct"

>> And don't make assumptions about what my code looks like
>
> why not? besides how are you going to stop someone from assuming your
> code looks like [x]?

One HAS to make assumptions about the code when you fail to post
sufficient information about the code to correctly answer your
question.

> - I am asking for help, not judgements, and my
>
> Richard didn't judge, he merely aired a thought (and added 'if my
> theories are correct' for good measure).
>
>   besides you only control the question not the answer.
>
> oh and Richard is one of the best people on this list to be helping
> you
> - alienating him isn't in your best interests.

You have to work at it pretty hard to alienate me... :-)

>> I am not a spammer either,
>> this is an application for the marketing department of a charity.
>
> charities can potentially spam just as much as anybody - that they
> happen to
> have a 'good cause' doesn't give them a 'get out of jail free' card,
> they have to
> obey the email-marketing rules just like any other organization.

Yeah, I get a fair amount of spam from otherwise legitimate charities.

Which is a shame, since then they DEFINITELY are not getting any money
from me, ever again.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
Hello, 1st msg here so im excited what results i will get :)

Im a novice with php parsing and have been able to help myself quite well with 
what ive needed with xml_parse_into_struct and then echoing the fixed variable 
names but now im dealing with an xml document that is 1st quite large and 2nd 
changing gradually over time with either added data or changed information. 
(But not in large numbers)

http://www.camelotherald.com/xml/spells-si.xml

It is a spell listing for an online mmorpg. It has a "spell_list" that captures 
all other tags and a "spell_line" for each spell line. Within each spell line 
is a "spell" which has the detailed info for each spell with in the "spell_line"

I could parse this by echoing the fixed variables but due to its size and the 
changes done over time its just to much work. This is why i come to a stop. Ive 
read some guides and tried some example code that should help me through this.

What i hoped to get is an example with the xml i provided so i could work with 
it to complete the project.

The example could look something like this:

Header with the selected "spell_line" name ie. "Calefaction" and below that the 
spell info in some dummy table format. Then the next "spell_line" which is 
"Path of Earth" then with the spell info in some dummy table setup.

Thanks for reading and i hope someone can show me the light of a real xml parse.

--- End Message ---
--- Begin Message ---
On Sat, April 29, 2006 11:19 am, [EMAIL PROTECTED] wrote:
> Im a novice with php parsing and have been able to help myself quite
> well with what ive needed with xml_parse_into_struct and then echoing

In an ideal world, you would examine other XML parsing options, such
as the PEAR library.

If, like me, the machine in question does not have, and is unlikely to
have, anything BUT the expat library in the near future, a pointer to
a function that uses expat and creates something less unwieldy than
the xml_parseintostruct would be most welcome...  So let me know if
anybody responds off-list, please.

I'll be Googling for it Monday morning myself.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
> Hello, 1st msg here so im excited what results i will get :)
>
> Im a novice with php parsing and have been able to help myself quite well 
> with what ive needed with xml_parse_into_struct and then echoing the fixed 
> variable names but now im dealing with an xml document that is 1st quite 
> large and 2nd changing gradually over time with either added data or changed 
> information. (But not in large numbers)
>
> http://www.camelotherald.com/xml/spells-si.xml
>
> It is a spell listing for an online mmorpg. It has a "spell_list" that 
> captures all other tags and a "spell_line" for each spell line. Within each 
> spell line is a "spell" which has the detailed info for each spell with in 
> the "spell_line"
>
> I could parse this by echoing the fixed variables but due to its size and the 
> changes done over time its just to much work. This is why i come to a stop. 
> Ive read some guides and tried some example code that should help me through 
> this.
>
> What i hoped to get is an example with the xml i provided so i could work 
> with it to complete the project.
>
> The example could look something like this:
>
> Header with the selected "spell_line" name ie. "Calefaction" and below that 
> the spell info in some dummy table format. Then the next "spell_line" which 
> is "Path of Earth" then with the spell info in some dummy table setup.
>
> Thanks for reading and i hope someone can show me the light of a real xml 
> parse.
>   

The comments on the Manual page
[http://www.php.net/manual/en/ref.xml.php] contain an example class that
parses an XML file into an associative array. I'm using something
similar myself, as it seems to be a pretty straightforward way to get an
easy-to-use structure in PHP 4 without dom_xml, which isn't always
available.

Mattias

--- End Message ---
--- Begin Message ---
Mattias Thorslund wrote:

[EMAIL PROTECTED] wrote:
Hello, 1st msg here so im excited what results i will get :)

Im a novice with php parsing and have been able to help myself quite well with 
what ive needed with xml_parse_into_struct and then echoing the fixed variable 
names but now im dealing with an xml document that is 1st quite large and 2nd 
changing gradually over time with either added data or changed information. 
(But not in large numbers)

http://www.camelotherald.com/xml/spells-si.xml

It is a spell listing for an online mmorpg. It has a "spell_list" that captures all other tags and a 
"spell_line" for each spell line. Within each spell line is a "spell" which has the detailed info 
for each spell with in the "spell_line"

I could parse this by echoing the fixed variables but due to its size and the 
changes done over time its just to much work. This is why i come to a stop. Ive 
read some guides and tried some example code that should help me through this.

What i hoped to get is an example with the xml i provided so i could work with 
it to complete the project.

The example could look something like this:

Header with the selected "spell_line" name ie. "Calefaction" and below that the spell info in some 
dummy table format. Then the next "spell_line" which is "Path of Earth" then with the spell info in 
some dummy table setup.

Thanks for reading and i hope someone can show me the light of a real xml parse.

The comments on the Manual page
[http://www.php.net/manual/en/ref.xml.php] contain an example class that
parses an XML file into an associative array. I'm using something
similar myself, as it seems to be a pretty straightforward way to get an
easy-to-use structure in PHP 4 without dom_xml, which isn't always
available.

Mattias

I have been trying as i said above with the php.net examples, the sitepoint examples (which have been great to give me some view of what i need and how it functions basicly) but with no luck. I can make it easy with fixed value but the dynamic part of it is still outside my reach for now. Thanks for the examples Matt and Richard

- olafurw

--- End Message ---
--- Begin Message ---
Thanks,

But this example seems to be short and does the job :

<?php
$String='this is a "test expression" for search input';
$MyRegEx = '/"[^"]+"|[^"\s,]+/';
preg_match_all($MyRegEx, $String, $Tokens);  
?>

Unless I'm missing something?

thanks

-----Original Message-----
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Saturday, April 29, 2006 10:29 AM
To: Weber Sites LTD
Cc: [email protected]
Subject: Re: [PHP] RegExp for preg_split()

On Fri, April 28, 2006 11:16 am, Weber Sites LTD wrote:
> I'm looking for the RegExp that will split a search string into search 
> keywords.
> while taking " " into account.
>
> From what I managed to find I can get all of the words into an array 
> but I would like all of the words inside " " to be in the same array 
> cell.

I'd be pretty surprised if searching for things like:
PHP simple search input quotes
and things like that didn't turn up some solutions...

You might have to search in specific forums rather than a general Google,
but.

Here's one crude solution though:

<?php
$input = 'this is a "test expression" for search input'; //remove duplicate
spaces:
$input = preg_replace('/\\s+/', ' ', $input); //ignore leading/trailing
blanks:
$input = trim($input);
$parts = explode('"', $input);
$terms = array();
$in_quotes = false;
foreach($parts as $expression){
  $expression = trim($expression); //probably not needed...
  if (strlen($expression)){
    if (!$in_quotes){
      //individual words:
      $words = explode(' ', $expression);
      $terms = array_merge($terms, $words);
    }
    else{
      //in quotes, so this is a search term:
      $terms[] = $expression;
    }
  }
  $in_quotes = !$in_quotes;
}
var_dump($terms);
?>

Note that invalid input such as unbalanced quote marks will mess this up
big-time, probably...

But maybe that's just as well...

--
Like Music?
http://l-i-e.com/artists.htm

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

--- End Message ---
--- Begin Message ---
Hi:

A summation of entries.

http://xn--ovg.com/a/parse.php

neat!

tedd

--
--------------------------------------------------------------------------------
http://sperling.com

--- End Message ---
--- Begin Message --- LOL It's interesting that you've taked your time and build that 'summation', maybe the only thing is missing is the code itself ;) Now, because you didn't add it, I had to check the different versions, and I agree with John Hicks, his suggestion seems to be the best one.

tedd wrote:
A summation of entries.

http://xn--ovg.com/a/parse.php

neat!
tedd
--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
http://www.innox.com.mx

--- End Message ---
--- Begin Message ---
code below shows all records from products table with an textbox and an 
order button for each record

<? $query1 = mysql_query("SELECT * FROM products ");
while ($rowType = mysql_fetch_array($query1))
{ ?>
 <table width="500" border="0">
   <tr class="largeheader">
<td width="40%"><?  echo "$rowType[0]"; ?></a> </td>
<td width="10%"><?php  echo "$rowType[1]"; ?></td>
<td width="10%"><input name="quantity" type="text" value="1" size="1" 
maxlength="3"></td>
<td width="40%"> <a href="<? echo 
"products.php?cat=$cat&toevoegen=1&id=$rowType[7]"; ?>"><img 
src="images/bestel1.gif" border="0"></a></td>
 </tr>

<?php
}
?>
 </table>



if someone presses the button, an item will be ordered.

How can i add the content of the textbox?
i tried this:
<td width="40%"> <a href="<? echo 
"products.php?cat=$cat&quantity=$quantity&toevoegen=1&id=$rowType[7]"; 
?>"><img src="images/bestel1.gif" border="0"></a></td>

but all i get is an error telling me there is a undefined varable



thanx for all help
N. Karademir 

--- End Message ---
--- Begin Message ---
2006/4/29, Smart Software <[EMAIL PROTECTED]>:

code below shows all records from products table with an textbox and an
order button for each record

<? $query1 = mysql_query("SELECT * FROM products ");
while ($rowType = mysql_fetch_array($query1))
{ ?>
<table width="500" border="0">
   <tr class="largeheader">
<td width="40%"><?  echo "$rowType[0]"; ?></a> </td>
<td width="10%"><?php  echo "$rowType[1]"; ?></td>
<td width="10%"><input name="quantity" type="text" value="1" size="1"
maxlength="3"></td>
<td width="40%"> <a href="<? echo
"products.php?cat=$cat&toevoegen=1&id=$rowType[7]"; ?>"><img
src="images/bestel1.gif" border="0"></a></td>
</tr>

<?php
}
?>
</table>



if someone presses the button, an item will be ordered.

How can i add the content of the textbox?
i tried this:
<td width="40%"> <a href="<? echo
"products.php?cat=$cat&quantity=$quantity&toevoegen=1&id=$rowType[7]";
?>"><img src="images/bestel1.gif" border="0"></a></td>

but all i get is an error telling me there is a undefined varable


Can you post what the error looks like?

thanx for all help
N. Karademir

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



--- End Message ---
--- Begin Message ---
> 2006/4/29, Smart Software <[EMAIL PROTECTED]>:
> How can i add the content of the textbox?
> i tried this:
> <td width="40%"> <a href="<? echo
> "products.php?cat=$cat&quantity=$quantity&toevoegen=1&id=$rowType[7]";
> ?>"><img src="images/bestel1.gif" border="0"></a></td>
>
> but all i get is an error telling me there is a undefined varable


It looks like you're trying to get at $quantity, but have you pulled
it from the submitted form yet? If your form's method is "post" then
reference the quantity value with $_POST['quantity']; if your form's
method is "get", use $_GET['quantity'].

You sound very new to this, and the fact that you're building a
shopping cart is worrisome...so please read up on the importance of
verifying your form data, i.e. always "sanitize" submitted values
before using them in SQL calls. And simply check that the values you
get are what you expect, i.e. if you're expecting a number in
$_POST['quantity'], make sure it's a number...

By the way, values submitted in a form will be strings, so in the
example above you'd actually be checking for the *existence of numbers
only* in the string.  Good luck.

HTH,
John W

--- End Message ---
--- Begin Message ---
On Sat, April 29, 2006 5:42 am, Smart Software wrote:
> code below shows all records from products table with an textbox and
> an
> order button for each record

> How can i add the content of the textbox?
> i tried this:
> <td width="40%"> <a href="<? echo
> "products.php?cat=$cat&quantity=$quantity&toevoegen=1&id=$rowType[7]";
> ?>"><img src="images/bestel1.gif" border="0"></a></td>
>
> but all i get is an error telling me there is a undefined varable

You probably are following some kind of tutorial that assumes
"register_globals" is "on" -- or you are simply used to that
environment.

So when you try to use $quantity, it's not defined.

The value you want is in $_REQUEST['quantity'];

You should do something like this:

<?php
  //Get data from REQUEST:
  $quantity = isset($_REQUEST['quantity']) ? $_REQUEST['quantity'] : 0;
  //Force valid data:
  $quantity = (int) $quantity;
  //rest of script here.
?>

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
At 8:44 PM +0200 4/28/06, Jochem Maas wrote:
RANTING SEASON HAS OPENED - lets shoot some wabbits.

has anyone else noticed?? all our jobs go to India and now they are starting
to hire us back. (because they don't have the skills? and probably at rates
that equate to being able to buy 1 cheese sandwich a month with change leftover
to play a song on the jukebox - not that they'd let you into the bar seeing as
you can't afford to buy a drink) go figure.

<rant>

Funny you should say that -- it has happened to me. I have been approached by several Indian companies over the years (for more than just programming -- oil exploration, gems, etc.) .

However, considering the experiences I've had with Indians, I don't mean to sound racist, but "I have found" there is a significant difference between our cultures with respect to the meaning of "your word" -- and as such, I will not do business with any Indian company NOR with any company (domestic or overseas) that hires an Indian to negotiate a contract!

"I have found" it is simply a waste of my time to try to find profitable common ground. They are concerned with one thing, and one thing only, and that is how cheap can they get it -- and they seldom have a clue as to what "it" is -- but, contrary to their lip-service, it certainly isn't quality.

I have seen them waste several million dollars to save less than ten thousand (no lie). It was with an oil deal, not programming, and these people were just plain stupid.

</rant>

tedd

--
--------------------------------------------------------------------------------
http://sperling.com

--- End Message ---
--- Begin Message ---
At 10:46 AM 4/29/2006, tedd wrote:
...
"I have found" it is simply a waste of my time to try to find profitable common ground. They are concerned with one thing, and one thing only, and that is how cheap can they get it -- and they seldom have a clue as to what "it" is -- but, contrary to their lip-service, it certainly isn't quality.
...

Whoa! "They" "they" "they"... Tedd, there are stupid, venal people everywhere in the world, and smart and honorable ones besides. Speaking from personal experience I know that there are cultural divides so wide that what's honorable on one side appears dishonorable from the other; truth appears as lies; respect appears as disrespect; discretion as conspiracy; elegance as boorishness. To judge individuals despite these fundamental differences and then to paint an entire nation of people based on one's experiences with a few seems lacking in sense, respect, rationality, and honor (speaking from this side of your and my cultural divide!). You're free to form your own prejudices based on your experiences, of course, but I'm astonished that you would voice them publicly. I'm embarrassed by your comments.

Paul
--- End Message ---
--- Begin Message ---
Hear hear. This is not the place for this kind of poison. Open source - open
mind.

On 29/04/06, Paul Novitski <[EMAIL PROTECTED]> wrote:

At 10:46 AM 4/29/2006, tedd wrote:
...
>"I have found" it is simply a waste of my time to try to find
>profitable common ground. They are concerned with one thing, and one
>thing only, and that is how cheap can they get it -- and they seldom
>have a clue as to what "it" is -- but, contrary to their
>lip-service, it certainly isn't quality.
...

Whoa!  "They" "they" "they"...  Tedd, there are stupid, venal people
everywhere in the world, and smart and honorable ones
besides.  Speaking from personal experience I know that there are
cultural divides so wide that what's honorable on one side appears
dishonorable from the other; truth appears as lies; respect appears
as disrespect; discretion as conspiracy; elegance as boorishness.  To
judge individuals despite these fundamental differences and then to
paint an entire nation of people based on one's experiences with a
few seems lacking in sense, respect, rationality, and honor (speaking
from this side of your and my cultural divide!).  You're free to form
your own prejudices based on your experiences, of course, but I'm
astonished that you would voice them publicly.  I'm embarrassed by
your comments.

Paul

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




--
http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!

--- End Message ---
--- Begin Message ---
Use cURL I found it much easier then using fsockopen

http://ca.php.net/cURL


""Richard Lynch"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Sat, April 29, 2006 3:53 am, suresh kumar wrote:
>>              <input type="hidden" name="item_name"
>> value="Subscribe to Additional User Account Yearly">
>
>> my page code to  process paypal
>> ------------------------------
>> <?
>>
>> // read the post from PayPal system and add 'cmd'
>> $req = 'cmd=_notify-validate';
>>
>> foreach ($_POST as $key => $value) {
>>   $value = urlencode(stripslashes($value));
>> $req .= "&$key=$value";
>
> echo "$key => $value<br />\n";
>
>> }
>>
>> $item_name = $_POST['item_name'];
>
> $item_name = isset($_POST['item_name']) ? $_POST['item_name'] : '';
>
>
>>  Undefined index:item_name
>
> The $_POST data is not filled in, either because this is your FIRST
> visit to the page, or because something is not doing a POST request
> the way you think it should be.
>
> -- 
> Like Music?
> http://l-i-e.com/artists.htm 

--- End Message ---
--- Begin Message ---
One more thing, make sure you validate ALL data that is being sent from 
paypal to ensure what you need and expect are there....also validate the 
transaction ID to ensure it was never used before.


""Stephen Lake"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Use cURL I found it much easier then using fsockopen
>
> http://ca.php.net/cURL
>
>
> ""Richard Lynch"" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
>> On Sat, April 29, 2006 3:53 am, suresh kumar wrote:
>>>              <input type="hidden" name="item_name"
>>> value="Subscribe to Additional User Account Yearly">
>>
>>> my page code to  process paypal
>>> ------------------------------
>>> <?
>>>
>>> // read the post from PayPal system and add 'cmd'
>>> $req = 'cmd=_notify-validate';
>>>
>>> foreach ($_POST as $key => $value) {
>>>   $value = urlencode(stripslashes($value));
>>> $req .= "&$key=$value";
>>
>> echo "$key => $value<br />\n";
>>
>>> }
>>>
>>> $item_name = $_POST['item_name'];
>>
>> $item_name = isset($_POST['item_name']) ? $_POST['item_name'] : '';
>>
>>
>>>  Undefined index:item_name
>>
>> The $_POST data is not filled in, either because this is your FIRST
>> visit to the page, or because something is not doing a POST request
>> the way you think it should be.
>>
>> -- 
>> Like Music?
>> http://l-i-e.com/artists.htm 

--- End Message ---
--- Begin Message ---
Greetings All,

Where can I find a good tutorial on creating a login protected area using php? I did a Google search and found a couple but, I would like to get suggestions from the list. Thanks!

--
Kind Regards
Schalk Neethling
Web Developer.Designer.Programmer.President
Volume4.Business.Solution.Developers

--- End Message ---
--- Begin Message ---
On 4/30/06, Schalk <[EMAIL PROTECTED]> wrote:
Greetings All,

Where can I find a good tutorial on creating a login protected area
using php? I did a Google search and found a couple but, I would like to
get suggestions from the list. Thanks!

Just found a good one.. it's a little more complicated than most
because it has the userlevel stuff included.. but gives you some
ideas.

http://www.evolt.org/article/PHP_Login_System_with_Admin_Features/17/60384/index.html

(Found a couple of bugs in it, but you get that)..

Basically you keep usernames/passwords in a database table, after
checking the details, store the login in the session and voila! done!

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---

Reply via email to