php-general Digest 24 Jun 2002 12:07:30 -0000 Issue 1424

Topics (messages 103506 through 103570):

Using Oracle Data base store procedure (function, procedure, package)
        103506 by: èdy kurniawan
        103507 by: Peter
        103512 by: èdy kurniawan
        103513 by: Peter
        103515 by: èdy kurniawan
        103516 by: Peter
        103539 by: Laurent Drouet
        103557 by: Stuart Dallas

How to remove item from cart
        103508 by: Vicki
        103533 by: Analysis & Solutions

Limiting text inputs by character count?
        103509 by: Andre Dubuc
        103510 by: Martin Towell
        103511 by: Peter
        103514 by: Andre Dubuc
        103522 by: John Holmes

=== and @
        103517 by: Phil Schwarzmann
        103518 by: Rasmus Lerdorf
        103519 by: Justin French
        103555 by: BB

Time Delay using phpscript
        103520 by: Uma Shankari T.
        103521 by: Martin Towell
        103524 by: John Holmes
        103525 by: Justin French
        103569 by: SP

Re: about file permissions + cuteftp
        103523 by: Police Trainee

copying the structure of a blank table in mysql
        103526 by: Phil Schwarzmann
        103535 by: Analysis & Solutions
        103554 by: John Holmes

rounding a number
        103527 by: Phil Schwarzmann
        103528 by: Martin Towell
        103529 by: Jason Soza
        103530 by: Jason Wong
        103559 by: George Whiffen
        103560 by: George Whiffen
        103562 by: George Whiffen

Re: netscape 4.x problem
        103531 by: Analysis & Solutions

Re: php or mysql db update
        103532 by: Analysis & Solutions

Re: UPDATE mysql
        103534 by: David Robley
        103537 by: Jason Wong

Run two separate version of Apache and Php
        103536 by: rdkurth.starband.net
        103541 by: Al Baker

Re: ARRAY, IF & INSERT
        103538 by: Jesper Brunholm
        103549 by: César Aracena

Re: recommend any good learning books
        103540 by: Jesper Brunholm

xslt_output_begintransform() - What Happend to it?
        103542 by: Nigel Liefrink

getting the value of a javascript variable
        103543 by: Otteneder Hermann
        103545 by: BB

URGENT!!! File Uplaod
        103544 by: César Aracena
        103546 by: BB
        103547 by: Jason Wong
        103553 by: César Aracena
        103563 by: John Holmes
        103565 by: BB

Re: Remote cgi script function
        103548 by: Haddad Said
        103551 by: Jason Wong

Removing Empty Lines from Text??
        103550 by: Jason Caldwell
        103552 by: BB
        103556 by: Justin French
        103558 by: BB
        103561 by: Jason Caldwell
        103564 by: BB

imagecopyresized() problems
        103566 by: Phil Ewington

php & JavaScript
        103567 by: Luis Miguel N. Tavora

ftp class problem
        103568 by: Steve Edwards

Sessions problem
        103570 by: Francesco Chicchiriccò

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 ---
Dear pals,

how can we execute  Oracle Data base store procedure (function, procedure,
package) and retrieve the result/s via PHP ?

any example ?

TIA,
edyk

--- End Message ---
--- Begin Message ---
by looking in the manual :) there is someinfo there..

-----Original Message-----
From: èdy kurniawan [mailto:[EMAIL PROTECTED]]
Sent: Monday, 24 June 2002 11:24 AM
To: php general
Subject: [PHP] Using Oracle Data base store procedure (function,
procedure, package)


Dear pals,

how can we execute  Oracle Data base store procedure (function, procedure,
package) and retrieve the result/s via PHP ?

any example ?

TIA,
edyk


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

--- End Message ---
--- Begin Message ---
very thanksful if you could refering to me what part (kinda) manual that
shows my case ?
i've ever read the PHP manual in english, but i can't find what i need.

please..

sincerely,
edyk


----- Original Message -----
From: "Peter" <[EMAIL PROTECTED]>
Subject: RE: [PHP] Using Oracle Data base store procedure (function,
procedure, package)


> by looking in the manual :) there is someinfo there..
>
> -----Original Message-----
> From: èdy kurniawan [mailto:[EMAIL PROTECTED]]
>
> Dear pals,
>
> how can we execute  Oracle Data base store procedure (function, procedure,
> package) and retrieve the result/s via PHP ?
>


--- End Message ---
--- Begin Message ---
have a look here ... this would be a good starting point...

http://www.php.net/manual/en/ref.oracle.php

I am sure this would be available in many other languages apart from just english :)


-----Original Message-----
From: èdy kurniawan [mailto:[EMAIL PROTECTED]]
Sent: Monday, 24 June 2002 12:20 PM
To: Peter; php general
Subject: Re: [PHP] Using Oracle Data base store procedure (function,
procedure, package)


very thanksful if you could refering to me what part (kinda) manual that
shows my case ?
i've ever read the PHP manual in english, but i can't find what i need.

please..

sincerely,
edyk


----- Original Message -----
From: "Peter" <[EMAIL PROTECTED]>
Subject: RE: [PHP] Using Oracle Data base store procedure (function,
procedure, package)


> by looking in the manual :) there is someinfo there..
>
> -----Original Message-----
> From: èdy kurniawan [mailto:[EMAIL PROTECTED]]
>
> Dear pals,
>
> how can we execute  Oracle Data base store procedure (function, procedure,
> package) and retrieve the result/s via PHP ?
>



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

--- End Message ---
--- Begin Message ---
Peter,

Thanks for your ASAP response,
Have you ever touch with oracle scripting ?
The manual doesn't show how we can execute kind of oracle store procedure ..

I thought that PHP only supporting for SQL - query only but not supported to
retrieve PL-SQL,
When I do the samething with Oracle developer in PHP environment so I have
to convert my PL-SQL which stored in Oracle DB to PHP script. In my mind it
shows that PHP only use Oracle just only 'data storage', could not retrieve
many additional features of oracle itself.

CMIIW,
edyk


----- Original Message -----
From: "Peter" <[EMAIL PROTECTED]>
Subject: RE: [PHP] Using Oracle Data base store procedure (function,
procedure, package)


> have a look here ... this would be a good starting point...
>
> http://www.php.net/manual/en/ref.oracle.php
>
> I am sure this would be available in many other languages apart from just
english :)
>
>
> -----Original Message-----
> From: èdy kurniawan [mailto:[EMAIL PROTECTED]]
> procedure, package)
>
>
> very thanksful if you could refering to me what part (kinda) manual that
> shows my case ?
> i've ever read the PHP manual in english, but i can't find what i need.
>
> please..
>
> sincerely,
> edyk


--- End Message ---
--- Begin Message ---
I don't know ... am only just starting to use php & oracle today :)


-----Original Message-----
From: èdy kurniawan [mailto:[EMAIL PROTECTED]]
Sent: Monday, 24 June 2002 12:46 PM
To: Peter; php general
Subject: Re: [PHP] Using Oracle Data base store procedure (function,
procedure, package)


Peter,

Thanks for your ASAP response,
Have you ever touch with oracle scripting ?
The manual doesn't show how we can execute kind of oracle store procedure ..

I thought that PHP only supporting for SQL - query only but not supported to
retrieve PL-SQL,
When I do the samething with Oracle developer in PHP environment so I have
to convert my PL-SQL which stored in Oracle DB to PHP script. In my mind it
shows that PHP only use Oracle just only 'data storage', could not retrieve
many additional features of oracle itself.

CMIIW,
edyk


----- Original Message -----
From: "Peter" <[EMAIL PROTECTED]>
Subject: RE: [PHP] Using Oracle Data base store procedure (function,
procedure, package)


> have a look here ... this would be a good starting point...
>
> http://www.php.net/manual/en/ref.oracle.php
>
> I am sure this would be available in many other languages apart from just
english :)
>
>
> -----Original Message-----
> From: èdy kurniawan [mailto:[EMAIL PROTECTED]]
> procedure, package)
>
>
> very thanksful if you could refering to me what part (kinda) manual that
> shows my case ?
> i've ever read the PHP manual in english, but i can't find what i need.
>
> please..
>
> sincerely,
> edyk


--- End Message ---
--- Begin Message ---

Hi

I think you should have a look to
http://www.php.net/manual/en/function.ocibindbyname.php.

I use this function to call an Oracle Stored Procedure and retrieve the
return value.

Regards

Laurent


                                                                                       
                                   
                    èdy kurniawan                                                      
                                   
                    <edy.kurniawan@astra-       To:     "Peter" <[EMAIL PROTECTED]>, 
"php general"                          
                    honda.com>                   <[EMAIL PROTECTED]>           
                                   
                                                cc:                                    
                                   
                    24/06/02 04:46              Subject:     Re: [PHP] Using Oracle 
Data base store procedure (function,  
                    Please respond to èdy        procedure, package)                   
                                   
                    kurniawan                                                          
                                   
                                                                                       
                                   
                                                                                       
                                   




Peter,

Thanks for your ASAP response,
Have you ever touch with oracle scripting ?
The manual doesn't show how we can execute kind of oracle store procedure
..

I thought that PHP only supporting for SQL - query only but not supported
to
retrieve PL-SQL,
When I do the samething with Oracle developer in PHP environment so I have
to convert my PL-SQL which stored in Oracle DB to PHP script. In my mind it
shows that PHP only use Oracle just only 'data storage', could not retrieve
many additional features of oracle itself.

CMIIW,
edyk


----- Original Message -----
From: "Peter" <[EMAIL PROTECTED]>
Subject: RE: [PHP] Using Oracle Data base store procedure (function,
procedure, package)


> have a look here ... this would be a good starting point...
>
> http://www.php.net/manual/en/ref.oracle.php
>
> I am sure this would be available in many other languages apart from just
english :)
>
>
> -----Original Message-----
> From: èdy kurniawan [mailto:[EMAIL PROTECTED]]
> procedure, package)
>
>
> very thanksful if you could refering to me what part (kinda) manual that
> shows my case ?
> i've ever read the PHP manual in english, but i can't find what i need.
>
> please..
>
> sincerely,
> edyk



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





--- End Message ---
--- Begin Message ---
On Monday, June 24, 2002, 3:46:02 AM, "èdy kurniawan" wrote:
> The manual doesn't show how we can execute kind of oracle store procedure ..

I know nothing about using Oracle from PHP, but a quick search on Google
revealed the following: http://www.phpworld.com/manual/ref.oci8.html - example
2 shows how to call a stored procedure.

-- 
Stuart

--- End Message ---
--- Begin Message ---
I have a shopping cart where users have added a list of documents for 
purchase. I want to allow users to remove documents from the cart before 
checkout. There are no quantities involved-- this is a "yes I want 
$docID" or "no I don't" situation.

I thought the easiest way might be to have a checked checkbox before 
each item (. . . name=checkbox value=true checked) with instructions to 
uncheck the box and click on a "save changes" button to refresh the 
cart. I've spent many hours trying to get this scheme to work. Before I 
spend more time beating my head against the same 'ol wall, I thought I'd 
ask those more knowledgeable if a checkbox is the best method of 
achieving this. If so, this is the code I tried to use (the $save 
variable is passed as a hidden form field, $cart is an array and a  
registered session variable)

if($save)
 { 
   if($checkbox != true)
      unset($cart[$docID]);
   
     else 
       $cart[$docID] = $$docID;
   
}

(I should say this is the latest version. I've tried lots of way, but 
none have worked. I've tried "foreach" in lots of ways, but I may not 
understand this construct properly. For example I've tried:

if($save)
 { 
   foreach ($cart as $docID => $checkbox)
   {
   if($checkbox != true)
      unset($cart[$docID]);
   
     else 
       $cart[$docID] = $$docID;
   }
)

If you can suggest code that works, that would be great, or at least 
point me in the right direction if I'm on the wrong track with 
checkboxes. If you haven't noticed already, I'm very, very new to PHP 
and haven't quite got the hang of it yet. :=)

Thanks, Vicki
--- End Message ---
--- Begin Message ---
Hi Vicki:

On Sun, Jun 23, 2002 at 09:30:39PM -0400, Vicki wrote:
> I have a shopping cart where users have added a list of documents for 
> purchase. I want to allow users to remove documents from the cart before 
> checkout. There are no quantities involved-- this is a "yes I want 
> $docID" or "no I don't" situation.

The whole process starts with the form.  If that's not made correctly, you 
aren't going to get anywhere in your checkout.  From your code, I have a 
hunch that's where your first problem lies.

<form>
 <input type="checkbox" name="item[124]" checked />
 <input type="checkbox" name="item[268]" checked />
</form>


Now, the receiving script:

if ( !empty($_POST['save']) ) {
   if ( empty($_POST['item']) OR !is_array($_POST['item']) ) {
      echo "HEY!  You haven't selected any items!";
   } else {
      while ( list($ID,) = each($_POST['item']) ) {
         $cart[$ID];
      }
   }
}


This doesn't delete stuff from the cart.  It just creates a new $cart
array containing only the things the person wants.

Note, I'm using empty() a lot to avoid "Warnings" in the event the
variables aren't set at all.

Also using the $_POST[] superglobal array, assuming you're using a 
version of PHP >= 4.1.0.

Enjoy,

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
--- End Message ---
--- Begin Message ---
Is there a way to limit the number of characters that may be inputed into:
        a) a <input type=text . . . > input
        b) a <textarea . . . > input

I would like to control the maximum number of characters for each of these 
inputs.

Any suggestions of where to look, or how to do it, if it's possible, would be 
greatly appreciated.

Tia,
Andre


-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/
--- End Message ---
--- Begin Message ---
a) maxlength="xx"
b) use javascript
(document.forms["frm_name"].elements["textarea"].value.length)
      (I think you need the ".value" bit)


-----Original Message-----
From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 24, 2002 11:53 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Limiting text inputs by character count?


Is there a way to limit the number of characters that may be inputed into:
        a) a <input type=text . . . > input
        b) a <textarea . . . > input

I would like to control the maximum number of characters for each of these 
inputs.

Any suggestions of where to look, or how to do it, if it's possible, would
be 
greatly appreciated.

Tia,
Andre
--- End Message ---
--- Begin Message ---
 for standard text input use

<input name="textfield" type="text" size="10" maxlength="10">  that will only allow 10 
characters

not sure if that will also work for text area's

-----Original Message-----
From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
Sent: Monday, 24 June 2002 11:53 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Limiting text inputs by character count?


Is there a way to limit the number of characters that may be inputed into:
        a) a <input type=text . . . > input
        b) a <textarea . . . > input

I would like to control the maximum number of characters for each of these 
inputs.

Any suggestions of where to look, or how to do it, if it's possible, would be 
greatly appreciated.

Tia,
Andre


-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/

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

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

That'll fix it.

Regards,
Andre

On Sunday 23 June 2002 10:04 pm, you wrote:
>  for standard text input use
>
> <input name="textfield" type="text" size="10" maxlength="10">  that will
> only allow 10 characters
>
> not sure if that will also work for text area's
>
> -----Original Message-----
> From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> Sent: Monday, 24 June 2002 11:53 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Limiting text inputs by character count?
>
>
> Is there a way to limit the number of characters that may be inputed into:
>       a) a <input type=text . . . > input
>       b) a <textarea . . . > input
>
> I would like to control the maximum number of characters for each of these

> inputs.
>
> Any suggestions of where to look, or how to do it, if it's possible, would
> be greatly appreciated.
>
> Tia,
> Andre

-- 
Please pray the Holy Rosary to end the holocaust of abortion.
Remember in your prayers the Holy Souls in Purgatory.

May God bless you abundantly in His love!
For a free Cenacle Scriptural Rosary Booklet: http://www.webhart.net/csrb/
--- End Message ---
--- Begin Message ---
The best way to do this is server side with strlen(). You can use
javascript or maxlength, but if a user wants to get around it, they can.

---John Holmes...

> -----Original Message-----
> From: Martin Towell [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, June 23, 2002 9:47 PM
> To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
> Subject: RE: [PHP] Limiting text inputs by character count?
> 
> a) maxlength="xx"
> b) use javascript
> (document.forms["frm_name"].elements["textarea"].value.length)
>       (I think you need the ".value" bit)
> 
> 
> -----Original Message-----
> From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 24, 2002 11:53 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Limiting text inputs by character count?
> 
> 
> Is there a way to limit the number of characters that may be inputed
into:
>       a) a <input type=text . . . > input
>       b) a <textarea . . . > input
> 
> I would like to control the maximum number of characters for each of
these
> inputs.
> 
> Any suggestions of where to look, or how to do it, if it's possible,
would
> be
> greatly appreciated.
> 
> Tia,
> Andre
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
What exactly happens when you put three equal-signs together instead of
just one or two?  I've seen this in other people's code, then search
php.net and found nothing.

Also, what happens when you put a @ thingy in front of a function?  Does
it surpress the errors?

Thanks!!
--- End Message ---
--- Begin Message ---
http://php.net/operators
which would take you to:
http://www.php.net/manual/en/language.operators.comparison.php
and
http://www.php.net/manual/en/language.operators.errorcontrol.php

It's all there.

-Rasmus

On Sun, 23 Jun 2002, Phil Schwarzmann wrote:

> What exactly happens when you put three equal-signs together instead of
> just one or two?  I've seen this in other people's code, then search
> php.net and found nothing.
>
> Also, what happens when you put a @ thingy in front of a function?  Does
> it surpress the errors?
>
> Thanks!!
>

--- End Message ---
--- Begin Message ---
on 24/06/02 12:46 PM, Phil Schwarzmann ([EMAIL PROTECTED]) wrote:

> What exactly happens when you put three equal-signs together instead of
> just one or two?  I've seen this in other people's code, then search
> php.net and found nothing.

http://www.php.net/manual/en/language.operators.comparison.php
( I did a search php.net/comparison and got it straight away )

> Also, what happens when you put a @ thingy in front of a function?  Does
> it surpress the errors?

Yes, or perhaps allows you to form your own errors with:
or die ('something');


Justin French

--- End Message ---
--- Begin Message ---
== compares 2 variables regardless of type ("1" == 1)
=== compares 2 variables with type in mind ("1" !== 1)
@ supresses errors in functions

"Phil Schwarzmann" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> What exactly happens when you put three equal-signs together instead of
> just one or two?  I've seen this in other people's code, then search
> php.net and found nothing.
>
> Also, what happens when you put a @ thingy in front of a function?  Does
> it surpress the errors?
>
> Thanks!!
>


--- End Message ---
--- Begin Message ---


Hello,
  
 Can anyone please clear my doubt....

I need to display some strings one by one after some specific time..In
javascript we can use setTimeout() function.Is there any function like
this in phpscript ???..


Thanks & Regards
Uma

--- End Message ---
--- Begin Message ---
maybe

while(true)
{
  echo "word";
  flush();
  sleep(1);
}

but I don't think that's exactly what you want, is it?

-----Original Message-----
From: Uma Shankari T. [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 24, 2002 1:14 PM
To: PHP
Subject: [PHP] Time Delay using phpscript

Hello,
  
 Can anyone please clear my doubt....

I need to display some strings one by one after some specific time..In
javascript we can use setTimeout() function.Is there any function like
this in phpscript ???..

Thanks & Regards
Uma

--- End Message ---
--- Begin Message ---
> I need to display some strings one by one after some specific time..In
> javascript we can use setTimeout() function.Is there any function like
> this in phpscript ???..

No, not really. PHP just evaluates the script and sends the output to
the browser. It has no control over the display at all. 

Best you could do is output some JavaScript along with your HTML and
attempt to control it that way. Basically, since you already know how to
do it with JavaScript, have PHP write the JavaScript for you...

---John Holmes...

--- End Message ---
--- Begin Message ---
Why would you want to do this?  All it will achieve is delaying the output
of the entire file to the browser...

If a page would usually take .5 seconds to parse, and you have 10 seconds of
delays in the script, then the browser will get the page in around 10.5
seconds... the user will just see a delay, NOT a page with new things every
few seconds in the already-rendered page.

Once again, PHP is a SERVER SIDE language, and EVERYTHING happens before the
page is sent to the browser.   If you want stuff to happen on the CLIENT
SIDE, like displaying a new line every few seconds, then this needs to be
achieved in the BROWSER, with JavaScript or something.


If you View source on a PHP script in your browser, all you'll see is HTML
code... no PHP -- it's all parsed on the server.


Justin French



on 24/06/02 1:14 PM, Uma Shankari T. ([EMAIL PROTECTED])
wrote:

> I need to display some strings one by one after some specific time..In
> javascript we can use setTimeout() function.Is there any function like
> this in phpscript ???..

--- End Message ---
--- Begin Message ---
Take a look at this page, it uses flush to stagger the results as php
processes it.  pretty cool

http://www.massassi.com/bTemplate/benchmarks/benchmark_var_assign.php?i=50



-----Original Message-----
From: Uma Shankari T. [mailto:[EMAIL PROTECTED]]
Sent: June 23, 2002 11:14 PM
To: PHP
Subject: [PHP] Time Delay using phpscript




Hello,

 Can anyone please clear my doubt....

I need to display some strings one by one after some specific time..In
javascript we can use setTimeout() function.Is there any function like
this in phpscript ???..


Thanks & Regards
Uma


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



--- End Message ---
--- Begin Message ---
Because when you use php to make a file/directory, the
webserver makes the owner the webserver (usually
"nobody"). Unless you log in as "nobody" (or whatever
respective name), you will not be able to modify the
permissions or delete the file/dir. However, when
logging in and making a file with 777 permissions, php
and the webserver should be able to modify the file...


--- Adrian Murphy <[EMAIL PROTECTED]>
wrote:
> hi,
> how come when i make a dir thus
> 
> mkdir($basedir,0777);
> 
> cute can't then chmod or delete said dir.
> also vice versa : when i create a dir with cute
> with 777 access php can't do anything with it.
> it's very annoying.
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--- End Message ---
--- Begin Message ---
Anyone have a link (or the code) to copy the structure of a blank table
to a new table using mysql?

Thanks!!
--- End Message ---
--- Begin Message ---
Phil:

On Sun, Jun 23, 2002 at 11:14:22PM -0400, Phil Schwarzmann wrote:
> Anyone have a link (or the code) to copy the structure of a blank table
> to a new table using mysql?

It's far simpler to do this from a command line on the system using the
utilities of the database vendor, such as mysqldump, and then importing 
the stuff into the database, again from the command line.

Look at the documentation of the database you're using.

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
--- End Message ---
--- Begin Message ---
> Anyone have a link (or the code) to copy the structure of a blank
table
> to a new table using mysql?

<?
function change_table_name($old_name, $new_name)
{
  $result = mysql_query("show create table $old_name");
  $create = mysql_result($result,0,1);

  str_replace("TABLE `$old_name`","TABLE `$new_name`",$create);

  $result = mysql_query($create);

  return;
}
?>

Untested, add in some error checking and validate the $old and $new
names, and adapt to your needs...

---John Holmes...



--- End Message ---
--- Begin Message ---
I want to round a number to the nearest decimal place...

if the number is 4.623, I want it to display 4.6 
if the number is 2.36, I want it to display 2.7

Is there a function that does this?  round(), ceil(), floor() don't do
this and I've checked through all the math functions in my handy-dandy
"PHP Functions" reference book.

Thanks for your help!!!

Or......if it's too hard to do that, I could just use a function that
chops off the end of some decimals, like...

if the number is 2.343234, I want just 2.3
or if the number is 2.545434534534534534, I want just 2.5

Thanks!!!!!!
--- End Message ---
--- Begin Message ---
according to the pdf version of the manual I have, round() is what you need

float round(float val[, int precision])

have another look that the man page

-----Original Message-----
From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 24, 2002 1:35 PM
To: [EMAIL PROTECTED]
Subject: [PHP] rounding a number


I want to round a number to the nearest decimal place...

if the number is 4.623, I want it to display 4.6 
if the number is 2.36, I want it to display 2.7

Is there a function that does this?  round(), ceil(), floor() don't do
this and I've checked through all the math functions in my handy-dandy
"PHP Functions" reference book.

Thanks for your help!!!

Or......if it's too hard to do that, I could just use a function that
chops off the end of some decimals, like...

if the number is 2.343234, I want just 2.3
or if the number is 2.545434534534534534, I want just 2.5

Thanks!!!!!!
--- End Message ---
--- Begin Message ---
I think what you're looking for is number_format() - you can set decimal
places with it and used in combo with round(), ceil(), and/or floor(), you
should be able to achieved the desired result.

http://www.php.net/manual/en/function.number-format.php

HTH,

Jason Soza

-----Original Message-----
From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]]
Sent: Sunday, June 23, 2002 7:35 PM
To: [EMAIL PROTECTED]
Subject: [PHP] rounding a number


I want to round a number to the nearest decimal place...

if the number is 4.623, I want it to display 4.6
if the number is 2.36, I want it to display 2.7

Is there a function that does this?  round(), ceil(), floor() don't do
this and I've checked through all the math functions in my handy-dandy
"PHP Functions" reference book.

Thanks for your help!!!

Or......if it's too hard to do that, I could just use a function that
chops off the end of some decimals, like...

if the number is 2.343234, I want just 2.3
or if the number is 2.545434534534534534, I want just 2.5

Thanks!!!!!!

--- End Message ---
--- Begin Message ---
On Monday 24 June 2002 11:34, Phil Schwarzmann wrote:
> I want to round a number to the nearest decimal place...
>
> if the number is 4.623, I want it to display 4.6
> if the number is 2.36, I want it to display 2.7

You don't really mean 2.36 --> 2.7 ??

> Is there a function that does this?  round(), ceil(), floor() don't do
> this and I've checked through all the math functions in my handy-dandy
> "PHP Functions" reference book.

round() seems to work. What's the problem you're having?

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

/*
That's no moon...
                -- Obi-wan Kenobi
*/

--- End Message ---
--- Begin Message ---
Jason Wong wrote:

> On Monday 24 June 2002 11:34, Phil Schwarzmann wrote:
> > I want to round a number to the nearest decimal place...
> >
> > if the number is 4.623, I want it to display 4.6
> > if the number is 2.36, I want it to display 2.7
>
> You don't really mean 2.36 --> 2.7 ??
>
> > Is there a function that does this?  round(), ceil(), floor() don't do
> > this and I've checked through all the math functions in my handy-dandy
> > "PHP Functions" reference book.
>
> round() seems to work. What's the problem you're having?
>

It's worth noting that round doesn't always work e.g.

try round(0.35,1)....



>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> That's no moon...
>                 -- Obi-wan Kenobi
> */

--- End Message ---
--- Begin Message ---
Jason Wong wrote:

> On Monday 24 June 2002 11:34, Phil Schwarzmann wrote:
> > I want to round a number to the nearest decimal place...
> >
> > if the number is 4.623, I want it to display 4.6
> > if the number is 2.36, I want it to display 2.7
>
> You don't really mean 2.36 --> 2.7 ??
>
> > Is there a function that does this?  round(), ceil(), floor() don't do
> > this and I've checked through all the math functions in my handy-dandy
> > "PHP Functions" reference book.
>
> round() seems to work. What's the problem you're having?
>

It's worth noting that round doesn't always work e.g.

try round(0.35,1)....



>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> That's no moon...
>                 -- Obi-wan Kenobi
> */

--- End Message ---
--- Begin Message ---
Phil Schwarzmann wrote:

> I want to round a number to the nearest decimal place...
>
> if the number is 4.623, I want it to display 4.6
> if the number is 2.36, I want it to display 2.7
>
> Is there a function that does this?  round(), ceil(), floor() don't do
> this and I've checked through all the math functions in my handy-dandy
> "PHP Functions" reference book.
>
> Thanks for your help!!!
>
> Or......if it's too hard to do that, I could just use a function that
> chops off the end of some decimals, like...
>
> if the number is 2.343234, I want just 2.3
> or if the number is 2.545434534534534534, I want just 2.5
>
> Thanks!!!!!!

As I understand it, you just want to truncate the number, without
rounding.

I think you are right, there isn't a function to do it for you but the
following code should do it:

intval(4.623 * 10)/10

or more generally:

function truncate_number($mynumber,$places) {

return intval($mynumber * pow(10,$places))/pow(10,$places);
}

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

On Sun, Jun 23, 2002 at 01:24:57AM -0600, Thomas E. Ruth wrote:
> 
> If I have a script called "sendheader.php" with the following:
> 
> <?
> if (! isset($GLOBALS[sendheader])) {
>       header("Location: http://blah.com/sendheader.php";);
>       exit;
> }
> 
> echo "blah";
> ?>

Dude, what IS the point of this?

If the $sendheader variable isn't set, you're sending the person back to
the same page w/o setting the sentheader variable first...  So, you've 
created an infinite loop.  Do you mean to be doing:

   header('Location: http://blah.com/sendheader.php?sendheader=y');


Some other tips:

When array keys are strings, put them in quotes ($GLOBALS['sendheader'])

Use single quotes rather than double quotes when dealing with strings that 
are not being evaluated for variables in them.

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
--- End Message ---
--- Begin Message ---
Steven:

On Sun, Jun 23, 2002 at 10:30:56PM +0100, Steven Dowd wrote:
> 
> ID , Address, Name, Relation
> 1, market st, fred waters, head
> 2, market st, mrs waters, wife
> 3, market st, paul waters, son
> 4, market st, jim wheeler, head
> 5, market st, mrs wheeler, wife
> 6, market st, ann wheeler, dau
> 
> ID , Address, Name, Relation, household
> 1, market st, fred waters, head, 1
> 2, market st, mrs waters, wife, 1
> 3, market st, paul waters, son, 1
> 4, market st, jim wheeler, head, 2
> 5, market st, mrs wheeler, wife, 2
> 6, market st, ann wheeler, dau, 2
> 
> so, I know what I want to do, but am totally at a loss how to do it. I
> know I need to cycle through the whole of the 20k records, updating the
> new 'household' table with a number that increments by +1 and use that
> number for all entries until after each instance of the data being
> 'head'.  when if its incremented by +1, it will be another family unit.

But, what's the guarantee that the head is always the first record in the
group?  Similarly, what's even guaranteeing that the houeholds even have
their members in consecutive rows?

Anyway, you'd be wise to normalize your table structure.  At a minimum, 
the "relation" should not be a text field, but rather a tiny integer, with 
the actual names of the type of relation in a separate table which you'd 
"join" to in your queries.

Okay, back to your question, assuming everything is miraculously ordered
and grouped correctly...

Write and execute your main query.  Then start a while loop to go through 
each record.  Assuming you're using MySQL...

In that while loop, have an if statement checking if you're looking at the 
head of the household.  In case you are, bump up the counter.  Regardless, 
make a query string to run later updating the current record.

Lastly, loop through the array of update queries, executing each as you 
go along.

Here's some untested code for you to try:

  $Queries = array();
  $Counter = 0;

  while ( $Record = mysql_fetch_array($resource, MYSQL_ASSOC) ) {
     if ($Record['Relation'] = 'head') {
        $Counter++;
     }
     $Queries[] = "UPDATE table SET Household=$Counter WHERE ID=" .
        $Record['ID'];
  }

  while ( list(,$Val) = each($Queries) ) {
     mysql_query($Val);
  }

Any questions?  Read the PHP manual for the particular function.

Enjoy,

--Dan

-- 
               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
> I can't get UPDATE to work properly when querying MySQL.
> 
> $query = "UPDATE $table SET field1='$var1' WHERE id='$id'";
> 
> I want to update one field of one row in a table.  Is this syntax
> correct?
> 
if id is an int type, no. You only need to quote values being passed to 
[var]char or text type fields.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam
--- End Message ---
--- Begin Message ---
On Monday 24 June 2002 13:03, David Robley wrote:
> In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says...
>
> > I can't get UPDATE to work properly when querying MySQL.
> >
> > $query = "UPDATE $table SET field1='$var1' WHERE id='$id'";
> >
> > I want to update one field of one row in a table.  Is this syntax
> > correct?
>
> if id is an int type, no. You only need to quote values being passed to
> [var]char or text type fields.

I don't know whether it is 'correct', but it works with or without quotes. For 
consistency I would use the quotes.

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

/*
It's easier to take it apart than to put it back together.
                -- Washlesky
*/

--- End Message ---
--- Begin Message ---
Hello php-general,

I need to run a separate version of Apache on the same server I also
what to use a different copy of the php.ini file with that version of
apache. I am aware that I can override most of the php.ini settings in
the httpd.conf file. But this is not what I want to do.
Php will be running as a DSO with apache. So is the only way I can do
this is to install a different copy of php to run with this version of
Apache. Or is there a way I can get the httpd.conf file to read a
different copy of php.ini




-- 
Best regards,
 rdkurth                          mailto:[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
I believe you will need to compile two versions, and point two to
different php.ini locations.

Here's a snipet from the manual.
http://www.php.net/manual/en/install.configure.php#install.configure.options.php

Al


--enable-maintainer-mode

Enable make rules and dependencies not useful (and sometimes confusing)
to the casual installer.
--with-config-file-path=PATH

Sets the path in which to look for php.ini, defaults to PREFIX/lib.
--enable-safe-mode

Enable safe mode by default.
--with-exec-dir[=DIR]

Only allow executables in DIR when in safe mode defaults to
/usr/local/php/bin.
--enable-magic-quotes

Enable magic quotes by default.
--disable-short-tags

Disable the short-form <? start tag by default. 

On Mon, 2002-06-24 at 01:38, [EMAIL PROTECTED] wrote:
> Hello php-general,
> 
> I need to run a separate version of Apache on the same server I also
> what to use a different copy of the php.ini file with that version of
> apache. I am aware that I can override most of the php.ini settings in
> the httpd.conf file. But this is not what I want to do.
> Php will be running as a DSO with apache. So is the only way I can do
> this is to install a different copy of php to run with this version of
> Apache. Or is there a way I can get the httpd.conf file to read a
> different copy of php.ini
> 
> 
> 
> 
> -- 
> Best regards,
>  rdkurth                          mailto:[EMAIL PROTECTED]
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
-- 
This email was sent with Ximian Evolution.

--- End Message ---
--- Begin Message ---
César aracena wrote:
> The catch would be to make PHP to auto assign the relatives "level" by
> knowing it has to start from $i=1 and loop $i++ until no other kid is
> inserted. Now that I write it, it seems I could use a for loop, but what
> should be the structure of it using the $name <> 0 you told me?

the name <> 0 was a sql-query - it will return a ressource which will 
enable you to make something like

$i=0;
while($row = mysql_fetch_assoc($nameless_result){

#psuedo-code#
# mysql_query=("insert into table set relativenumber = 'jr$i' where 
ID=$row["ID"]");
}

regards

Jesper Brunholm

btw: please do not write to my private email

-- 
Phønix - Danish folk music from young musicians - http://www.phonixfolk.dk


--- End Message ---
--- Begin Message ---
> the name <> 0 was a sql-query - it will return a ressource which will
> enable you to make something like
> 
> $i=0;
> while($row = mysql_fetch_assoc($nameless_result){
> 
> #psuedo-code#
> # mysql_query=("insert into table set relativenumber = 'jr$i' where
> ID=$row["ID"]");
> }

[César L. Aracena] I think you just showed me the smartest way of doing
it. After I deal with a deadline here, I will change my hard coded
script in order to try it... will let you know.

Thanks a lot.

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
> I am coming over from Perl life.  Does anyone recommend any good beginners
> books on learning PHP?  I am looking for something similar too learning
> perl from Oreily.

I must confess that I do not know the O'reilly book you're talking 
about, but "PHP & MySQL development" from SAMS is a good book both as a 
reference, basic intro and has a lot of in-depth examples. Furthermore, 
it has a rather fine introduction to OO-programming in php

regards

Jesper Brunholm

-- 
Phønix - Danish folk music from young musicians - http://www.phonixfolk.dk


--- End Message ---
--- Begin Message ---
Couldn't help noticing with the upgrade to version 4.21 that this function
is no longer available,

I've looked around and not found much on the subject but so far I have
worked out that my code basically has to change from this...

<?xslt_output_begintransform($xslfile);
      <StatusBar>
        <Date><?print(date('Y-m-d'));?></Date>
        <BuyerName><?print unparsedXML($globalBuyerName);?></BuyerName>
       <?if($MainWindow != "No"){?>
        <SearchSite InputName="code" submitName="">
          <select name="searchtype">
                                          <option value="Whole Site">
                                            Whole Site
                                          </option>
                                          <option value="Product Code">
                                                  Product Code
                                          </option>
                                          <option value="Categories">
                                                Categories
                                        </option>
                                        <option value="UNSPCSC">
                                                UNPCSC
                                        </option>
                                        <option value="Manufacturer Name">
                                                Manufacturer Name
                                        </option>
                                        <option value="Manufacturer Code">
                                                Manufacturer Code
                                        </option>
                                  </select>
         </SearchSite>
        <SearchCategories InputName="catcode">
          <SelectFromCategoryLevel1 name="searchCategory"/>
        </SearchCategories>
        <?}?>
      </StatusBar>
<? xslt_output_endtransfrom();?>



To this ...



$XMLText.="<StatusBar><Date>".(date('Y-m-d'))."</Date>";
$XMLText.="<BuyerName>".unparsedXML($globalBuyerName)."</BuyerName>";
      if($MainWindow != "No"){
$XMLText.="<SearchSite InputName=\"code\" submitName=\"\"><select
name=\"searchtype\"><option value=\"Whole Site\">Whole Site</option><option
value=\"Product Code\">Product Code</option><option
value=\"Categories\">Categories</option><option
value=\"UNSPCSC\">UNPCSC</option><option value=\"Manufacturer
Name\">Manufacturer Name</option><option value=\"Manufacturer
Code\">Manufacturer Code</option></select></SearchSite>";
$XMLText.="<SearchCategories InputName=\"catcode\"><SelectFromCategoryLevel1
name=\"searchCategory\"/></SearchCategories>";
$XMLText.="</StatusBar>";

$xh = xslt_create();
$result = xslt_process($xh, $XMLText, $xslfile, NULL, $arguments);
print $result;

I've been using 4.06 for a while and the code in the old way is much easier
to read (especially with a Color Coded Editor) and therefore much easier to
maintain and there is a lot of it..,

I've started changing the code to make it work, but the whole time I'm
feeling sorry for the Poor Tortured Soul who has to maintain it. and then it
hits me that the Poor T S will most probably be me.

Why did the xslt_output functions get removed? As far as I could tell they
worked just fine.
Am I approaching this change to the code from the wrong angle?
Is there a way to use XML and XSL in the way similar to the xslt_output
functions?
I was thinking of having files that could call the Old XML files and execute
the PHP inside them and return a string of executed phtml.
I think I could shell out to PHP.exe, but to me that doesn't seem very
efficient? as php is compiled into apache at the moment. Is there another
way to execute a PHP file called from within another PHP file and return the
output results as a String?

Any suggestions would be greatly appreciated.

By the way PHP is fantastic.
Keep up the Good Work.

Nigel
[EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---

hi everybody,

i have a short problem:
i have two drop down menues in a form. the content of the second dropdown is
dependent from the selection in the first dropdown menue. now i want write a
short javascript which runs on the onSelect - event of the first dropdown.
this script gives me the selected entry of the first dropdown menue. now i
have to give this value somehow into the PHP-environment for a DB-Query.
The feched data i want dynamically fill into the second dropdown. But how do
I get the value from the javascript variable into the php environment
without an submit of the form?? has enybody a solution for this?

thanx so far - hermann...



--- End Message ---
--- Begin Message ---
http://www.mattkruse.com/javascript/dynamicoptionlist/source.html

hope this helps

"Otteneder Hermann" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

hi everybody,

i have a short problem:
i have two drop down menues in a form. the content of the second dropdown is
dependent from the selection in the first dropdown menue. now i want write a
short javascript which runs on the onSelect - event of the first dropdown.
this script gives me the selected entry of the first dropdown menue. now i
have to give this value somehow into the PHP-environment for a DB-Query.
The feched data i want dynamically fill into the second dropdown. But how do
I get the value from the javascript variable into the php environment
without an submit of the form?? has enybody a solution for this?

thanx so far - hermann...





--- End Message ---
--- Begin Message ---
Hi all.
 
Sorry for this, but a couple of hours ago (imagine… Monday at 3 in the
morning) one of my clients called and asked me to put a Photography
upload for each member of his business and the dead line is in 2 hours.
 
I’ve been messing around for the first time with file uploading, but it
seems I keep doing something wrong. I’m using:
 
<form action="../../phpinfo.php" method="post"
enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="1000">
<input type="hidden" name="numsocio" value="<?=$numsocio?>">
<input type="hidden" name="browse" value="yes">
Select Photography: <input name="userfile" type="file">
<input type="submit" name="submit" value="Add Photo">
</form>
 
but phpinfo tells me (Under HTTP_POST_FILES["userfile"]):
 
Array
(
    [name] => picture.jpg
    [type] => image/pjpeg
    [tmp_name] => none
    [size] => 0
)
 
Why is this??? Also, this is going to be the first time I deal with file
managing… so if you please throw some bones at me…
 
Thanks very3 much… I’m on dial-up but will stay connected though.
 
 <mailto:[EMAIL PROTECTED]> Cesar Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621
 
--- End Message ---
--- Begin Message ---
http://www.php.net/manual/en/function.is-uploaded-file.php

"César aracena" <[EMAIL PROTECTED]> wrote in message
000901c21b5a$e1aea180$cdc405c8@gateway">news:000901c21b5a$e1aea180$cdc405c8@gateway...
Hi all.

Sorry for this, but a couple of hours ago (imagine. Monday at 3 in the
morning) one of my clients called and asked me to put a Photography
upload for each member of his business and the dead line is in 2 hours.

I've been messing around for the first time with file uploading, but it
seems I keep doing something wrong. I'm using:

<form action="../../phpinfo.php" method="post"
enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="1000">
<input type="hidden" name="numsocio" value="<?=$numsocio?>">
<input type="hidden" name="browse" value="yes">
Select Photography: <input name="userfile" type="file">
<input type="submit" name="submit" value="Add Photo">
</form>

but phpinfo tells me (Under HTTP_POST_FILES["userfile"]):

Array
(
    [name] => picture.jpg
    [type] => image/pjpeg
    [tmp_name] => none
    [size] => 0
)

Why is this??? Also, this is going to be the first time I deal with file
managing. so if you please throw some bones at me.

Thanks very3 much. I'm on dial-up but will stay connected though.

 <mailto:[EMAIL PROTECTED]> Cesar Aracena
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621




--- End Message ---
--- Begin Message ---
On Monday 24 June 2002 16:40, César Aracena wrote:
> Hi all.
>
> Sorry for this, but a couple of hours ago (imagine… Monday at 3 in the
> morning) one of my clients called and asked me to put a Photography
> upload for each member of his business and the dead line is in 2 hours.
>
> I’ve been messing around for the first time with file uploading, but it
> seems I keep doing something wrong. I’m using:
>
> <form action="../../phpinfo.php" method="post"
> enctype="multipart/form-data">
> <input type="hidden" name="MAX_FILE_SIZE" value="1000">

1000 bytes seems to be a pretty low limit. Even thumbnails takes several KB. 
Try increasing it.

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

/*
What this country needs is a good five dollar plasma weapon.
*/

--- End Message ---
--- Begin Message ---
You're completely right - as usual - now for the file handling... what's
better? Storing it to the DB or as file??

Thanks a lot.

> -----Original Message-----
> From: Jason Wong [mailto:[EMAIL PROTECTED]]
> Sent: Monday, June 24, 2002 5:46 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] URGENT!!! File Uplaod
> 
> On Monday 24 June 2002 16:40, César Aracena wrote:
> > Hi all.
> >
> > Sorry for this, but a couple of hours ago (imagine… Monday at 3 in
the
> > morning) one of my clients called and asked me to put a Photography
> > upload for each member of his business and the dead line is in 2
hours.
> >
> > I’ve been messing around for the first time with file uploading, but
it
> > seems I keep doing something wrong. I’m using:
> >
> > <form action="../../phpinfo.php" method="post"
> > enctype="multipart/form-data">
> > <input type="hidden" name="MAX_FILE_SIZE" value="1000">
> 
> 1000 bytes seems to be a pretty low limit. Even thumbnails takes
several
> KB.
> Try increasing it.
> 
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development
*
> 
> /*
> What this country needs is a good five dollar plasma weapon.
> */
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
> You're completely right - as usual - now for the file handling...
what's
> better? Storing it to the DB or as file??

File

--- End Message ---
--- Begin Message ---
It does depend on the usage, but general files are better

"John Holmes" <[EMAIL PROTECTED]> wrote in message
000a01c21b69$74acc170$b402a8c0@mango">news:000a01c21b69$74acc170$b402a8c0@mango...
> > You're completely right - as usual - now for the file handling...
> what's
> > better? Storing it to the DB or as file??
>
> File
>


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

See when i echo $contents, the page displayed contains backgrounds and other
text from the remote site, how can i crop only the returned query and
display it in a page with my backgrounds etc

thanks

"John Holmes" <[EMAIL PROTECTED]> wrote in message
000a01c21aef$f58fc0a0$b402a8c0@mango">news:000a01c21aef$f58fc0a0$b402a8c0@mango...
> > I am new to php, I would like to create a function that when called
> > sends text from a text box as a query to a remote cgi script ,e.g
> > http://www.anydomain.com/cgi-bin/script.cgi, and return the results as
> a
> >   variable so that i can echo the returned variable to an html page.
>
> <?
> $contents = "";
> $text = "whatever...";
>
> $ftext = urlencode($text);
>
> $fp = fopen("http://www.example.com/cgi-bin/script.cgi?text="; . $ftext,
> "r");
>
> while($data = fread($fp,1000))
> { $contents .= $data; }
>
> fclose ($fd);
>
> ?>
>
> The response is now in $contents. Adapt to your needs.
>
> ---John Holmes...
>


--- End Message ---
--- Begin Message ---
On Monday 24 June 2002 16:47, Haddad Said wrote:

> See when i echo $contents, the page displayed contains backgrounds and
> other text from the remote site, how can i crop only the returned query and
> display it in a page with my backgrounds etc

Short answer: with great difficulty.
Longer answer: use some form of regular expression to extract the bits that 
you need displayed.

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

/*
If parents would only realize how they bore their children.
                -- G.B. Shaw
*/

--- End Message ---
--- Begin Message ---
Is there an elegant way to remove excess blank lines from my form data?

For example;  if someone enters the following text and then press' the
Submit button:

    ----
    This is a some text


    This is more text, and yet even more....
    ----

What I want to do is remove the excess white space and make it look like
this?

    ----
    This is a some text

    This is more text, and yet even more....
    ----

My users may press <enter> too many times and I want to ensure clean text
and formatting.

Thanks.
Jason




--- End Message ---
--- Begin Message ---
$var = preg_replace("/\n*/","\n",$var);
"Jason Caldwell" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Is there an elegant way to remove excess blank lines from my form data?
>
> For example;  if someone enters the following text and then press' the
> Submit button:
>
>     ----
>     This is a some text
>
>
>     This is more text, and yet even more....
>     ----
>
> What I want to do is remove the excess white space and make it look like
> this?
>
>     ----
>     This is a some text
>
>     This is more text, and yet even more....
>     ----
>
> My users may press <enter> too many times and I want to ensure clean text
> and formatting.
>
> Thanks.
> Jason
>
>
>
>


--- End Message ---
--- Begin Message ---
Well, in short, you want to replace \n\n\n or \n\n\n\n with \n\n.

This can be done cleaverly with a regexp (not my expertise at all, but you
want to replace 3 or more occurences of \n in a row with \n\n.

Otherwise, a simple str_replace() will do it an okay job.

something like:

<?
$str = "something\n\nwith\n\ntoo\n\n\nmany\n\n\n\nline\nbreaks";
$str = str_replace('\n\n\n','\n\n',$str) // change three enters to two
$str = str_replace('\n\n\n\n','\n\n',$str) // change four enters to two
?>

Untested of course.

Like I said, a regexp would be better here.


Justin French




on 24/06/02 6:51 PM, Jason Caldwell ([EMAIL PROTECTED]) wrote:

> Is there an elegant way to remove excess blank lines from my form data?
> 
> For example;  if someone enters the following text and then press' the
> Submit button:
> 
> ----
> This is a some text
> 
> 
> This is more text, and yet even more....
> ----
> 
> What I want to do is remove the excess white space and make it look like
> this?
> 
> ----
> This is a some text
> 
> This is more text, and yet even more....
> ----
> 
> My users may press <enter> too many times and I want to ensure clean text
> and formatting.
> 
> Thanks.
> Jason
> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
replace that with
$var = preg_replace("/\n+/","\n",$var);

"Bb" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> $var = preg_replace("/\n*/","\n",$var);
> "Jason Caldwell" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Is there an elegant way to remove excess blank lines from my form data?
> >
> > For example;  if someone enters the following text and then press' the
> > Submit button:
> >
> >     ----
> >     This is a some text
> >
> >
> >     This is more text, and yet even more....
> >     ----
> >
> > What I want to do is remove the excess white space and make it look like
> > this?
> >
> >     ----
> >     This is a some text
> >
> >     This is more text, and yet even more....
> >     ----
> >
> > My users may press <enter> too many times and I want to ensure clean
text
> > and formatting.
> >
> > Thanks.
> > Jason
> >
> >
> >
> >
>
>


--- End Message ---
--- Begin Message ---
neither worked.  any other suggestions?


"Bb" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> replace that with
> $var = preg_replace("/\n+/","\n",$var);
>
> "Bb" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > $var = preg_replace("/\n*/","\n",$var);
> > "Jason Caldwell" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Is there an elegant way to remove excess blank lines from my form
data?
> > >
> > > For example;  if someone enters the following text and then press' the
> > > Submit button:
> > >
> > >     ----
> > >     This is a some text
> > >
> > >
> > >     This is more text, and yet even more....
> > >     ----
> > >
> > > What I want to do is remove the excess white space and make it look
like
> > > this?
> > >
> > >     ----
> > >     This is a some text
> > >
> > >     This is more text, and yet even more....
> > >     ----
> > >
> > > My users may press <enter> too many times and I want to ensure clean
> text
> > > and formatting.
> > >
> > > Thanks.
> > > Jason
> > >
> > >
> > >
> > >
> >
> >
>
>


--- End Message ---
--- Begin Message ---
$var = preg_replace("/[\r\n]+/","\n",$var);
"Jason Caldwell" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> neither worked.  any other suggestions?
>
>
> "Bb" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > replace that with
> > $var = preg_replace("/\n+/","\n",$var);
> >
> > "Bb" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > $var = preg_replace("/\n*/","\n",$var);
> > > "Jason Caldwell" <[EMAIL PROTECTED]> wrote in message
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > Is there an elegant way to remove excess blank lines from my form
> data?
> > > >
> > > > For example;  if someone enters the following text and then press'
the
> > > > Submit button:
> > > >
> > > >     ----
> > > >     This is a some text
> > > >
> > > >
> > > >     This is more text, and yet even more....
> > > >     ----
> > > >
> > > > What I want to do is remove the excess white space and make it look
> like
> > > > this?
> > > >
> > > >     ----
> > > >     This is a some text
> > > >
> > > >     This is more text, and yet even more....
> > > >     ----
> > > >
> > > > My users may press <enter> too many times and I want to ensure clean
> > text
> > > > and formatting.
> > > >
> > > > Thanks.
> > > > Jason
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


--- End Message ---
--- Begin Message ---
Hi,

I am trying to copy and resize an image using imagecopyresized() and 
cannot seem to crack it. Below is the code I am using, can anyone tell 
me why I keep getting and invalid image resource warning and is this 
the src or dest parameter that the error is referring to?

$srcImageName = "../properties/$line[propid].jpg";
$destImageName = $rm_branchref . "_" . $line[propid] . ".jpg";
$destImage = imagecreate(275, 183);
imagecopyresized($destImage, $srcImageName, 0, 0, 0, 0, 275, 183, 
imagesx($srcImageName), imagesy($srcImageName));
imageJpeg($destImage, $destImageName, 75);
imagedestroy($destImage);

All that happens is that I get an identical copy of the image, and not 
a resized one.

TIA

Phil Ewington.
--- End Message ---
--- Begin Message ---
Hi there.

I've tried to include a simple javascript in a .php file, 
but couldn't get it to work.

Actually not even the php code worked at all...

Is there any specific configuration flag that needs to be
set up in the Apache server so that the javascripts work
correctly? 

Thanks in advance

Luis

PS- Btw, I use an Apache server on a RH72 machine



------------------------------
   Luis Miguel N. Távora
   [EMAIL PROTECTED]   

  Message sent via Sylpheed
sylpheed-claws.sourceforge.net
------------------------------
--- End Message ---
--- Begin Message ---
i've written a class for connecting to an ftp server in 
passiv mode, sending a text file, sending one or 
more .mpegs and disconnecting.  

on my test box this script works fine (PHP 4.2.1) BUT 
on my live box (PHP 3.0.18) it fails...

On the live box (php 3.1.8) the script fails when i 
call the ftp passiv mode function  
(*  $conn_pasv = ftp_pasv($this->connection, 1);  *) 

If i comment out this line - the script connects ok but 
then fails when trying to do ftp_put().  

here's the connect method :

// open ftp connection 2 box and authenticate
function connect() {
  $this->connection =  ftp_connect($this->boxip);
  if (!$this->connection) { 
     $this->msgHandler('Could not connect to Box.',1); 
  } else {
     $this->login = ftp_login($this->connection, $this-
>boxuname, $this->boxpass);
   if (!$this->login) { $this->msgHandler('login',1); }
   $conn_pasv = ftp_pasv($this->connection, 1);
   $this->msgHandler('Connected to Set Top Box...',0); 
}
}


In the send method the ftp_put call looks like this -

$put = ftp_put($this->connection, $this->remfile,$this-
>localfile, FTP_BINARY);


Any ideas as to why this bunks in PHP 3?  I'm beginning 
to think upgrading PHP on the live server is the best 
thing to do... can anyone shed any light??

Thanks....

sAluDoS

.  .  .  .  .  .
[EMAIL PROTECTED]
www.mediadome.net
--- End Message ---
--- Begin Message ---
Hello people out there!

I've experienced a curly problem with Linux 2.4.16, Apache 1.3.9 & PHP
4.0.6 (Slackware 8). 

I use a session variable ($login) to manage the authentication to a web
administration interface: every page begins with a simple test which
checks if $login is stored in session. If not, it prompts an error
message.

<?
session_start();
if (!session_is_registered("login")) {
  die("Error: you must log in.");
}

// The page goes here...
?>


Sometimes (I wasn't able to find out any reproducible condition) the
interface kicks off the user: the sessioned variable is lost.

The most amazing thing is that I got no problems with 4.0.3pl1 on Linux
2.4.18 (Debian potato).

Anyone of you can tell me the deeply hidden reasons?

Thanks.

-- 
#######################################
dott. Francesco Chicchiriccò
AX Digital Systems
Via del mare 85/A 00040 Pomezia (RM)

E-mail  [EMAIL PROTECTED]
Phone   +39069180291
FAX     +39069123658
Home    http://chicchiricco.monrif.net
#######################################

--- End Message ---

Reply via email to