php-general Digest 15 Feb 2003 08:32:44 -0000 Issue 1884

Topics (messages 135600 through 135633):

Re: calculating kilobytes
        135600 by: Kevin Stone
        135606 by: joe
        135607 by: Greg Donald
        135633 by: joe

http://www.act.com---CRM
        135601 by: Leonard Burton

Re: need apostrophe solution
        135602 by: Chris Shiflett

Re: text to image
        135603 by: Alex Shi
        135605 by: Alex Shi
        135630 by: Jason Wong
        135632 by: Hugh Danaher

browser identification problem
        135604 by: chip.wiegand.simrad.com
        135612 by: Chris Shiflett
        135629 by: Jason Wong

Urgent Help Needed removing \n\r
        135608 by: Daniel Negron/KBE
        135610 by: Ernest E Vogelsinger

imap_append
        135609 by: Jeff Schwartz

problem with importing fields.
        135611 by: Webmaster MBT

function problem
        135613 by: Peter Gumbrell
        135615 by: Kevin Stone
        135617 by: Peter Gumbrell
        135621 by: Nicholas Wieland

xslt_process problem
        135614 by: Chris

slideshow/flush
        135616 by: Bryan Koschmann - GKT

Re: HTML Mail problem
        135618 by: Manuel Lemos
        135627 by: Mark McCulligh

recursion?????
        135619 by: Alex Davis
        135620 by: Bas Jobsen
        135631 by: David Freeman

Re: How does PHP transforms an integer on a string? like "3" onto "three"
        135622 by: Tom Rogers

redirect
        135623 by: Alex Davis
        135625 by: Greg Donald

SQL Query
        135624 by: Zydox
        135626 by: Dennis Cole

PHP ODBC Problem
        135628 by: Mike

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 ---
Joe, you might try something like this instead of a slow PHP function.  I
based it off of a user example on the PHP site.  This is tested and I use it
often for various purposes.  I think it may be ideal for you becuase it is
extremely fast.  Requires Linux though I'm certain there's an equivilant
command in Windows.

-------------------------------
$dir="/path/to/home/directory/";
$out = `find $dir -depth -type f`;
$files = explode("\n", $out);
$numfiles = count($files);

for ($i=0; $i<$numfiles; $i++)
{
 $filelist .= $files[$i]."<br>";
 if (false != ($size = @filesize($files[$i])));
 {
  $totalfilesize += $size;
 }
}

echo $numfiles." files<br>";
echo $totalfilesize." kilobytes total<br>";
echo $filelist;
--------------------------------

Let me know how that works for you.

- Kevin


----- Original Message -----
From: "joe" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 14, 2003 12:17 PM
Subject: [PHP] calculating kilobytes


> hi
> first of all i think this is a great community here :)
>
> now to the point...
> i need a script. it should work on safe mode php so it should be as simple
> as possible.
> it should calculate all the file sizes in the directory that it is in and
in
> the subdirectories also (only 1 level subdirectories). it should echo the
> total size of the uploaded files.
> then it should take the filesize and substract it from 25 megabytes. that
is
> the limit on this server. then it should echo the result (the maximum
number
> of kilobytes that can still fit on this account).
> unfortunately i have insuffitient knowlege to do it miself.
> i just want to thank anyone who can help me.
> if you want to send it to my email then its [EMAIL PROTECTED] . or you can
> just write it here.
>
> thank you :)
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--- End Message ---
--- Begin Message ---
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Saturday 15 February 2003 03:17, joe wrote:
>
> > now to the point...
> > i need a script. it should work on safe mode php so it should be as
simple
> > as possible.
> > it should calculate all the file sizes in the directory that it is in
and
> > in the subdirectories also (only 1 level subdirectories). it should echo
> > the total size of the uploaded files.
> > then it should take the filesize and substract it from 25 megabytes.
that
> > is the limit on this server. then it should echo the result (the maximum
> > number of kilobytes that can still fit on this account).
> > unfortunately i have insuffitient knowlege to do it miself.
> > i just want to thank anyone who can help me.
>
> Most of the functions that you need to accomplish this can be found in
> chapters 'Directory functions' & 'Filesystem functions'.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> We gave you an atomic bomb, what do you want, mermaids?
> -- I. I. Rabi to the Atomic Energy Commission
> */
>

i searched and i tried and i failed. most of the functions dont work in safe
mode, some didnt do what i wanted (returned the whole drive size instead of
one directroy) etc.
my head hurts already and i think i am on the verge on nervous breakdown
because i have been trying to solve this problem for days.... so could
somebody please drop me a function here?
thank you...


--- End Message ---
--- Begin Message ---
On Fri, 14 Feb 2003, joe wrote:

>i searched and i tried and i failed. most of the functions dont work in safe
>mode, some didnt do what i wanted (returned the whole drive size instead of
>one directroy) etc.
>my head hurts already and i think i am on the verge on nervous breakdown
>because i have been trying to solve this problem for days.... so could
>somebody please drop me a function here?
>thank you...

Most people who write code for other people on request are compensated in 
one form or another.  This is a listserv, I doubt anyone here will do 
your work for you for free.  This is place where people get _assistance_ 
with code they already attempted to write themselves.  If you tried and 
failed already like you say, post your broken code and people will help 
you figure out your errors.  That's pretty much how it works.

Also, what you ask may simply not be possible in safe mode, but there's no 
way to tell since you posted no code.


-- 
Greg Donald
http://destiney.com

--- End Message ---
--- Begin Message ---
"Greg Donald" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Fri, 14 Feb 2003, joe wrote:
>
> >i searched and i tried and i failed. most of the functions dont work in
safe
> >mode, some didnt do what i wanted (returned the whole drive size instead
of
> >one directroy) etc.
> >my head hurts already and i think i am on the verge on nervous breakdown
> >because i have been trying to solve this problem for days.... so could
> >somebody please drop me a function here?
> >thank you...
>
> Most people who write code for other people on request are compensated in
> one form or another.  This is a listserv, I doubt anyone here will do
> your work for you for free.  This is place where people get _assistance_
> with code they already attempted to write themselves.  If you tried and
> failed already like you say, post your broken code and people will help
> you figure out your errors.  That's pretty much how it works.
>
> Also, what you ask may simply not be possible in safe mode, but there's no
> way to tell since you posted no code.
>
>
> --
> Greg Donald
> http://destiney.com
>

whan can i say... i dont have any broken code because im missing the MAIN
ingredient. The right command. For instance i tried disk_total_space(). You
can mark the right folder in that command but somehow it STILL shows the
total size of the hard drive. seriously, i dont have 3.9 gigabytes of files
in my directory.
then i tried something like this:
$quota="100"; // max MB

function obsah($adr,&$total,&$dir,&$size){
$dp=OpenDir($adr);

 do{
   $itm=ReadDir($dp);
   if (Is_Dir("$adr/$itm")&&($itm!=".")&&($itm!="..")&&($itm!="")){
    obsah("$adr/$itm",$total,$dir,$size);
     $dir++;
 }
   elseif (($itm!=".")&&($itm!="..")&&($itm!="")){
    $size=$size+FileSize("$adr/$itm");
     $total++;
  }
 } while ($itm!=false);

CloseDir($dp);
}

obsah(".",$total,$dir,$size);
$freeA=BcDIV($size,1024*1024,2);
$freeB=$quota-$freeA;

echo "<CENTER><FONT FACE=arial SIZE=2>
Engaged place: <B>$freeA</B> MB
Free place: <B>$freeB</B> MB
<B>$total</B> files in <B>$dir</B> dirs
</FONT></CENTER>";

but OpenDir() is not allowed in safe mode so that doesnt work....
i dont know what to do anymore. just lead me to the right command please. i
dont even care if it doesnt read the subdirectories....


--- End Message ---
--- Begin Message ---
Has anyone used ACT or tried to integrate it with any other applications?  I
need some advice, please respond.


Thanks,


Leonard.

--- End Message ---
--- Begin Message ---
--- drparker <[EMAIL PROTECTED]> wrote:
> i need to escape all my apostrophes in values submitted to a mySQL
> database.

http://www.php.net/manual/en/function.addslashes.php

> is there a way i can loop thru all the post variables and replace the
> apostrophes?

Read about the magic_quotes setting in your php.ini.

Chris


--- End Message ---
--- Begin Message ---
Hi, THanks for your reply.

I search the manual and created following script.

<?
 header ("Content-type: image/gif");
 $im = imagecreate (400, 16);
 $black = imagecolorallocate ($im, 0, 0, 0);
 $white = imagecolorallocate ($im, 255, 255, 255);
 imagettftext ($im, 10, 0, 10, 20, $black, "verdana.ttf", date('| l | F | d
| Y |'));
 imagegif ($im);
 imagedestroy ($im);
?>

I got following error msg when ran it:

<br>
<b>Warning</b>:  ImageTtfText: No TTF support in this PHP build in
<b>/home/dotkard/www/current_time.php</b> on line <b>6</b><br>
<br>
<b>Warning</b>:  ImageGif: No GIF support in this PHP build in
<b>/home/dotkard/www/current_time.php</b> on line <b>7</b><br>

I checked the phpinfo but failed to find which variable I should turn on.

Alex

> Alex,
> Easy to do what you want.  Check out the "image" functions in the php
> manual.  There are some font limitations, specifically dealing with
> alternate characters, but you'll find out what works and what doesn't soon
> enough.
> Hugh
>
> ----- Original Message -----
> From: "Alex Shi" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, February 14, 2003 10:16 AM
> Subject: [PHP] text to image
>
>
> > Hello,
> >
> > I am thinking to create php script to dynamically convert a text string
to
> > image. My questions are:
> >
> > 1. with a given text string, say "hello, world", is it possible to
> > dynamically
> > convert it to an image? and what php built-in functions can be utilized?
> > 2. if I want to use true-type verdana font, can I just upload the
windows
> > font file to the web server (linux) and use php to load the font?
> >
> > Thanks in advance!
> >
> > Alex Shi
> >
> >
> >
> > --
> > ==================================================
> > Cell Phone Batteries at 30-50%+ off retail prices!
> > http://www.pocellular.com
> > ==================================================
> > TrafficBuilder Network:
> > http://www.bestadv.net/index.cfm?ref=7029
> > ==================================================
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>

--- End Message ---
--- Begin Message ---
forgot something....when try following script in another server I got
500 internal server error.

<?
  header ("Content-type: image/gif");
  $im = imagecreate (400, 16);
  $black = imagecolorallocate ($im, 0, 0, 0);
  $white = imagecolorallocate ($im, 255, 255, 255);
  imagettftext ($im, 10, 0, 10, 20, $black, "verdana.ttf", date('| l | F | d
| Y |'));
  imagegif ($im);
  imagedestroy ($im);
?>

Alex again

>
> I got following error msg when ran it:
>
> <br>
> <b>Warning</b>:  ImageTtfText: No TTF support in this PHP build in
> <b>/home/dotkard/www/current_time.php</b> on line <b>6</b><br>
> <br>
> <b>Warning</b>:  ImageGif: No GIF support in this PHP build in
> <b>/home/dotkard/www/current_time.php</b> on line <b>7</b><br>
>
> I checked the phpinfo but failed to find which variable I should turn on.
>
> Alex
>
> > Alex,
> > Easy to do what you want.  Check out the "image" functions in the php
> > manual.  There are some font limitations, specifically dealing with
> > alternate characters, but you'll find out what works and what doesn't
soon
> > enough.
> > Hugh
> >
> > ----- Original Message -----
> > From: "Alex Shi" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, February 14, 2003 10:16 AM
> > Subject: [PHP] text to image
> >
> >
> > > Hello,
> > >
> > > I am thinking to create php script to dynamically convert a text
string
> to
> > > image. My questions are:
> > >
> > > 1. with a given text string, say "hello, world", is it possible to
> > > dynamically
> > > convert it to an image? and what php built-in functions can be
utilized?
> > > 2. if I want to use true-type verdana font, can I just upload the
> windows
> > > font file to the web server (linux) and use php to load the font?
> > >
> > > Thanks in advance!
> > >
> > > Alex Shi
> > >
> > >
> > >
> > > --
> > > ==================================================
> > > Cell Phone Batteries at 30-50%+ off retail prices!
> > > http://www.pocellular.com
> > > ==================================================
> > > TrafficBuilder Network:
> > > http://www.bestadv.net/index.cfm?ref=7029
> > > ==================================================
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
>

--- End Message ---
--- Begin Message ---
On Saturday 15 February 2003 04:49, Alex Shi wrote:
> I got following error msg when ran it:
>
> <br>
> <b>Warning</b>:  ImageTtfText: No TTF support in this PHP build in
> <b>/home/dotkard/www/current_time.php</b> on line <b>6</b><br>

You need to configure/recompile php with TTF support.

> <b>Warning</b>:  ImageGif: No GIF support in this PHP build in
> <b>/home/dotkard/www/current_time.php</b> on line <b>7</b><br>

Ditto for GIF support

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
There is no sin but ignorance.
                -- Christopher Marlowe
*/

--- End Message ---
--- Begin Message ---
Alex,
You should either use png or jpg rather than gif.  The most common builds of
the gd library support those image formats--go to the GD Library site to
find out why.  The support of ttf fonts should be taken up with your host.

When testing whether the code in your image creation file works, use
something like
<a href=your_image_creation_file_name.php>say something wonderful here</a>
and any error messages will be displayed.  Once you've got it down pat, then
you can just swap out the line with an image tag, <img
src=your_image_creation_file_name.php>

$font="./fonts/verdana.ttf"; // the path to the font is needed if it isn't
in the same directory as the script
$im = imagecreate (400, 16);
$black = imagecolorallocate ($im, 0, 0, 0);
$white = imagecolorallocate ($im, 255, 255, 255);
imagettftext ($im, 10, 0, 10, 20, $black, $font, date('| l | F | d | Y |'));
header ("Content-type: image/png");  //header just before the imagepng call.
imagepng ($im);
imagedestroy ($im);

Hope this helps,
Hugh


----- Original Message -----
From: "Alex Shi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 14, 2003 1:00 PM
Subject: Re: [PHP] text to image


> forgot something....when try following script in another server I got
> 500 internal server error.
>
> <?
>   header ("Content-type: image/gif");
>   $im = imagecreate (400, 16);
>   $black = imagecolorallocate ($im, 0, 0, 0);
>   $white = imagecolorallocate ($im, 255, 255, 255);
>   imagettftext ($im, 10, 0, 10, 20, $black, "verdana.ttf", date('| l | F |
d
> | Y |'));
>   imagegif ($im);
>   imagedestroy ($im);
> ?>
>
> Alex again
>
> >
> > I got following error msg when ran it:
> >
> > <br>
> > <b>Warning</b>:  ImageTtfText: No TTF support in this PHP build in
> > <b>/home/dotkard/www/current_time.php</b> on line <b>6</b><br>
> > <br>
> > <b>Warning</b>:  ImageGif: No GIF support in this PHP build in
> > <b>/home/dotkard/www/current_time.php</b> on line <b>7</b><br>
> >
> > I checked the phpinfo but failed to find which variable I should turn
on.
> >
> > Alex
> >
> > > Alex,
> > > Easy to do what you want.  Check out the "image" functions in the php
> > > manual.  There are some font limitations, specifically dealing with
> > > alternate characters, but you'll find out what works and what doesn't
> soon
> > > enough.
> > > Hugh
> > >
> > > ----- Original Message -----
> > > From: "Alex Shi" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Friday, February 14, 2003 10:16 AM
> > > Subject: [PHP] text to image
> > >
> > >
> > > > Hello,
> > > >
> > > > I am thinking to create php script to dynamically convert a text
> string
> > to
> > > > image. My questions are:
> > > >
> > > > 1. with a given text string, say "hello, world", is it possible to
> > > > dynamically
> > > > convert it to an image? and what php built-in functions can be
> utilized?
> > > > 2. if I want to use true-type verdana font, can I just upload the
> > windows
> > > > font file to the web server (linux) and use php to load the font?
> > > >
> > > > Thanks in advance!
> > > >
> > > > Alex Shi
> > > >
> > > >
> > > >
> > > > --
> > > > ==================================================
> > > > Cell Phone Batteries at 30-50%+ off retail prices!
> > > > http://www.pocellular.com
> > > > ==================================================
> > > > TrafficBuilder Network:
> > > > http://www.bestadv.net/index.cfm?ref=7029
> > > > ==================================================
> > > >
> > > >
> > > > --
> > > > 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
>

--- End Message ---
--- Begin Message ---
I have an ecommerce app (MAS200 eBusiness Manager) that works. I am 
updating my
web site to php frames. Now when I want to connect to the eBusiness 
Manager server
I get this error:

Unsupported Browser
The browser you are using (PHP/4.2.3) is currently unsupported. Please 
update your browser to the most current level.
This happens regardless of the browser I am using. How can I get this to 
send the actual browser info, not this php info in its place?
--
Chip Wiegand
Computer Services
Simrad, Inc
www.simradusa.com
[EMAIL PROTECTED]

"There is no reason anyone would want a computer in their home."
     --Ken Olson, president, chairman and founder of Digital Equipment 
Corporation, 1977
 (Then why do I have 8? Somebody help me!)
--- End Message ---
--- Begin Message ---
--- [EMAIL PROTECTED] wrote:
> I have an ecommerce app (MAS200 eBusiness Manager) that works. I am 
> updating my web site to php frames.

There is no such thing. Perhaps you mean HTML frames?

> Now when I want to connect to the eBusiness Manager server I get this error:
> 
> Unsupported Browser
> The browser you are using (PHP/4.2.3) is currently unsupported. Please 
> update your browser to the most current level.

So, eBusiness Manager is lame. Thanks for the tip. :-)

> This happens regardless of the browser I am using. How can I get this to 
> send the actual browser info, not this php info in its place?

What are you talking about? What is PHP info? The "error" message? Whatever
eBusiness Manager is apparently checks what browser you are using and does not
operate unless it approves of your choice. This is an indication of pitiful
software design, but I don't see how this relates to PHP nor what question you
are attempting to ask.

Chris
--- End Message ---
--- Begin Message ---
On Saturday 15 February 2003 05:01, [EMAIL PROTECTED] wrote:
> I have an ecommerce app (MAS200 eBusiness Manager) that works. I am
> updating my
> web site to php frames. Now when I want to connect to the eBusiness
> Manager server

Presumably you mean connect to that app with some php code?

> I get this error:
>
> Unsupported Browser
> The browser you are using (PHP/4.2.3) is currently unsupported. Please
> update your browser to the most current level.


> This happens regardless of the browser I am using. How can I get this to
> send the actual browser info, not this php info in its place?

The error comes from some php code accessing that app and has nothing to do 
with whatever browser you're using.


Find out what browsers that app is satisfied with, then set 'user_agent' in 
php.ini to match that of one of the compatible browsers.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
The Usenet news is out of date
*/

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

Slight problem, I have about 200 pages of HTML stored in a mysqlDB.  I had
to manually edit some information on EVERY single page.  I used MySQL-Front
and edited these pages.  All of the tags were correct <img> and <font> I
have run into a problem now, that every page I have edited has somehow
corrupted most/all of the <font> and <img> tags.  so they look like  this

<font
      face="ARIAL, HELVETICA">

Now when the page is read it actually prints out "<font  face="ARIAL,
HELVETICA">" instead of changing the font or showing the IMAGE.  The font I
am not so much worried about it is the image that is not showing up and the
there are too many pages to go through manually.

Can someone help me with a PHP script to go through the db and replace the
\n\r ?


Thank you,


-----------------------------------------------------------
        ---------                Daniel Negron

      //         \\            *****************
     /  _  __ ___  \    Lotus Notes Admin / Developer
    |  | |/ /| _ )  |   KB Electronic, Inc.
    |  | ' < | _ \  |   12095 NW 39th Street
    |  |_|\ \|___/  |   Coral Springs, FL. 33065
     \     \_\     /    954.346.4900 x 122
      \\         //     email: [EMAIL PROTECTED]

        ---------       http://www.kbelectronics.com
-----------------------------------------------------------


--- End Message ---
--- Begin Message ---
At 23:12 14.02.2003, Daniel Negron/KBE said:
--------------------[snip]--------------------
>have run into a problem now, that every page I have edited has somehow
>corrupted most/all of the <font> and <img> tags.  so they look like  this
>
><font
>      face="ARIAL, HELVETICA">
>
>Now when the page is read it actually prints out "<font  face="ARIAL,
>HELVETICA">" instead of changing the font or showing the IMAGE.  The font I
--------------------[snip]-------------------- 

There must be a different problem since the tag is perfectly valid, even
with the spaces/newlines you are showing. If it prints our the HTML tags
have a look at the source if they didn't get encoded somehow (like &lt;font
face=&quot;ARIAL&quot;&gt;)


-- 
   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035
    ^     http://www.vogelsinger.at/


--- End Message ---
--- Begin Message ---
I'm unable to append using imap_append. I can access the account without a problem but 
the append fails. Any ideas?

 

<?php

$mailserver = "supercalendar.com";

$port = 120;

 

if ($stream = imap_open("{".$mailserver."/pop3:$port/notls}",$login,$password)):

            if (imap_append($stream,"{".$mailserver."}INBOX","From: [EMAIL PROTECTED]\r\nTo: 
[EMAIL PROTECTED]\r\nSubject: test\r\n\r\nthis is a test message, please ignore\r\n")):

                        echo "good";

            else:

                        echo "bad";

            endif;                       

            imap_close($stream);

else:

            echo "Unable to open mailbox";

endif;    

?>



---------------------------------
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
--- End Message ---
--- Begin Message ---
Hi List.

I have been working on a problem that is driving me crazy.

I have to create a process in which I upload some info to a table. Since I
have to add some different information to that table, I decided to do it
like this.

1.I create a temporary table copying the structure of my final table. I.E.
$query_temp_table="CREATE TEMPORARY TABLE tguias SELECT * FROM guias WHERE
1=0";
$temp_table=mysql_query($query_temp_table, $cosmo_logistic) or
die(mysql_error());
I do this in PHP.
It works fine It seems.
2. I populate the temporary table.
$query_populate_tguias="LOAD DATA LOCAL INFILE
'c:/cosmo/www/upload/guias.txt' INTO TABLE tguias FIELDS TERMINATED BY ','
ENCLOSED BY '\"'
(cliente,asesora,extra1,peso,albaran,gerente,tipo,imprimir)";
$populate_tguias=mysql_query($query_populate_tguias, $cosmo_logistic) or
die(mysql_error());
3. Then I pass the information along with some other variables to the real
table.
mysql_select_db($database_cosmo_logistic, $cosmo_logistic);
$query_poblar = "SELECT * FROM tguias";
$poblar = mysql_query($query_poblar, $cosmo_logistic) or die(mysql_error());
$row_poblar= mysql_fetch_assoc($poblar);
$totalRows_poblar= mysql_num_rows($poblar);
   do { 
        mysql_select_db($database_cosmo_logistic, $cosmo_logistic);
        $query_poblar_guias="INSERT INTO guias
(cliente,asesora,peso,albaran,gerente,tipo,imprimir,manifiesto,Status)
VALUES
(\"".$row_poblar['cliente']."\",\"".$row_poblar['asesora']."\",".$row_poblar
['peso'].",\"".$row_poblar['albaran']."\",\"".$row_poblar['gerente']."\",\""
.$row_poblar['tipo']."\",".$row_poblar['imprimir'].",\"".$manifiesto."\",\"A
\")";
        $poblar_guias=mysql_query($query_poblar_guias, $cosmo_logistic) or
die("No pude insertar el registro ".mysql_error());
        } while ($row_poblar=mysql_fetch_assoc($poblar));?>

with this source file:
"13DAN010","D79406","13DAN010", 1 ,"20430002201","75301;753","PAQUETE","1"
"13DAN010","D55816","13DAN010", 1.32
,"20430003101","100201;1002","PAQUETE","1"

it Does not work at all. I wonder if it is because it has a . in the number
even as the field receiving it is a decimal(10,2) or if it is because in one
of the field I have ;. 

The thing is that it will import one, and skip one full record each time.
But the one it inserts, is correctly inserted with the ; and the decimal
point correct. Any idea why it might be pasing one row and adding one?

This is driving me crazy.

When I do this same procedure on another table with source code like: 
"D79427","LOPEZ DURAN ELISA","ACUEDUCTO TARRAGONA 59","15","PASEOS DEL
BOSQUE","NAUCALPAN","53297"," ","LOPEZ DURAN ELISA","",F,T

it Works correctly even as it has two false or true fields.






--- End Message ---
--- Begin Message ---
I have a function below which populates a select list, based on the query
string and the field name. It then prints a string:

function populate_selects($query_name, $db_field, $link, $string)
{
$result = mysql_query($query_name, $link) or die ("Could not execute
query.");
while ($columns = mysql_fetch_array($result))
{
$column = $columns[$db_field];
global $option_block;
$option_block .= "<OPTION name='vendor1'
value=\"$column\">$column</OPTION>\n";
}
print $string;
}

Part of the string that is printed in $string is the $option_block which is
in the function. There seems to be some problem with scope here. I made the
$option_block variable global but it still won't print. I have tested that
the $column field is being populated and it is, so I believe that it must be
the $option_block part that isn't working. Does anyone have any suggestions?

Peter Gumbrell
[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
Exactly where does $option_block get put into $string?
-Kevin

----- Original Message -----
From: "Peter Gumbrell" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Friday, February 14, 2003 4:11 PM
Subject: [PHP] function problem


> I have a function below which populates a select list, based on the query
> string and the field name. It then prints a string:
>
> function populate_selects($query_name, $db_field, $link, $string)
> {
> $result = mysql_query($query_name, $link) or die ("Could not execute
> query.");
> while ($columns = mysql_fetch_array($result))
> {
> $column = $columns[$db_field];
> global $option_block;
> $option_block .= "<OPTION name='vendor1'
> value=\"$column\">$column</OPTION>\n";
> }
> print $string;
> }
>
> Part of the string that is printed in $string is the $option_block which
is
> in the function. There seems to be some problem with scope here. I made
the
> $option_block variable global but it still won't print. I have tested that
> the $column field is being populated and it is, so I believe that it must
be
> the $option_block part that isn't working. Does anyone have any
suggestions?
>
> Peter Gumbrell
> [EMAIL PROTECTED]
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--- End Message ---
--- Begin Message ---
Here is the string that is being used in this function example. Everything
print except the option_block

// Vendor string
$vendor_string .= <<<EOVS
$header_string
<tr>
<td colspan="4"><br>
<br>
<form method="POST" name="insert_url" action="week6.php?view=vendorq">
Select the vendor of your choice: <SELECT NAME="vendor2">
$option_block;
</SELECT>
 <input type="hidden" name="vendor_select" value="v">

<INPUT TYPE="Submit" NAME="Submit" Value="Submit">

</FORM>
EOVS;

-----Original Message-----
From: Kevin Stone [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 14, 2003 6:41 PM
To: Php-General
Subject: Re: [PHP] function problem


Exactly where does $option_block get put into $string?
-Kevin

----- Original Message -----
From: "Peter Gumbrell" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Friday, February 14, 2003 4:11 PM
Subject: [PHP] function problem


> I have a function below which populates a select list, based on the query
> string and the field name. It then prints a string:
>
> function populate_selects($query_name, $db_field, $link, $string)
> {
> $result = mysql_query($query_name, $link) or die ("Could not execute
> query.");
> while ($columns = mysql_fetch_array($result))
> {
> $column = $columns[$db_field];
> global $option_block;
> $option_block .= "<OPTION name='vendor1'
> value=\"$column\">$column</OPTION>\n";
> }
> print $string;
> }
>
> Part of the string that is printed in $string is the $option_block which
is
> in the function. There seems to be some problem with scope here. I made
the
> $option_block variable global but it still won't print. I have tested that
> the $column field is being populated and it is, so I believe that it must
be
> the $option_block part that isn't working. Does anyone have any
suggestions?
>
> Peter Gumbrell
> [EMAIL PROTECTED]
>
>
>
> --
> 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



--- End Message ---
--- Begin Message ---
On 2003.02.15 00:11 Peter Gumbrell wrote:
[...]
$option_block .= "<OPTION name='vendor1'
[...]

Are you sure it's a scope problem ?
You haven't instantiated any $option_block variable when the loop starts, so you're concatenating a string to a bunch of uninitialized memory :)
I can't run your script at the moment, so it's just a supposition...

Hope it helps,
Nicholas
--- End Message ---
--- Begin Message ---
I am trying to figure out the whole XML/XSL thing and am experimenting with 
the Gentoo docs which have a simple XSL sheet. I downloaded the XML, XSL 
and DTD, and ran the files through the Sablotron module in php using:

$xp = xslt_create();
   xslt_set_base($xp, 'file://c:/shared/mywebs/beta/test/');
   $result = xslt_process($xp, 'rsync.xml', 'guide.xsl');
   echo $result;
   xslt_free($xp);

Everything worked like a champ except for one strange little problem: the 
XSL stylsheet defines anchors and links in a drop-down menu for each 
"chapter", sequentially... (as you can see here: 
http://www.gentoo.org/doc/en/rsync.xml) but in the PHP transformation with 
the local files, all of the chapter numbers and the numbers in the drop 
down are "1"! 

The guide.xsl I am using is online at: http://www.gentoo.org/xsl/guide.xsl 
and I am using a current rsync.xml from the CVS repository, so it has to be 
something in the local transformation with PHP.
--- End Message ---
--- Begin Message ---
Hello,

I'm looking for a way to do something, not sure if someone can help me.

I would like to be able to "control", in a way, what a remote user is
seeing, almost like running a slideshow.

For example, user goes to website, it shows block of text or picture. I
login to admin area.I click "next" or something, and it either advances to
another page, or to another picture, and so on.

I know you can kind of do a live output using flush, but what about
forcing it to another page?

Any ideas would be great!

Thanks,

        Bryan

--- End Message ---
--- Begin Message ---
Hello,

On 02/14/2003 01:56 PM, Mark McCulligh wrote:
If I send a HTML email using either mail() or pear mail to an email account
of someone who is on my email server it does not get delivered right.  But
if I send a HTML email to an external email address it is fine. It also
works fine with plain text email, only if you send a HTML format email.

I have even setup pear mail not to use the mail function but link right to
qmail's bin folder.
I can also send HTML between users in HTML using Outlook fine, only if PHP
sends do I have problem.

I am using PHP 4.3.0 and qmail as my email server.

Has anyone any idea of were to start looking for why this is happening.
Again this only happen if it is a HTML format email and it is to an internal
user, thus my email server routes it without leaving the server.
Never send HTML only messages. It is possible that there maybe a spam filter in your server blocking HTML only messages.

In the worst case, always try to send a message with a plain text and a HTML alternative parts. You may want to try this class to learn how to do it right. This class also works around some bugs of mail() function. There is also a subclass for delivery with qmail-inject program:

http://www.phpclasses.org/mimemessage

--

Regards,
Manuel Lemos

--- End Message ---
--- Begin Message ---
I am sending both text and HTML. The message I get looks like this:

boundary="=_ec9ac598a5bbb069fd9a696b254780ef"

--=_ec9ac598a5bbb069fd9a696b254780ef
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit

TEST MESSAGE WAS HERE

--=_ec9ac598a5bbb069fd9a696b254780ef
Content-Type: multipart/related;
boundary="=_74b5fb5ddc651b2065ec31d700d8d15c"

--=_74b5fb5ddc651b2065ec31d700d8d15c
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<title>???</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
</head>
<body>
etc....

As you can see both are being displayed including some of the header info.
Any idea of how this happened.

Mark.

"Manuel Lemos" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> On 02/14/2003 01:56 PM, Mark McCulligh wrote:
> > If I send a HTML email using either mail() or pear mail to an email
account
> > of someone who is on my email server it does not get delivered right.
But
> > if I send a HTML email to an external email address it is fine. It also
> > works fine with plain text email, only if you send a HTML format email.
> >
> > I have even setup pear mail not to use the mail function but link right
to
> > qmail's bin folder.
> > I can also send HTML between users in HTML using Outlook fine, only if
PHP
> > sends do I have problem.
> >
> > I am using PHP 4.3.0 and qmail as my email server.
> >
> > Has anyone any idea of were to start looking for why this is happening.
> > Again this only happen if it is a HTML format email and it is to an
internal
> > user, thus my email server routes it without leaving the server.
>
> Never send HTML only messages. It is possible that there maybe a spam
> filter in your server blocking HTML only messages.
>
> In the worst case, always try to send a message with a plain text and a
> HTML alternative parts. You may want to try this class to learn how to
> do it right. This class also works around some bugs of mail() function.
> There is also a subclass for delivery with qmail-inject program:
>
> http://www.phpclasses.org/mimemessage
>
> --
>
> Regards,
> Manuel Lemos
>


--- End Message ---
--- Begin Message ---
Ok ... here is the sitituation... I am creating a registration form.
What I have so far works ... the user registers using this form and the
form calls another page that will check the validity of the data
(checking for username availability, etc...). If there is an error,
display the error and have the user GO BACK AND TRY AGAIN <----- This is
the problem I want to fix.

What I want to do is have the registration form, on submit, check the
data validity right then, if there is an error, redisplay the form with
an * next to the field that is incorrect. This way the user does not
have to go back and try again, it will be there in front of them.

Basically, have the form action call itself .... hince the recursion.

Any suggestion/examples?

Thanks,

-Alex


--- End Message ---
--- Begin Message ---
not tested 
> Basically, have the form action call itself .... hince the recursion.
> Any suggestion/examples?
<?
$field1=false;
if(isset($_POST['submit']))
{
/*check*/
if(isset($_POST['field1']) && $_POST['field1']=='okay')header('Location:  
registration.php');
else $field1=true;
}
?>
<form action=<?=$SERVER['PHP_SELF']?> method="POST">
<input type="text"  name="field1" 
value="<?=isset($_POST['field1'])?$_POST['field1']:''?>"><?=$field1?'*':''?>
<input type="submit"  name="submit" value="GO">
</form>
--- End Message ---
--- Begin Message ---
 > What I want to do is have the registration form, on submit, check the
 > data validity right then, if there is an error, redisplay
 > the form with an * next to the field that is incorrect.

This is the code logic rather than the actual working code:

---Start of PHP Page---
1. Check for form having been submitted
 a. If form submitted, check values that have been input
  i.  If valid form input, redirect to another page (or process form
data)
  ii. If not valid form input, set a 'problem flag' for each broken bit
 b. Do any other form input data manipulation that you need (strip html
or whatever)

2. Display form
 a. Do a check to see if there was a 'problem flag' set for a field - if
so display '*'
 b. If you've done it right, the post data can be reloaded into the form
---End of PHP Page---

That's the basic idea anyway - essentially, you process your form input
data at the start of the page and act on what you find.  If you want to
avoid problems with browser reloads doing another submit then it's
probably worth redirecting a successful form submit to a new page.

CYA, Dave




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

Friday, February 14, 2003, 10:10:55 AM, you wrote:
F> Does PHP transforms an integer on a string?
F> Like: "78" onto "seventy eight"
F> How does it do it?


Here is a class I started to do that kind of transform

class num_to_text {
        var $mode;      //NUMERIC CURRENCY
        var $words = array(
                                        
0=>array('zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'),
                                        
1=>array('zero','one','twenty','thirty','fourty','fifty','sixty','seventy','eighty','ninety'),
          2=>array('thousand','million')
                                );
        var $money = array(
                                        0=>array('Dollar','Dollars'),
          1=>array('Cent','Cents')
                                );
        function num_class($mode = 'NUMERIC'){
                $this->mode = $mode;
        }
        function convert($num){
                return $this->num($num,1);
        }
        function num($num,$key = 0){
                static $t;
                static $call;
                $res = intval($num/100);
                $left = $num%100;
                if($key == 1){ //first non recursive call reset text and 
thousand/million toggle
                        $t = "";
                        $call = 0;
                }
                else{
                        // do we need to print thousand as this is a recursive call
                        if($num%1000 > 0)$t = ' '.$this->words[2][$call].' '.$t;
                        $call ^= 1;     //toggle call for next recursion
                }
                if($left <= 20){ // no need to split it
                        if($left == 0){ // is the whole mess just zero
                                if($res == 0) $t = $this->words[0][$left].$t;
                        }
                        else{
                                $t = $this->words[0][$left].$t;
                        }
                }
                else{ //need to split it up
                        $tens = intval($left/10);
                        $units = $left%10;
                        ($units > 0)? $units = ' '.$this->words[0][$units] : $units = 
''; //eg thirty or thirty one
                        $t = $this->words[1][$tens].$units.$t;
                }
                if($res < 10){
                        if($res > 0){
                                ($left == 0)? $and = '':$and = ' and '; // do we need 
to print 'and'
                                if($res > 0) $t = $this->words[0][$res]. " 
hundred".$and.$t;
                        }
                }
                else{
                        $res = $res%10;
                        if($res > 0){
                                ($left == 0)? $and = '':$and = ' and ';
                                $t = $this->words[0][$res]. " hundred".$and.$t;
                        }
                        else{
                                if($left > 0)$t = ' and '.$t;
                        }
                        $num = intval($num/1000);
                        $this->num($num);
                }
                return $t;
        }
}

//usage

$n2t = new num_to_text();
for($num = 0;$num < 11;$num++){
        echo $num.' '.$n2t->convert($num).'<br>';
}




-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
What is the syntax to have php redirect to another web site?

--- End Message ---
--- Begin Message ---
> What is the syntax to have php redirect to another web site?


<?php
header("Location: http://domain.com/";);
?>


--
Greg Donald
http://destiney.com/


--- End Message ---
--- Begin Message ---
I have a problem writing a query that can select a Interest for a specific
user... There are tvo tables, IList and IIndex...
IList contains this :
      ID  SubID  Interest  Valid
      Edit  Delete  1 0 Datorer 0
      Edit  Delete  2 1 Spel 0
      Edit  Delete  3 2 Strategi 0
      Edit  Delete  4 3 Star Craft 1
      Edit  Delete  5 3 Star Wars: Gallactic Battelinggrounds 1
      Edit  Delete  6 2 Shoot-Em-Up 0
      Edit  Delete  7 6 Half-Life 0
      Edit  Delete  8 7 Team Fortress 1
      Edit  Delete  9 7 Counter-Strike 1


And IIndex contains a UserID And InterestID... this query :
"SELECT DISTINCTROW InterestsList.ID, InterestsList.SubID,
InterestsList.Interest, InterestsList.Valid FROM InterestsList AS II RIGHT
JOIN InterestsList ON InterestsList.ID=II.SubID LEFT JOIN InterestsIndex ON
InterestsList.ID=InterestsIndex.InterestID AND InterestsIndex.UserID='1'"

Selects all rows from IList... even if there Is'nt any instans in IIndex...
this thougt is that a User can choose a "Valid" Interest and then the query
should select all SubInterests... anyone know how to do that ?

// Regards Zydox


--- End Message ---
--- Begin Message ---
There is a nice piece of software that you should get,
http://ems-hitech.com/mymanager/! It's not free, but you can download a
trial. (I would get it) It is great for building querys across tables.

-----Original Message-----
From: Zydox [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 14, 2003 11:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] SQL Query


I have a problem writing a query that can select a Interest for a specific
user... There are tvo tables, IList and IIndex...
IList contains this :
      ID  SubID  Interest  Valid
      Edit  Delete  1 0 Datorer 0
      Edit  Delete  2 1 Spel 0
      Edit  Delete  3 2 Strategi 0
      Edit  Delete  4 3 Star Craft 1
      Edit  Delete  5 3 Star Wars: Gallactic Battelinggrounds 1
      Edit  Delete  6 2 Shoot-Em-Up 0
      Edit  Delete  7 6 Half-Life 0
      Edit  Delete  8 7 Team Fortress 1
      Edit  Delete  9 7 Counter-Strike 1


And IIndex contains a UserID And InterestID... this query :
"SELECT DISTINCTROW InterestsList.ID, InterestsList.SubID,
InterestsList.Interest, InterestsList.Valid FROM InterestsList AS II RIGHT
JOIN InterestsList ON InterestsList.ID=II.SubID LEFT JOIN InterestsIndex ON
InterestsList.ID=InterestsIndex.InterestID AND InterestsIndex.UserID='1'"

Selects all rows from IList... even if there Is'nt any instans in IIndex...
this thougt is that a User can choose a "Valid" Interest and then the query
should select all SubInterests... anyone know how to do that ?

// Regards Zydox



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

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

I've installed PHP 4.3.0 on a Win2k (SP3) IIS 5 server, as we were moving
the site to another server (old server was also win2k, php 4.3.0), and ODBC
calls no longer function correctly when served from the webserver, however
they work perfectly when called from the command line.

So http://site/odbc_test.php hanged, while 'php odbc_test.php' in cmd.exe
worked perfectly. The ODBC drivers and settings are the same as what was on
the previous server.

Tracked down the problem to the ODBC_Connect line. If I specified an invalid
DSN, e.g. odbc_connect("wrong", "","") or die (....); the script would
terminate with the correct error message. However, if I specified a valid
DSN then PHP would simply hang. No error message. Nothing in the Event
Viewier.

At first I was using the ISAPI version of PHP for IIS, but then after I saw
ODBC work using PHP from the command line, I changed IIS over to use
php.exe, but with no success.

Any ideas?

Oh, and I did end up setting the security permissions for the ODBC database
directory to give System & Everyone & IUSER_ full access.

Mike C.

--- End Message ---

Reply via email to