[PHP] Where and how do i use $_post etc

2003-12-26 Thread Piet
Hi

I am trying to find examples of how and where to use $_POST, $_GET etc. I
searched a lot of places, but cant seem to find decent examples or a
tutorial or something.

Can someone point me in the right direction?

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



[PHP] Insert into array...

2003-12-26 Thread Andras Kende

Hello All,

I would like to put 1 new field into this multidimensional array...

$orders =

1 => Array (11)
  Name => JUDY
  Order => 334455
2 => Array (11)
  Name => MARY
  Order => 12590

TO:

$orders =

1 => Array (11)
  Name => JUDY
  Order => 334455
  Newitem => someting
2 => Array (11)
  Name => MARY
  Order => 12590
  Newitem => something


I can do one at the time like:
$orders[1]['Newitem'] = "something";

But not for the whole array

Thanks,

Andras Kende

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



[PHP] Re: Where and how do i use $_post etc

2003-12-26 Thread Al
"Piet" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> I am trying to find examples of how and where to use $_POST, $_GET etc. I
> searched a lot of places, but cant seem to find decent examples or a
> tutorial or something.

$_POST and $_GET are associative arrays containing the form data sent by a
user to a page. Whether your user's submitted form data is in $_POST or
$_GET depends on what method attribute you've specified in the  tag in
your HTML code. Take a look at the following HTML example:







Now in the file script.php you can access the submitted form values in the
$_GET array, using the form field names as array keys. e.g:



If you had set the  in your HTML, then you could have
accessed the form values from the $_POST array within PHP.

Hope that helps,

Al

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



[PHP] Re: Where and how do i use $_post etc

2003-12-26 Thread Piet
Why would i do this long coding in the second page "script.php" the
variables values is already available in "script.php" when i do a post or
get, if i use $_POST or $_GET to define a variable already available, that
seems like a lot of extra coding for no reason.
"Al" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Piet" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi
> >
> > I am trying to find examples of how and where to use $_POST, $_GET etc.
I
> > searched a lot of places, but cant seem to find decent examples or a
> > tutorial or something.
>
> $_POST and $_GET are associative arrays containing the form data sent by a
> user to a page. Whether your user's submitted form data is in $_POST or
> $_GET depends on what method attribute you've specified in the  tag
in
> your HTML code. Take a look at the following HTML example:
>
> 
> 
> 
> 
> 
>
> Now in the file script.php you can access the submitted form values in the
> $_GET array, using the form field names as array keys. e.g:
>
>  $firstName = $_GET['firstName'];
> $lastName = $_GET['lastName'];
> echo 'The user submitted the name'.$firstName.' '.$lastName;
> ?>
>
> If you had set the  in your HTML, then you could have
> accessed the form values from the $_POST array within PHP.
>
> Hope that helps,
>
> Al

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



RE: [PHP] Re: Where and how do i use $_post etc

2003-12-26 Thread Mike Brum
Let's make some assumptions - 

1) having register_globals on is bad
2) we all like to write scripts as secure as possible

Given #1 and #2, if you stop referencing variables directly (e.g. as
$firstName in the script below) since register_globals is off, it
immediately adds a degree of security to your script if you're aware of the
difference between GET and POST requests. GET requests are quite easy to
fake (just add the variables and values to the URL) and unless you have
checks against it, a malicious user could take advantage of this. POST
requests are a bit more tricky to fake, but not "difficult" in the grand
scheme of things.

Either way, in the examples that Piet wrote, there's no "extra coding".
Writing the variable names is a bit more key strokes, but given the
advantages of having even a slightly more secure script, it's a good thing
and worth a bit more typing.

-M

-Original Message-
From: Piet [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 26, 2003 6:41 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Where and how do i use $_post etc

Why would i do this long coding in the second page "script.php" the
variables values is already available in "script.php" when i do a post or
get, if i use $_POST or $_GET to define a variable already available, that
seems like a lot of extra coding for no reason.
"Al" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Piet" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
> > Hi
> >
> > I am trying to find examples of how and where to use $_POST, $_GET etc.
I
> > searched a lot of places, but cant seem to find decent examples or a 
> > tutorial or something.
>
> $_POST and $_GET are associative arrays containing the form data sent 
> by a user to a page. Whether your user's submitted form data is in 
> $_POST or $_GET depends on what method attribute you've specified in 
> the  tag
in
> your HTML code. Take a look at the following HTML example:
>
> 
> 
> 
> 
> 
>
> Now in the file script.php you can access the submitted form values in 
> the $_GET array, using the form field names as array keys. e.g:
>
>  $firstName = $_GET['firstName'];
> $lastName = $_GET['lastName'];
> echo 'The user submitted the name'.$firstName.' '.$lastName; ?>
>
> If you had set the  in your HTML, then you could 
> have accessed the form values from the $_POST array within PHP.
>
> Hope that helps,
>
> Al

--
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] How New Is <<

2003-12-26 Thread [EMAIL PROTECTED]
Okay, for everyone took a break for Christmas, and to update Jasper and
Jeremy--who've tried big-time to help me--here's again the sitch and where
I stand as of now.

I'm on a Macintosh PowerBook running OS X.2.1 and PHP 4.3.0. I'm tryning to
run the following code:




persistence demo





Persistence Demo




The hidden value is $hdnCounter

HERE;

?>





What that gets me is:

Parse error: parse error, unexpected $ in [my path to this file] on line 33

register_globals is, of course, off. So I add $txtBoxCounter =
$_POST['txtBoxCounter] and $hdnCounter = $_POST['hdnCounter] as separate
line right after http://mail2web.com/ .

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



Re: [PHP] How New Is <<

2003-12-26 Thread Cesar Cordovez
Change:

$txtBoxCounter = $_POST['txtBoxCounter]
$hdnCounter = $_POST['hdnCounter]
to

$txtBoxCounter = $_POST['txtBoxCounter'];
$hdnCounter = $_POST['hdnCounter'];
(Notice the ' at the end of txtBoxCounter and hdnCounter.

Merry X'mas

[EMAIL PROTECTED] wrote:
Okay, for everyone took a break for Christmas, and to update Jasper and
Jeremy--who've tried big-time to help me--here's again the sitch and where
I stand as of now.
I'm on a Macintosh PowerBook running OS X.2.1 and PHP 4.3.0. I'm tryning to
run the following code:



persistence demo




Persistence Demo


print <<



The hidden value is $hdnCounter

HERE;
?>




What that gets me is:

Parse error: parse error, unexpected $ in [my path to this file] on line 33

register_globals is, of course, off. So I add $txtBoxCounter =
$_POST['txtBoxCounter] and $hdnCounter = $_POST['hdnCounter] as separate
line right after 
Anyone, please?

Thank you.

Steve Tiano


mail2web - Check your email from the web at
http://mail2web.com/ .
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Migrating from SSI and Perl

2003-12-26 Thread Philip Pawley
I am new to php.

My site, at the moment, uses SSI to call a Perl browser-sniffing script.

I would like to:
1. use php to call the Perl script.
2. then save the values the Perl script outputs as php variables.

Can this be done? If so, how?

Thanks,

Philip Pawley

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



php-general Digest 26 Dec 2003 17:08:02 -0000 Issue 2495

2003-12-26 Thread php-general-digest-help

php-general Digest 26 Dec 2003 17:08:02 - Issue 2495

Topics (messages 173328 through 173336):

magic_quotes_gpc setting question.
173328 by: Rajesh Kumar

Where and how do i use $_post etc
173329 by: Piet
173331 by: Al
173332 by: Piet
17 by: Mike Brum

Insert into array...
173330 by: Andras Kende

How New Is <<--- Begin Message ---
Hello,

Here I've got a few related questions, which are not stated explicitly 
in the manual.

1. The manual says that the magic_quotes_gpc setting cannot be set at
   runtime. Is it not possible to set this setting in an ini file, and
   parse it with the parse_ini_file() function? Also, if this was
   possible, what will PHP do to the modified variables? Run the
   stripslashes() functions on all of them?
2. On a related line, are we allowed to use ini values in our ini file
   that contradict the defined ini values in php.ini? Won't this confuse
   the parser?
3. What would I do if I didn't have access to my own custom ini file,
   but could somehow get the file either by using fopen(), file() or
   file_get_contents()? Can I parse a string (or array) like an ini
   file?
4. Does parse_ini_file() allow us to specify absolute filenames of the
   form "scheme://..." from another server, if our allow_url_fopen
   is TRUE?
Thank You.
--- End Message ---
--- Begin Message ---
Hi

I am trying to find examples of how and where to use $_POST, $_GET etc. I
searched a lot of places, but cant seem to find decent examples or a
tutorial or something.

Can someone point me in the right direction?
--- End Message ---
--- Begin Message ---
"Piet" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> I am trying to find examples of how and where to use $_POST, $_GET etc. I
> searched a lot of places, but cant seem to find decent examples or a
> tutorial or something.

$_POST and $_GET are associative arrays containing the form data sent by a
user to a page. Whether your user's submitted form data is in $_POST or
$_GET depends on what method attribute you've specified in the  tag in
your HTML code. Take a look at the following HTML example:







Now in the file script.php you can access the submitted form values in the
$_GET array, using the form field names as array keys. e.g:



If you had set the  in your HTML, then you could have
accessed the form values from the $_POST array within PHP.

Hope that helps,

Al
--- End Message ---
--- Begin Message ---
Why would i do this long coding in the second page "script.php" the
variables values is already available in "script.php" when i do a post or
get, if i use $_POST or $_GET to define a variable already available, that
seems like a lot of extra coding for no reason.
"Al" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Piet" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi
> >
> > I am trying to find examples of how and where to use $_POST, $_GET etc.
I
> > searched a lot of places, but cant seem to find decent examples or a
> > tutorial or something.
>
> $_POST and $_GET are associative arrays containing the form data sent by a
> user to a page. Whether your user's submitted form data is in $_POST or
> $_GET depends on what method attribute you've specified in the  tag
in
> your HTML code. Take a look at the following HTML example:
>
> 
> 
> 
> 
> 
>
> Now in the file script.php you can access the submitted form values in the
> $_GET array, using the form field names as array keys. e.g:
>
>  $firstName = $_GET['firstName'];
> $lastName = $_GET['lastName'];
> echo 'The user submitted the name'.$firstName.' '.$lastName;
> ?>
>
> If you had set the  in your HTML, then you could have
> accessed the form values from the $_POST array within PHP.
>
> Hope that helps,
>
> Al
--- End Message ---
--- Begin Message ---
Let's make some assumptions - 

1) having register_globals on is bad
2) we all like to write scripts as secure as possible

Given #1 and #2, if you stop referencing variables directly (e.g. as
$firstName in the script below) since register_globals is off, it
immediately adds a degree of security to your script if you're aware of the
difference between GET and POST requests. GET requests are quite easy to
fake (just add the variables and values to the URL) and unless you have
checks against it, a malicious user could take advantage of this. POST
requests are a bit more tricky to fake, but not "difficult" in the grand
scheme of things.

Either way, in the examples that Piet wrote, there's no "extra coding".
Writing the variable names is a bit more key strokes, but given the
advantages of having even a slightly more secure script, it's a good thing
and worth a bit more typing.

-M

-Original Message-
From: Piet [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 26, 2003 6:41 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Where and how do i use $_post etc

Why would i do this long coding in the se

RE: [PHP] Migrating from SSI and Perl

2003-12-26 Thread Radek Zajkowski
Check out shell_exec() and its siblings. I'd likely use it like so $output =
shell_exec("perl myscript.pl"); and then do something with the $output
variable

R>

> -Original Message-
> From: Philip Pawley [mailto:[EMAIL PROTECTED]
> Sent: December 26, 2003 12:07 PM
> To: php-general
> Subject: [PHP] Migrating from SSI and Perl
>
>
> I am new to php.
>
> My site, at the moment, uses SSI to call a Perl browser-sniffing script.
>
> I would like to:
> 1. use php to call the Perl script.
> 2. then save the values the Perl script outputs as php variables.
>
> Can this be done? If so, how?
>
> Thanks,
>
> Philip Pawley
>
> --
> 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] Migrating from SSI and Perl

2003-12-26 Thread Pablo Gosse

My site, at the moment, uses SSI to call a Perl browser-sniffing script.

I would like to:
1. use php to call the Perl script.
2. then save the values the Perl script outputs as php variables.

Can this be done? If so, how?


Hi, Philip.  If you are not 100% stuck on using a perl script to sniff
the browser, you might want to use Phpsniff, a class available on
sourceforge:


http://phpsniff.sourceforge.net

I've used it in many of my applications with excellent results.

Cheers,
Pablo 

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



[PHP] Re: Apache 2 and PHP

2003-12-26 Thread Per Jessen
Radek Zajkowski wrote:

> A few months back the official PHP website still warned againts PHP and
> Apache 2. I am wondering about the current status of these two
> technologies when used together. I am about to configure a web server and
> was going to use Apache 1.3 with PHP4+ as opposed to Apache 2 with PHP4+.
> What are your opinions, thoughts and experiences.

I've been using apache 2.0 and php 4.x for quite some time now, and have
really only seen very minor problems.  I did run into some odd problem a
while back, and asked about here - got the standard message about "don't
expect php to work in apache 2.0". It was something to do with
error-handling and timeout, IIRC.

Why not go with Apache 2.0? If you should run into some showstopper, revert
to 1.3 - it's not that much of an effort (provided you don't start using
apache 2.0-only features).


/Per

-- 
Per Jessen, Zurich
http://timian.jessen.ch - an analog report formatter using XSLT.
http://www.dansklisten.org -- for alle danskere i udlandet.

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



Re: [PHP] How New Is <<

2003-12-26 Thread [EMAIL PROTECTED]
Thanks very much, and Merry Christmas to all--rather rude of me to've been
whining for help all this time and not remembering the courtesy of holiday
wishes.

Okay, I made the change to:

$txtBoxCounter = $_POST['txtBoxCounter'];
$hdnCounter = $_POST['hdnCounter'];

Now I get:

parse error: parse error, unexpected $ in [my path to this file] on line 34

I'm still missing the big picture.

Steve Tiano

-

Change:

$txtBoxCounter = $_POST['txtBoxCounter]
$hdnCounter = $_POST['hdnCounter]

to


$txtBoxCounter = $_POST['txtBoxCounter'];
$hdnCounter = $_POST['hdnCounter'];

(Notice the ' at the end of txtBoxCounter and hdnCounter.

Merry X'mas


mail2web - Check your email from the web at
http://mail2web.com/ .

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



Re: [PHP] How New Is <<

2003-12-26 Thread Cesar Cordovez
Please post your code from line 30 to 40.  Place a mark in line 34.

=)



[EMAIL PROTECTED] wrote:
parse error: parse error, unexpected $ in [my path to this file] on line 34
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] magic_quotes_gpc setting question.

2003-12-26 Thread Marek Kilimajer
Rajesh Kumar wrote:
Hello,

Here I've got a few related questions, which are not stated explicitly 
in the manual.

1. The manual says that the magic_quotes_gpc setting cannot be set at
   runtime. Is it not possible to set this setting in an ini file, and
   parse it with the parse_ini_file() function? Also, if this was
   possible, what will PHP do to the modified variables? Run the
   stripslashes() functions on all of them?
No, this would be the same as runtime.

2. On a related line, are we allowed to use ini values in our ini file
   that contradict the defined ini values in php.ini? Won't this confuse
   the parser?
No, this will not confuse the parser. And it will not have any effect on 
php settings.

3. What would I do if I didn't have access to my own custom ini file,
   but could somehow get the file either by using fopen(), file() or
   file_get_contents()? Can I parse a string (or array) like an ini
   file?
You can do with a file whatever you are allowed to do, but it will not 
have any effect on php settings unless you use ini_set() function. Still 
you will be able to change only settings that can be changed during runtime.

4. Does parse_ini_file() allow us to specify absolute filenames of the
   form "scheme://..." from another server, if our allow_url_fopen
   is TRUE?
I don't know. Why don't you try it?

Thank You.

You can use .htaccess files to change php settings as described in the 
documentation.

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


[PHP] Problem with "switch ($to)"..

2003-12-26 Thread Labunski
Hello, thanks in advice and Merry Christmas!
I'm a newbie in PHP, so I can't imagine how to add the "Part 1" to the "Part
2"..

/// Part 1 
 switch ($to)
 {
 case "roman":
 $to = $address;
 break;

 case "none":
 // here should go the "Part 2", but I don't know how!
 break;
 }

/// Part 2 ///
(empty($from) || empty($message)) {
header( "Location: ../eng/contact.htm" );
  }


Sorry for my bad english,
Lab.

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



RE: [PHP] Migrating from SSI and Perl

2003-12-26 Thread Philip Pawley
Hi Radek,

I tried to do something with this and failed dismally.

Is it possible for you to give me a really basic working example of what you suggest? 

Thanks,

Philip Pawley

At 26/12/03 12:29 -0500, you wrote:
>Check out shell_exec() and its siblings. I'd likely use it like so $output =
>shell_exec("perl myscript.pl"); and then do something with the $output
>variable
>
>R>
>
>> -Original Message-
>> From: Philip Pawley [mailto:[EMAIL PROTECTED]
>> Sent: December 26, 2003 12:07 PM
>> To: php-general
>> Subject: [PHP] Migrating from SSI and Perl
>>
>>
>> I am new to php.
>>
>> My site, at the moment, uses SSI to call a Perl browser-sniffing script.
>>
>> I would like to:
>> 1. use php to call the Perl script.
>> 2. then save the values the Perl script outputs as php variables.
>>
>> Can this be done? If so, how?
>>
>> Thanks,
>>
>> Philip Pawley

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



Re: [PHP] Problem with "switch ($to)"..

2003-12-26 Thread Rolf Brusletto
Labunski wrote:

Hello, thanks in advice and Merry Christmas!
I'm a newbie in PHP, so I can't imagine how to add the "Part 1" to the "Part
2"..
/// Part 1 
switch ($to)
{
case "roman":
$to = $address;
break;
case "none":
// here should go the "Part 2", but I don't know how!
break;
}
/// Part 2 ///
(empty($from) || empty($message)) {
   header( "Location: ../eng/contact.htm" );
 }
Sorry for my bad english,
Lab.
 

Lab - its pretty simple actually...

switch ($to)
{
case "roman":
$to = $address;
break;
case "none":
	if (empty($from) || empty($message)) {
   		header( "Location: ../eng/contact.htm" );
 	} 
break;
}

Hope this helps..

Happy holidays!

--
Rolf Brusletto
rolf[at]emailfeeds[dot]com
http://www.emailfeeds.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Object Oriented Programming Book(s)?

2003-12-26 Thread CF High
Hey all.

I've got the O'Reilly "Programming PHP" & "PHP Cookbook" PHP books --
excellent PHP Resources -- however, the OOP sections are rather short.

I'm hoping to get my hands on a relatively in-depth OOP book.

It doesn't look like there are any PHP specific OOP books out there yet, so
any OOP books that will help a developing PHP programmer are much
appreciated

TIA & Happy Holidays,

--Noah



--

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



[PHP] Re: Object Oriented Programming Book(s)?

2003-12-26 Thread Manuel Lemos
Hello,

On 12/26/2003 09:06 PM, Cf High wrote:
I've got the O'Reilly "Programming PHP" & "PHP Cookbook" PHP books --
excellent PHP Resources -- however, the OOP sections are rather short.
I'm hoping to get my hands on a relatively in-depth OOP book.

It doesn't look like there are any PHP specific OOP books out there yet, so
any OOP books that will help a developing PHP programmer are much
appreciated
Yes, you are right, there are no OOP specific books. However most books 
that tend to be general have good coverage of PHP OOP capabilities.

You may want to take a look here where you may find the latest PHP 
books. Some are already reviewed:

http://www.phpclasses.org/products.html/products.html

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How New Is <<

2003-12-26 Thread [EMAIL PROTECTED]
Cesar,

Sorry to have taken so long to answer. My day got complicated. Anyway,
here's  the code all over again, with the last changes I was advised to
make. I took out the line spaces and added line numbers. But first, the
latest error message:

   Parse error: parse error, unexpected T_VARIABLE in [path to file] on
line 11

The code:

1 
2 
3 
4 persistence demo
5 
6 
7 
8 Persistence Demo
9 
10 
20 
23 The hidden value is $hdnCounter
24 
26 HERE;
27 ?>
28 
29 
30 

---

Please post your code from line 30 to 40.  Place a mark in line 34.

=)


mail2web - Check your email from the web at
http://mail2web.com/ .

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



Re: [PHP] How New Is <<

2003-12-26 Thread David T-G
Steve --

...and then [EMAIL PROTECTED] said...
% 
%Parse error: parse error, unexpected T_VARIABLE in [path to file] on
% line 11
% 
% The code:
% 
...
% 10 http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] Insert into array...

2003-12-26 Thread Marek Kilimajer
Please don't start a new thread by hijacking an existing thread. Always 
start with "new massage".

Simple answer for your question is:

foreach($orders as $order_key => $dummy) {
$orders[$order_key]['Newitem'] = "something";
}
Andras Kende wrote:
Hello All,

I would like to put 1 new field into this multidimensional array...

$orders =

1 => Array (11)
  Name => JUDY
  Order => 334455
2 => Array (11)
  Name => MARY
  Order => 12590
TO:

$orders =

1 => Array (11)
  Name => JUDY
  Order => 334455
  Newitem => someting
2 => Array (11)
  Name => MARY
  Order => 12590
  Newitem => something
I can do one at the time like:
$orders[1]['Newitem'] = "something";
But not for the whole array

Thanks,

Andras Kende

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


[PHP] possible bug in PHP function mysql_query() ?

2003-12-26 Thread Peter Walter
MySQL version: 4.0.16
PHP version: 4.3.2
Problem code:
$query = "SELECT * FROM tablename
WHERE columnname LIKE '%%'";
mysql_query($query);
Results:
query fails, mysql_errno() returns 1064 (syntax error)
I have tracked the problem down to the WHERE clause; using any other 
number of digits (except eight), the query suceeds. It seems to be a 
problem with the comparison logic, because other comparison operators 
also fail; specifically, I have tested
WHERE columnname = 
and
WHERE columnname = ''

When running the identical query in PhpMyAdmin 2.5.5 RC1, or at the 
MySQL command line, the query  works without a problem.

I am a PHP/MySQL newbie. Before I rush off and report this as a PHP bug, 
can anyone else confirm this behavior, or explain what I am doing wrong?

Peter

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


[PHP] Maths dumbass

2003-12-26 Thread Ryan A
Hi guys,
Its not 5am here and have started on a blasted problem where am feeling like
a maths dumbass...the old noodle is just not working, any help appreciated.

Problem, selling 4 packages rangeing from $27.50-$99.00 a month...the
subscriber can change anytime he wants from one package to the other
(upgrade), if so I have to calculate how many days he has is with us and
then he just pays the balance...

eg:
if he is on the smallest package ($27.50)
and the month has 30 days,
 and 15 days are up,
(means 50% is used and that translates to 13.75$)
 and he wants to upgrade to the next higher package ($43.00) he just has to
pay $29.25

Can you give me a clue on how to calculate that depending on the 12 months
and 4 packages?


Thanks in advance,
-Ryan

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



RE: [PHP] Maths dumbass

2003-12-26 Thread Mike Brum
Basically, have an array of # of days per month. Do a quick compare given
the month for the # of days. For the sake of example, we'll assume the month
in question has 31 days. So, here's some givens:

$month_days = 31;
$former_plan_days = $current_date;
$new_plan_days = ($current_date - $month_days); 


Now, to get the values:

$former_plan_bill = ($full_former_price * ($former_plan_days /
$month_days));

$new_plan_bill = ($full_new_price * ($new_plan_days / $month_days));

$total_month_bill = ($former_plan_bill + $new_plan_bill);


There you have it. This should work no matter if they get an "upgrade" or
"downgrade" in service because it just takes the ratio of days to get the
percentage of the price that's owed and then multiplies the full price to
get the percentage that's owed.

Make sense? :)

-M

-Original Message-
From: Ryan A [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 26, 2003 11:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Maths dumbass

Hi guys,
Its not 5am here and have started on a blasted problem where am feeling like
a maths dumbass...the old noodle is just not working, any help appreciated.

Problem, selling 4 packages rangeing from $27.50-$99.00 a month...the
subscriber can change anytime he wants from one package to the other
(upgrade), if so I have to calculate how many days he has is with us and
then he just pays the balance...

eg:
if he is on the smallest package ($27.50) and the month has 30 days,  and 15
days are up, (means 50% is used and that translates to 13.75$)  and he wants
to upgrade to the next higher package ($43.00) he just has to pay $29.25

Can you give me a clue on how to calculate that depending on the 12 months
and 4 packages?


Thanks in advance,
-Ryan

--
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] File Uploads

2003-12-26 Thread Jough Jeaux
Greetings all, I want to allow users to upload images
to an online profile.  Anyone know how to let the user
browse his/her local filesystem from the web page?


__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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



php-general Digest 27 Dec 2003 06:34:41 -0000 Issue 2496

2003-12-26 Thread php-general-digest-help

php-general Digest 27 Dec 2003 06:34:41 - Issue 2496

Topics (messages 173337 through 173354):

Re: Migrating from SSI and Perl
173337 by: Radek Zajkowski
173338 by: Pablo Gosse
173344 by: Philip Pawley

Re: Apache 2 and PHP
173339 by: Per Jessen

Re: How New Is <<--- Begin Message ---
Check out shell_exec() and its siblings. I'd likely use it like so $output =
shell_exec("perl myscript.pl"); and then do something with the $output
variable

R>

> -Original Message-
> From: Philip Pawley [mailto:[EMAIL PROTECTED]
> Sent: December 26, 2003 12:07 PM
> To: php-general
> Subject: [PHP] Migrating from SSI and Perl
>
>
> I am new to php.
>
> My site, at the moment, uses SSI to call a Perl browser-sniffing script.
>
> I would like to:
> 1. use php to call the Perl script.
> 2. then save the values the Perl script outputs as php variables.
>
> Can this be done? If so, how?
>
> Thanks,
>
> Philip Pawley
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---

My site, at the moment, uses SSI to call a Perl browser-sniffing script.

I would like to:
1. use php to call the Perl script.
2. then save the values the Perl script outputs as php variables.

Can this be done? If so, how?


Hi, Philip.  If you are not 100% stuck on using a perl script to sniff
the browser, you might want to use Phpsniff, a class available on
sourceforge:


http://phpsniff.sourceforge.net

I've used it in many of my applications with excellent results.

Cheers,
Pablo 
--- End Message ---
--- Begin Message ---
Hi Radek,

I tried to do something with this and failed dismally.

Is it possible for you to give me a really basic working example of what you suggest? 

Thanks,

Philip Pawley

At 26/12/03 12:29 -0500, you wrote:
>Check out shell_exec() and its siblings. I'd likely use it like so $output =
>shell_exec("perl myscript.pl"); and then do something with the $output
>variable
>
>R>
>
>> -Original Message-
>> From: Philip Pawley [mailto:[EMAIL PROTECTED]
>> Sent: December 26, 2003 12:07 PM
>> To: php-general
>> Subject: [PHP] Migrating from SSI and Perl
>>
>>
>> I am new to php.
>>
>> My site, at the moment, uses SSI to call a Perl browser-sniffing script.
>>
>> I would like to:
>> 1. use php to call the Perl script.
>> 2. then save the values the Perl script outputs as php variables.
>>
>> Can this be done? If so, how?
>>
>> Thanks,
>>
>> Philip Pawley
--- End Message ---
--- Begin Message ---
Radek Zajkowski wrote:

> A few months back the official PHP website still warned againts PHP and
> Apache 2. I am wondering about the current status of these two
> technologies when used together. I am about to configure a web server and
> was going to use Apache 1.3 with PHP4+ as opposed to Apache 2 with PHP4+.
> What are your opinions, thoughts and experiences.

I've been using apache 2.0 and php 4.x for quite some time now, and have
really only seen very minor problems.  I did run into some odd problem a
while back, and asked about here - got the standard message about "don't
expect php to work in apache 2.0". It was something to do with
error-handling and timeout, IIRC.

Why not go with Apache 2.0? If you should run into some showstopper, revert
to 1.3 - it's not that much of an effort (provided you don't start using
apache 2.0-only features).


/Per

-- 
Per Jessen, Zurich
http://timian.jessen.ch - an analog report formatter using XSLT.
http://www.dansklisten.org -- for alle danskere i udlandet.
--- End Message ---
--- Begin Message ---
Thanks very much, and Merry Christmas to all--rather rude of me to've been
whining for help all this time and not remembering the courtesy of holiday
wishes.

Okay, I made the change to:

$txtBoxCounter = $_POST['txtBoxCounter'];
$hdnCounter = $_POST['hdnCounter'];

Now I get:

parse error: parse error, unexpected $ in [my path to this file] on line 34

I'm still missing the big picture.

Steve Tiano

-

Change:

$txtBoxCounter = $_POST['txtBoxCounter]
$hdnCounter = $_POST['hdnCounter]

to


$txtBoxCounter = $_POST['txtBoxCounter'];
$hdnCounter = $_POST['hdnCounter'];

(Notice the ' at the end of txtBoxCounter and hdnCounter.

Merry X'mas


mail2web - Check your email from the web at
http://mail2web.com/ .
--- End Message ---
--- Begin Message ---
Please post your code from line 30 to 40.  Place a mark in line 34.

=)



[EMAIL PROTECTED] wrote:
parse error: parse error, unexpected $ in [my path to this file] on line 34
--- End Message ---
--- Begin Message ---
Cesar,

Sorry to have taken so long to answer. My day got complicated. Anyway,
here's  the code all over again, with the last changes I was advised to
make. I took out the line spaces and added line numbers. But first, the
latest error message:

   Parse error: parse error, unexpected T_VARIABLE in [path to file] on
line 11


Re: [PHP] File Uploads

2003-12-26 Thread Jough Jeaux
Hmm, well, to answer my own question, it looks like
the following will do.  Sorry to make an ass of
myself.  Hope you were all entertained!!



Send this file: 




--- Jough Jeaux <[EMAIL PROTECTED]> wrote:
> Greetings all, I want to allow users to upload
> images
> to an online profile.  Anyone know how to let the
> user
> browse his/her local filesystem from the web page?
> 
> 
> __
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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