php-general Digest 17 Feb 2001 22:45:27 -0000 Issue 518

Topics (messages 40312 through 40380):

How to get new row on top?
        40312 by: Jan Grafström
        40313 by: Mukul Sabharwal
        40317 by: Mukul Sabharwal
        40320 by: Jan Grafström

Stylesheets
        40314 by: Michael Hall
        40316 by: PHPBeginner.com
        40318 by: PHPBeginner.com
        40331 by: Christian Reiniger

Re: Can I select only the newest record?
        40315 by: PHPBeginner.com
        40328 by: Christian Reiniger

Measuring php on old and new server
        40319 by: Cybercandy Ltd

hmm
        40321 by: Brandon Feldhahn

PHPLIB-7.2 & sessions
        40322 by: kaab kaoutar

Re: Dir?  Can I get a dir listing of the current dir my php file is in?
        40323 by: Ifrim Sorin
        40369 by: Joe Sheble (Wizaerd)

Sessions
        40324 by: kaab kaoutar

Removing Whitespace
        40325 by: Website4S.aol.com
        40326 by: Website4S.aol.com
        40360 by: Christian Reiniger

Re: Finding the? in $REQUEST_URI?page=blah
        40327 by: Christian Reiniger

Re: search
        40329 by: Christian Reiniger

Re: more on trimming
        40330 by: Christian Reiniger

Apache on Linux vs. IIS on W2K
        40332 by: SED
        40345 by: Alexander Wagner

Creative solution with XML,PHP,MYSQL
        40333 by: Siim Einfeldt aka Itpunk
        40334 by: Peter Skipworth
        40335 by: Siim Einfeldt aka Itpunk
        40336 by: Brian V Bonini
        40340 by: Artem Koutchine
        40341 by: Artem Koutchine
        40342 by: Siim Einfeldt aka Itpunk

Sessions again :(
        40337 by: John Vanderbeck
        40339 by: PHPBeginner.com

REGEX prob
        40338 by: n e t b r a i n
        40361 by: Christian Reiniger

quick file question
        40343 by: PeterOblivion.aol.com
        40344 by: Alexander Wagner

.php3 in PHP4?
        40346 by: Jeff Gannaway
        40348 by: Ifrim Sorin

Re: Quick hellp, How do I stip new lines?
        40347 by: Toby Butzon

Determingin if cookies are useable?
        40349 by: John Vanderbeck
        40354 by: Chris Lee
        40355 by: Jeff Gannaway
        40358 by: John Vanderbeck

PHP Manuals - Was ->  [PHP] Apache on Linux vs. IIS on W2K
        40350 by: SED
        40351 by: Alexander Wagner

checking image extensions
        40352 by: Alvin Tan
        40353 by: John Vanderbeck

Re: [S.O.S.] round() problem
        40356 by: Robert Covell

Multiple Selection.
        40357 by: BeeBoo

dbase function howtos/faq
        40359 by: Robert L. Yelvington

Re: Database Code Portability
        40362 by: Andrew Hill

Re: PHP Editors
        40363 by: andrew

Strip HTML codes from a string?
        40364 by: John Vanderbeck
        40365 by: John Vanderbeck

Re: MySQL: Add Autoincrement Field?
        40366 by: Jeff Oien

Count of multi-dimensional array
        40367 by: bill
        40368 by: Rasmus Lerdorf

Apache config
        40370 by: Sitkei es Tarsa Bt

PHP Session question
        40371 by: Yev

Re: PHP Book Recommendations
        40372 by: Boaz Yahav

Simple REGEX?
        40373 by: James, Yz

php
        40374 by: Brandon Feldhahn
        40376 by: John Vanderbeck

Text box
        40375 by: Todd Cary

php flash and textfile in chatapp.
        40377 by: Jan Grafström

Bug? - pg_pconnect failing with pgsql and pg_connect is ok.
        40378 by: Matt Friedman

domains
        40379 by: Brandon Feldhahn

compare arrays problem
        40380 by: Onaje Johnston

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]


----------------------------------------------------------------------


Hi!
I have this code:
$message = ereg_replace("\r\n\r\n", "\n<P>", $message);
And the new rows are placed under the old ones.
I want to change so the old messages get placed under is that possible?
Thanks for help.
Jan





I'm not quite sure what that code has to do with
anything, but anyway,

incase you're using files,

you can open the file with the 'a' flag, using fseek
goto 0byteth, and append from there.

$fp = fopen('file', 'a');
fseek($fp, 0);
fwrite... or whatever here.


--- Jan Grafström <[EMAIL PROTECTED]> wrote: > Hi!
> I have this code:
> $message = ereg_replace("\r\n\r\n", "\n<P>",
> $message);
> And the new rows are placed under the old ones.
> I want to change so the old messages get placed
> under is that possible?
> Thanks for help.
> Jan
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> 


=====
To find out more about me : http://www.geocities.com/mimodit
My bookmarks are available @ http://mukul.free.fr

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/




if ($message) 
    { 
    /* uncomment the next two lines to strip out html
from input */ 
    /* $name = strip_tags($name); */ 
    /* $message = strip_tags($message); */ 
    $message = ereg_replace("\r\n\r\n", "\n<P>",
$message); 
    $date = date("l, F j Y, h:i a"); 
    $message = "<B>$name </B> -- $date<P> $message
<BR><HR>"; 
    $fp = fopen (basename($PHP_SELF) . ".comment",
"a");
    fseek($fp, 0); // works both with php4.0.1pl1 <, >
    fwrite ($fp, $message); 
    fclose ($fp); 
    } 
@readfile(basename(($PHP_SELF . ".comment"))); 



--- Jan Grafström <[EMAIL PROTECTED]> wrote: > 
> Thank You for the answer.
> 
> Here is my file:
> 
> if ($message) 
>     { 
>     /* uncomment the next two lines to strip out
> html from input */ 
>     /* $name = strip_tags($name); */ 
>     /* $message = strip_tags($message); */ 
>     $message = ereg_replace("\r\n\r\n", "\n<P>",
> $message); 
>     $date = date("l, F j Y, h:i a"); 
>     $message = "<B>$name </B> -- $date<P> $message
> <BR><HR>"; 
>     $fp = fopen (basename($PHP_SELF) . ".comment",
> "a"); 
>     fwrite ($fp, $message); 
>     fclose ($fp); 
>     } 
> @readfile(basename(($PHP_SELF . ".comment"))); 
> -----
> And here is a html form  placed.
> -----
> When I submit the form I can se the result on the
> top of the same page with newest message at the
> bottom.
> 
> I you know how to get latest message at the toprow I
> am greatful for an answer.
> 
> Regards 
> Jan
> 
> 2001-02-16 18:38:36, Mukul Sabharwal
> <[EMAIL PROTECTED]> wrote:
> 
> >I'm not quite sure what that code has to do with
> >anything, but anyway,
> >
> >incase you're using files,
> >
> >you can open the file with the 'a' flag, using
> fseek
> >goto 0byteth, and append from there.
> >
> >$fp = fopen('file', 'a');
> >fseek($fp, 0);
> >fwrite... or whatever here.
> >
> >
> >--- Jan Grafström <[EMAIL PROTECTED]> wrote: >
> Hi!
> >> I have this code:
> >> $message = ereg_replace("\r\n\r\n", "\n<P>",
> >> $message);
> >> And the new rows are placed under the old ones.
> >> I want to change so the old messages get placed
> >> under is that possible?
> >> Thanks for help.
> >> Jan
> >> 
> >> 
> >> -- 
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, e-mail:
> >> [EMAIL PROTECTED]
> >> For additional commands, e-mail:
> >> [EMAIL PROTECTED]
> >> To contact the list administrators, e-mail:
> >> [EMAIL PROTECTED]
> >> 
> >
> >
> >=====
> >To find out more about me :
> http://www.geocities.com/mimodit
> >My bookmarks are available @ http://mukul.free.fr
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Get personalized email addresses from Yahoo! Mail -
> only $35 
> >a year!  http://personal.mail.yahoo.com/
> >
> >
> 
> Jan Grafström
> Lillemans Hus AB
> Sweden
> +46 (0)611 60920
> +46 (0)70 6409073 
> 
> 


=====
To find out more about me : http://www.geocities.com/mimodit
My bookmarks are available @ http://mukul.free.fr

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/




Hi Mukul!
Thanks for the answers.
My server has php4.04 and there is no difference after I put in fseek.
The output in the .comment-file i still sorted with latest message at the
end.
Regards
Jan
Mukul Sabharwal wrote:

> if ($message)
>     {
>     /* uncomment the next two lines to strip out html
> from input */
>     /* $name = strip_tags($name); */
>     /* $message = strip_tags($message); */
>     $message = ereg_replace("\r\n\r\n", "\n<P>",
> $message);
>     $date = date("l, F j Y, h:i a");
>     $message = "<B>$name </B> -- $date<P> $message
> <BR><HR>";
>     $fp = fopen (basename($PHP_SELF) . ".comment",
> "a");
>     fseek($fp, 0); // works both with php4.0.1pl1 <, >
>     fwrite ($fp, $message);
>     fclose ($fp);
>     }
> @readfile(basename(($PHP_SELF . ".comment")));
>
> --- Jan Grafström <[EMAIL PROTECTED]> wrote: >
> > Thank You for the answer.
> >
> > Here is my file:
> >
> > if ($message)
> >     {
> >     /* uncomment the next two lines to strip out
> > html from input */
> >     /* $name = strip_tags($name); */
> >     /* $message = strip_tags($message); */
> >     $message = ereg_replace("\r\n\r\n", "\n<P>",
> > $message);
> >     $date = date("l, F j Y, h:i a");
> >     $message = "<B>$name </B> -- $date<P> $message
> > <BR><HR>";
> >     $fp = fopen (basename($PHP_SELF) . ".comment",
> > "a");
> >     fwrite ($fp, $message);
> >     fclose ($fp);
> >     }
> > @readfile(basename(($PHP_SELF . ".comment")));
> > -----
> > And here is a html form  placed.
> > -----
> > When I submit the form I can se the result on the
> > top of the same page with newest message at the
> > bottom.
> >
> > I you know how to get latest message at the toprow I
> > am greatful for an answer.
> >
> > Regards
> > Jan
> >
> > 2001-02-16 18:38:36, Mukul Sabharwal
> > <[EMAIL PROTECTED]> wrote:
> >
> > >I'm not quite sure what that code has to do with
> > >anything, but anyway,
> > >
> > >incase you're using files,
> > >
> > >you can open the file with the 'a' flag, using
> > fseek
> > >goto 0byteth, and append from there.
> > >
> > >$fp = fopen('file', 'a');
> > >fseek($fp, 0);
> > >fwrite... or whatever here.
> > >
> > >
> > >--- Jan Grafström <[EMAIL PROTECTED]> wrote: >
> > Hi!
> > >> I have this code:
> > >> $message = ereg_replace("\r\n\r\n", "\n<P>",
> > >> $message);
> > >> And the new rows are placed under the old ones.
> > >> I want to change so the old messages get placed
> > >> under is that possible?
> > >> Thanks for help.
> > >> Jan
> > >>
> > >>
> > >> --
> > >> PHP General Mailing List (http://www.php.net/)
> > >> To unsubscribe, e-mail:
> > >> [EMAIL PROTECTED]
> > >> For additional commands, e-mail:
> > >> [EMAIL PROTECTED]
> > >> To contact the list administrators, e-mail:
> > >> [EMAIL PROTECTED]
> > >>
> > >
> > >
> > >=====
> > >To find out more about me :
> > http://www.geocities.com/mimodit
> > >My bookmarks are available @ http://mukul.free.fr
> > >
> > >__________________________________________________
> > >Do You Yahoo!?
> > >Get personalized email addresses from Yahoo! Mail -
> > only $35
> > >a year!  http://personal.mail.yahoo.com/
> > >
> > >
> >
> > Jan Grafström
> > Lillemans Hus AB
> > Sweden
> > +46 (0)611 60920
> > +46 (0)70 6409073
> >
> >
>
> =====
> To find out more about me : http://www.geocities.com/mimodit
> My bookmarks are available @ http://mukul.free.fr
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year!  http://personal.mail.yahoo.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]





I'm building a PHP application which uses stylesheets. Stylesheets seem to
be broken in a big way on my system - using Netscape 4 something on Red
Hat 6.1.
Is this Netscape or somehow something to do with PHP? Things work as
they're supposed to viewing the pages on a Windows/IE box.

Mick





YES! YES! IT'S PHP!!!

</kidding>

Michael, PHP just writes for you some text based on certain conditions and
the data from db or whatever ...
That text can be used for anything like HTML, JavaScript, sending emails or
even write a whole C software (with an fopen of course... is that possible?
I think it could be)

Anyway my point is that the code is the same for you css. Whether Netscape
on RH6 reads it or not is not a PHP business... It just sent a code and that
is it.

Do what: make a function to detect the browser. Define which CSS are the
best for each.

and then:

$css = get_browser();
include("$css.css")

Having a whole bunch of different css files, including only the perfect
ones.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Michael Hall [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 17, 2001 6:26 PM
To: PHP List
Subject: [PHP] Stylesheets


I'm building a PHP application which uses stylesheets. Stylesheets seem to
be broken in a big way on my system - using Netscape 4 something on Red
Hat 6.1.
Is this Netscape or somehow something to do with PHP? Things work as
they're supposed to viewing the pages on a Windows/IE box.

Mick


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






here, I loked it up for you,
This is a CSS file for PHPBeginner.com - DON'T LOSE IT!!! :

CSS file: css.php
---------------------------
<?
        $ua = Array();
        $ua['USER_AGENT'] = strtoupper(getenv(HTTP_USER_AGENT));

        if(strstr($ua['USER_AGENT'], 'MSIE'))
                $ua['browser'] = 'IE';
        elseif(strstr($ua['USER_AGENT'], 'OPERA'))
                $ua['browser'] = 'Opera';
        elseif(strstr($ua['USER_AGENT'], 'NETSCAPE6'))
                $ua['browser'] = 'N6';
        elseif(strstr($ua['USER_AGENT'], 'MOZILLA/4.'))
                $ua['browser'] = 'N4';
        else
                $ua['browser'] = 'other';

        if(strstr($ua['USER_AGENT'], 'WIN'))
                $ua['platform'] = 'Win';
        elseif(strstr($ua['USER_AGENT'], 'MAC'))
                $ua['platform'] = 'Mac';
        else
                $ua['platform'] = 'other';
?>

BODY, TH, CENTER, TD, OL, UL, LI, H1, H2, H3, H4 { font-family: verdana,
arial, helvetica, sans-serif; }
PRE, TT, CODE { font-family: courier, sans-serif; }

H1 { font-size: <?=$ua['browser'] == 'IE' ? '180' : '160' ?>%; }
H2 { font-size: <?=$ua['browser'] == 'IE' ? '140' : '130' ?>%; }
H3 { font-size: 115%; }
H4 { font-size: 100%; }

PRE, TT, CODE { font-size: 10px; }
BODY, TH, CENTER, TD, OL, UL { font-size: 12px; }



.TopMenu { font-size: 17px; }
.L1 { font-size: 13px; }
.SubMenu,.L2 { font-size: 11px; }
.x { font-size: 5px }

.TopMenu,.SubMenu,.L1 { font-weight: 900; }

.SubMenu { line-height: <?=$ua['browser'] == 'N4' ? '7' : '13' ?>px; }

.TopMenu { margin-left: 5px; }
.SubMenu { margin-left: 12px; }




A { color: #7B8FD6;}
A:visited { color: #800080;}
A:hover { text-decoration: none;}

A.TopMenu { text-decoration: none;  color: #FFFFFF; }
A.TopMenu:visited { text-decoration: none;  color: #FFFFFF; }
A.TopMenu:hover { text-decoration: none;  color: #FFFFFF; }

A.SubMenu { text-decoration: none;  color: #FFFFFF; }
A.SubMenu:visited { text-decoration: none;  color: #FFFFFF; }
A.SubMenu:hover { text-decoration: none;  color: #FFFFFF; }

A.L1 { text-decoration: none;  color: #7B8FD6; }
A.L1:visited { text-decoration: none;  color: #7B8FD6; }
A.L1:hover { text-decoration: underline;  color: #7B8FD6; }

A.L2 { text-decoration: none;  color: #000000; }
A.L2:visited { text-decoration: none;  color: #000000; }
A.L2:hover { text-decoration: underline;  color: #000000; }


-----------------

This file is far not perfect, it does not yet detect all the browsers, and
the styles themselves are to play with.
But, it could be a good base for your development.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com






-----Original Message-----
From: PHPBeginner.com [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 17, 2001 8:20 PM
To: Michael Hall; PHP List
Subject: RE: [PHP] Stylesheets


YES! YES! IT'S PHP!!!

</kidding>

Michael, PHP just writes for you some text based on certain conditions and
the data from db or whatever ...
That text can be used for anything like HTML, JavaScript, sending emails or
even write a whole C software (with an fopen of course... is that possible?
I think it could be)

Anyway my point is that the code is the same for you css. Whether Netscape
on RH6 reads it or not is not a PHP business... It just sent a code and that
is it.

Do what: make a function to detect the browser. Define which CSS are the
best for each.

and then:

$css = get_browser();
include("$css.css")

Having a whole bunch of different css files, including only the perfect
ones.


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Michael Hall [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 17, 2001 6:26 PM
To: PHP List
Subject: [PHP] Stylesheets


I'm building a PHP application which uses stylesheets. Stylesheets seem to
be broken in a big way on my system - using Netscape 4 something on Red
Hat 6.1.
Is this Netscape or somehow something to do with PHP? Things work as
they're supposed to viewing the pages on a Windows/IE box.

Mick


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






On Saturday 17 February 2001 10:26, Michael Hall wrote:
> I'm building a PHP application which uses stylesheets. Stylesheets seem
> to be broken in a big way on my system - using Netscape 4 something on
> Red Hat 6.1.
> Is this Netscape or somehow something to do with PHP? Things work as

Do you have javascript turned of? Netscape4 only interprets CSS if 
javascript is enabled.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Drink wet cement. Get stoned.




I wonder, if LAST_INSERT_ID will work in here...

I know it works when on the same file was an insertion.. but will it return
you the last ever inserted id, say a week ago?

I feel like it won't, but don't know for sure... try it...


Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com






-----Original Message-----
From: ..s.c.o.t.t.. [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 17, 2001 4:59 PM
To: Php-General
Subject: RE: [PHP] Can I select only the newest record?


there are two ways that come to mind of doing this if you're
using some kind of auto-incrementing field (not necessarily
AUTO_INCREMENT, but any field that increases [or decreases]
with time)

this will select the entire row, but limit the query to only
return 1 result (and depending on how your order, this
result could be the highest/lowest value of the field):


(to get highest value of field id)
SELECT * FROM mytable ORDER BY id ASC LIMIT 1;

(to get lowest value of field id)
SELECT * FROM mytable ORDER BY id DESC LIMIT 1;


PS: there's probably a more efficient way to do it,
but this is what came to mind at the moment...


> -----Original Message-----
> From: Brian Drexler [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 16, 2001 20:22
> To: Php-General
> Subject: [PHP] Can I select only the newest record?
>
>
> Using PHP3/MySQL, is there a way I can select only the newest record from
a
> MySQL table.  I have a datetime field and an Auto_incremented field.
Anyone
> got any ideas???
>
> Brian Drexler
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






On Saturday 17 February 2001 12:12, PHPBeginner.com wrote:
> I wonder, if LAST_INSERT_ID will work in here...
>
> I know it works when on the same file was an insertion.. but will it
> return you the last ever inserted id, say a week ago?

It will you return the id that was used on the last INSERT that *this* 
process (i.e. this script while being executed right now) did.

=> it won't help.

> > MySQL table.  I have a datetime field and an Auto_incremented field.

If you want the "newest" field, add a timestamp field and do a 
SELECT * from that_table ORDER BY thetimestamp DESC LIMIT 1

a timestamp field in MySQL is by default automatically set to NOW() at 
each INSERT and UPDATE if you don't set it yourself in the query.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Drink wet cement. Get stoned.




I've recently swapped over from a virtual server to a dedicated server.
I've been told that I will get much better performace from my
new server and I want to verify this, particular with regard to handling PHP

Does any have or know of a PHP script I can download and use
to do a general benchmark test of PHP/mySQL performance.

Thanks for any advice offered.


Allan





hmm

--
GIF89aÔ<






Hi!
i'm trying to use sessions in my shopping cart!
i hadno idea about from where to start till one of u'r kind members send me 
url that points to devshed!
while sacnning titles and articles that had confused me cause i found no 
help in implementation! but i discovered this phplib-7-2 library !
can u help me in the steps to follow please !
cheers

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





Hi,

    You could try this:

     $script_name = getenv("PATH_TRANSLATED");
     $dir_name = dirname($script_name);
     $d = dir($dir_name);
     $i = 0;
     while ($file = $d->read())

            $file_array[i]  = $file ;
     }

HTH
Sorin Ifrim


----- Original Message -----
From: Brandon Orther <[EMAIL PROTECTED]>
To: PHP User Group <[EMAIL PROTECTED]>
Sent: Saturday, February 17, 2001 5:03 AM
Subject: [PHP] Dir? Can I get a dir listing of the current dir my php file
is in?


> Hello,
>
> I am looking for a way to get a dir listing of the current dir my
phpscript
> is in and putting it into an array.  Does anyone have a quick way to do
> this?
>
> Thank you,
>
> --------------------------------------------
> Brandon Orther
> WebIntellects Design/Development Manager
> [EMAIL PROTECTED]
> 800-994-6364
> www.webintellects.com
> --------------------------------------------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Another solutions is:

        $script_name = getenv("PATH_TRANSLATED");
        $dir_name = dirname($script_name);

        // $arFiles will be an array of filenames
        exec( "ls -1 $dirname", $arFiles )

        foreach( $arFiles as $cFile ) {
                print( $cFile );
        }


Joseph E. Sheble
a.k.a. Wizaerd
Wizaerd's Realm
Canvas, 3D, Graphics,
ColdFusion, PHP, and mySQL
http://www.wizaerd.com
=================================

> -----Original Message-----
> From: Ifrim Sorin [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, February 17, 2001 5:46 AM
> To: Brandon Orther; PHP User Group
> Subject: Re: [PHP] Dir? Can I get a dir listing of the current dir my
> php file is in?
>
>
> Hi,
>
>     You could try this:
>
>      $script_name = getenv("PATH_TRANSLATED");
>      $dir_name = dirname($script_name);
>      $d = dir($dir_name);
>      $i = 0;
>      while ($file = $d->read())
>
>             $file_array[i]  = $file ;
>      }
>
> HTH
> Sorin Ifrim
>
>
> ----- Original Message -----
> From: Brandon Orther <[EMAIL PROTECTED]>
> To: PHP User Group <[EMAIL PROTECTED]>
> Sent: Saturday, February 17, 2001 5:03 AM
> Subject: [PHP] Dir? Can I get a dir listing of the current dir my php file
> is in?
>
>
> > Hello,
> >
> > I am looking for a way to get a dir listing of the current dir my
> phpscript
> > is in and putting it into an array.  Does anyone have a quick way to do
> > this?
> >
> > Thank you,
> >
> > --------------------------------------------
> > Brandon Orther
> > WebIntellects Design/Development Manager
> > [EMAIL PROTECTED]
> > 800-994-6364
> > www.webintellects.com
> > --------------------------------------------
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>





Hi!
Do u think i have to create my own chart cart ?! or use an already existant 
soft or library ?i've sezen the phplib-7.2 but the cart can contain only 
simple things :(
do u have any urls to point me to  beside the devshed ?
Thanks !

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





Hi,

Does anyone know of the code to remove all whitespace from a string.

E.G if input is 'Hello I was here'

I want it to come out as 'HelloIwashere'

I`m searching the manual as I type this but can`t find anything.

TIA
Ade




Hi,

I found it on DevShed, if anyone else is interested the code is 

$your_string = str_replace(" ","",$your_string);

Regards
Ade

<< Hi,
 
 Does anyone know of the code to remove all whitespace from a string.
 
 E.G if input is 'Hello I was here'
 
 I want it to come out as 'HelloIwashere'
 
 I`m searching the manual as I type this but can`t find anything.
 
 TIA
 Ade >>




On Saturday 17 February 2001 14:52, [EMAIL PROTECTED] wrote:

> I found it on DevShed, if anyone else is interested the code is
>
> $your_string = str_replace(" ","",$your_string);

That only eliminates "space" characters and leaves tabs, newline etc 
untouched. Try
$your_string = preg_replace('/\s/',"",$your_string);

> << Hi,
>
>  Does anyone know of the code to remove all whitespace from a string.

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Software is like sex: the best is for free" -- Linus Torvalds




On Friday 16 February 2001 23:57, James, Yz wrote:

> OK, I've an error handling page.  Basically, I want to split (that
> might even be one of the functions I'll have to use) this sort of url:
>
> error.php?/pages/login.php?username=name

That will only cause trouble. URLs with parameters have the following 
format:
scriptname?parameter1=value1[&parameter2=val2[&...]]

Two '?' in an URL are strange at best. So change that to

$ErrorURL = 'error.php?page=' . 
rawurlencode ('/pages/login.php&username=name');

> /pages/login.php

$HTTP_GET_VARS['page']

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Drink wet cement. Get stoned.




On Saturday 17 February 2001 08:07, Brandon Feldhahn wrote:
> How do i make a php and MySQL search engine?

If you want it to be good *and* if you want to write it youself, I'd 
start by doing several years of intensive research.
If you only want it to be good, use one of the existing ones 
(http://freshmeat.net/search/?q=search+engine)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Drink wet cement. Get stoned.




On Saturday 17 February 2001 09:16, jaskirat wrote:

> $var = "This is a variable          ";
>
> Now I want to strip off white spaces on the end without losing them in
> the middle of the sentence ..
>
>
> I had figured that there is a no direct way of doing it and some thing
> like this
> works
> $var = trim (ereg_replace("  ","",$var));

*ack*
Why not just
$var = trim ($var);
?
Try it. It works :)

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Drink wet cement. Get stoned.




Hi,

I ran into strange problem yesterday witch I was able to work around (on a
deadline ;). I was writing the code and testing it on IIS web server (W2K)
and I used the round function couple times.

        $foo = round (1.95583, 0);

When I saved the code on a different server, Apache on Linux, I got this
error up:

        Warning: Wrong parameter count for round() ... bla, bla

I solved the problem by skipping the parameter "O":

        $foo = round (1.95583);

So the question is, why is this acting like this? (When I meet "pro" they
say Apache, Linux e.g.. is the best, and curse the IIS and W2K, but at this
time I would say it's a myth..)

Regards,
Sumarlidi Einar Dadason

SED - Graphic Design

------------------------------------------
Phone:       (+354) 4615501
Mobile:      (+354) 8960376
Fax:         (+354) 4615503
E-mail:      [EMAIL PROTECTED]
Homepage:    www.sed.is <- New Homepage!
------------------------------------------





SED wrote:
>       $foo = round (1.95583, 0);
>
> When I saved the code on a different server, Apache on Linux, I got
> this error up:
>
>       Warning: Wrong parameter count for round() ... bla, bla

A look into the manual reveals:
"Note:  The precision parameter is only available in PHP 4."
Looks like your Apache is running PHP 3.

> So the question is, why is this acting like this? (When I meet "pro"
> they say Apache, Linux e.g.. is the best, and curse the IIS and W2K,
> but at this time I would say it's a myth..)

Well, LAMP and IIS should at least meet on equal ground.
You just can't compare two servers, when they are running different 
versions of PHP or have different configurations in php.ini.

regards
Wagner

-- 
Three may keep a secret, if two of them are dead.




Hi everybody,

I want to implement ordering something on a website without refreshing the
page. Lets say i have four columns in the html table - name,age,skill and
phone. All these are links - under these are the information, eg:
Name Age Skill Phone 
Siim 23  php   051...
Tony 18  html  132...

Now, when i click on the name, it should order the listings by name, if I
click on the age, I get the listing ordered by age and etc,etc. Generally
it is easy to do it, but how to do it without refreshing the page every
time I want to order by something else? 

It should be possible with XML; I get the data from mysql database with
php, I write it into an array and ... now how could I make it function the
way I just described? Could someone point me some already written code or
explain me in detail how to do it?


Thank you,
Siim Einfeldt

PS: Sorry about sending this message to so many lists, but I haven`t seen
this kind of code anywhere, but at the same time I know it is possible. 





I'm afraid XML isn't going to help you - you need to investigate DHTML
options, although you'll be lucky to find a solution which is
compatible across both Netscape and IE.

regards,

P

On Sat, 17 Feb 2001, Siim Einfeldt
aka Itpunk wrote:

> Hi everybody,
> 
> I want to implement ordering something on a website without refreshing the
> page. Lets say i have four columns in the html table - name,age,skill and
> phone. All these are links - under these are the information, eg:
> Name Age Skill Phone 
> Siim 23  php   051...
> Tony 18  html  132...
> 
> Now, when i click on the name, it should order the listings by name, if I
> click on the age, I get the listing ordered by age and etc,etc. Generally
> it is easy to do it, but how to do it without refreshing the page every
> time I want to order by something else? 
> 
> It should be possible with XML; I get the data from mysql database with
> php, I write it into an array and ... now how could I make it function the
> way I just described? Could someone point me some already written code or
> explain me in detail how to do it?
> 
> 
> Thank you,
> Siim Einfeldt
> 
> PS: Sorry about sending this message to so many lists, but I haven`t seen
> this kind of code anywhere, but at the same time I know it is possible. 
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 







  But I`m pretty sure it is possible with XML, in theory at least, I get
the data from the database, I write it into array, put into xml and then
deal with it - that`s how I imagine it. 

  DHTML doesn`t seem the best way to do it...but then maybe it`s just me.


cheers
Siim Einfeldt

> I'm afraid XML isn't going to help you - you need to investigate DHTML
> options, although you'll be lucky to find a solution which is
> compatible across both Netscape and IE.
> 
> regards,
> 
> P
> 
> On Sat, 17 Feb 2001, Siim Einfeldt
> aka Itpunk wrote:
> 
> > Hi everybody,
> > 
> > I want to implement ordering something on a website without refreshing the
> > page. Lets say i have four columns in the html table - name,age,skill and
> > phone. All these are links - under these are the information, eg:
> > Name Age Skill Phone 
> > Siim 23  php   051...
> > Tony 18  html  132...
> > 
> > Now, when i click on the name, it should order the listings by name, if I
> > click on the age, I get the listing ordered by age and etc,etc. Generally
> > it is easy to do it, but how to do it without refreshing the page every
> > time I want to order by something else? 
> > 
> > It should be possible with XML; I get the data from mysql database with
> > php, I write it into an array and ... now how could I make it function the
> > way I just described? Could someone point me some already written code or
> > explain me in detail how to do it?
> > 
> > 
> > Thank you,
> > Siim Einfeldt
> > 
> > PS: Sorry about sending this message to so many lists, but I haven`t seen
> > this kind of code anywhere, but at the same time I know it is possible. 
> > 
> > 
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> > 
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> > 
> > 
> 





Maybe Flash is an option?

> -----Original Message-----
> From: Peter Skipworth [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, February 17, 2001 9:29 AM
> To: Siim Einfeldt aka Itpunk
> Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
> [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED];
> [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: [PHP] Re: Creative solution with XML,PHP,MYSQL
>
>
> I'm afraid XML isn't going to help you - you need to investigate DHTML
> options, although you'll be lucky to find a solution which is
> compatible across both Netscape and IE.
>
> regards,
>
> P
>
> On Sat, 17 Feb 2001, Siim Einfeldt
> aka Itpunk wrote:
>
> > Hi everybody,
> >
> > I want to implement ordering something on a website without
> refreshing the
> > page. Lets say i have four columns in the html table -
> name,age,skill and
> > phone. All these are links - under these are the information, eg:
> > Name Age Skill Phone
> > Siim 23  php   051...
> > Tony 18  html  132...
> >
> > Now, when i click on the name, it should order the listings by
> name, if I
> > click on the age, I get the listing ordered by age and etc,etc.
> Generally
> > it is easy to do it, but how to do it without refreshing the page every
> > time I want to order by something else?
> >
> > It should be possible with XML; I get the data from mysql database with
> > php, I write it into an array and ... now how could I make it
> function the
> > way I just described? Could someone point me some already
> written code or
> > explain me in detail how to do it?
> >
> >
> > Thank you,
> > Siim Einfeldt
> >
> > PS: Sorry about sending this message to so many lists, but I
> haven`t seen
> > this kind of code anywhere, but at the same time I know it is possible.
> >
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
> <[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>





Relax, XML has N.O.T.H.I.N.G. to do with what you want to do.

You want dynamically update (rebuild) HTML page, well,
the only way to do it currently in more or less compatible way
is to use javascript+DHTML. And the result will SUCK, i know,
i've done it. So, go the way the elders did. Refresh the page and
pass the script a parameter which says how to sort the data.

----- Original Message -----
From: "Siim Einfeldt aka Itpunk" <[EMAIL PROTECTED]>
To: "Peter Skipworth" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, February 17, 2001 5:38 PM
Subject: Re: Creative solution with XML,PHP,MYSQL


>
>
>   But I`m pretty sure it is possible with XML, in theory at least, I
get
> the data from the database, I write it into array, put into xml and
then
> deal with it - that`s how I imagine it.
>
>   DHTML doesn`t seem the best way to do it...but then maybe it`s
just me.
>
>
> cheers
> Siim Einfeldt
>
> > I'm afraid XML isn't going to help you - you need to investigate
DHTML
> > options, although you'll be lucky to find a solution which is
> > compatible across both Netscape and IE.
> >
> > regards,
> >
> > P
> >
> > On Sat, 17 Feb 2001, Siim Einfeldt
> > aka Itpunk wrote:
> >
> > > Hi everybody,
> > >
> > > I want to implement ordering something on a website without
refreshing the
> > > page. Lets say i have four columns in the html table -
name,age,skill and
> > > phone. All these are links - under these are the information,
eg:
> > > Name Age Skill Phone
> > > Siim 23  php   051...
> > > Tony 18  html  132...
> > >
> > > Now, when i click on the name, it should order the listings by
name, if I
> > > click on the age, I get the listing ordered by age and etc,etc.
Generally
> > > it is easy to do it, but how to do it without refreshing the
page every
> > > time I want to order by something else?
> > >
> > > It should be possible with XML; I get the data from mysql
database with
> > > php, I write it into an array and ... now how could I make it
function the
> > > way I just described? Could someone point me some already
written code or
> > > explain me in detail how to do it?
> > >
> > >
> > > Thank you,
> > > Siim Einfeldt
> > >
> > > PS: Sorry about sending this message to so many lists, but I
haven`t seen
> > > this kind of code anywhere, but at the same time I know it is
possible.
> > >
> > >
> >
> --------------------------------------------------------------------
-
> > > Before posting, please check:
> > >    http://www.mysql.com/manual.php   (the manual)
> > >    http://lists.mysql.com/           (the list archive)
> > >
> > > To request this thread, e-mail
<[EMAIL PROTECTED]>
> > > To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> > > Trouble unsubscribing? Try:
http://lists.mysql.com/php/unsubscribe.php
> > >
> > >
> >
>
>
> --------------------------------------------------------------------
-
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try:
http://lists.mysql.com/php/unsubscribe.php
>
>





Aha, java is even better :)

----- Original Message -----
From: "Brian V Bonini" <[EMAIL PROTECTED]>
To: "Peter Skipworth" <[EMAIL PROTECTED]>; "Siim Einfeldt aka
Itpunk" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, February 17, 2001 5:50 PM
Subject: RE: [PHP] Re: Creative solution with XML,PHP,MYSQL


> Maybe Flash is an option?
>
> > -----Original Message-----
> > From: Peter Skipworth [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, February 17, 2001 9:29 AM
> > To: Siim Einfeldt aka Itpunk
> > Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
> > [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED];
> > [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: [PHP] Re: Creative solution with XML,PHP,MYSQL
> >
> >
> > I'm afraid XML isn't going to help you - you need to investigate
DHTML
> > options, although you'll be lucky to find a solution which is
> > compatible across both Netscape and IE.
> >
> > regards,
> >
> > P
> >
> > On Sat, 17 Feb 2001, Siim Einfeldt
> > aka Itpunk wrote:
> >
> > > Hi everybody,
> > >
> > > I want to implement ordering something on a website without
> > refreshing the
> > > page. Lets say i have four columns in the html table -
> > name,age,skill and
> > > phone. All these are links - under these are the information,
eg:
> > > Name Age Skill Phone
> > > Siim 23  php   051...
> > > Tony 18  html  132...
> > >
> > > Now, when i click on the name, it should order the listings by
> > name, if I
> > > click on the age, I get the listing ordered by age and etc,etc.
> > Generally
> > > it is easy to do it, but how to do it without refreshing the
page every
> > > time I want to order by something else?
> > >
> > > It should be possible with XML; I get the data from mysql
database with
> > > php, I write it into an array and ... now how could I make it
> > function the
> > > way I just described? Could someone point me some already
> > written code or
> > > explain me in detail how to do it?
> > >
> > >
> > > Thank you,
> > > Siim Einfeldt
> > >
> > > PS: Sorry about sending this message to so many lists, but I
> > haven`t seen
> > > this kind of code anywhere, but at the same time I know it is
possible.
> > >
> > >
> >
> --------------------------------------------------------------------
-
> > > Before posting, please check:
> > >    http://www.mysql.com/manual.php   (the manual)
> > >    http://lists.mysql.com/           (the list archive)
> > >
> > > To request this thread, e-mail
<[EMAIL PROTECTED]>
> > > To unsubscribe, e-mail
> > <[EMAIL PROTECTED]>
> > > Trouble unsubscribing? Try:
http://lists.mysql.com/php/unsubscribe.php
> > >
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
[EMAIL PROTECTED]
> >
> >
>
>
> --------------------------------------------------------------------
-
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try:
http://lists.mysql.com/php/unsubscribe.php
>
>






> Maybe Flash is an option?
 
Well, I know I could probably do it some way in flash (if I had
experiences with it), but this is just a bit out 'of the box'. But still,
thanks for offering.

Siim





Sorry about all these questions. Just a quickie.  Does a session registered
variable take on global scope, or do I still need to do a "global
$my_session_var" to make my function see it?

- John Vanderbeck
- Admin, GameDesign





try it.

(yes you need to register it as a global variable)



Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com







-----Original Message-----
From: John Vanderbeck [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 17, 2001 11:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Sessions again :(


Sorry about all these questions. Just a quickie.  Does a session registered
variable take on global scope, or do I still need to do a "global
$my_session_var" to make my function see it?

- John Vanderbeck
- Admin, GameDesign


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]






Hi all,

I'm trying to match a particular piece of string in a big string using a
regex in order to change it whith another value ... I mean:

eg:

$html="<a
href=link.htm?&flag=982420537&PHPSESSID=2c86b460d360b13c3ef08b8a46b9cafc>Lnk
</a>";

function change_sess(&$html_code){
        if(eregi("&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}",$html_code)){

str_replace("&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}","<?=append_url();?>",
$html_code);
        }
}

change_sess($html);
...
$fp=fopen($my_file,"w");
fwrite($fp,$html);
...

But open the $my_file, the changes are not applied ... (I mean: there's
always the original string -->
&flag=982420537&PHPSESSID=2c86b460d360b13c3ef08b8a46b9cafc)

Anyone could help me, please?

many thanks in advance
max





On Saturday 17 February 2001 21:49, n e t b r a i n wrote:
> function change_sess(&$html_code){
>       if(eregi("&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}",$html_code)){
>
> str_replace("&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}","<?=append_url()
>;?>", $html_code);

str_replace doesn't know about regular expressions, so it tries to find 
the literal string "&flag=[0-9]{9}&PHPSESSID=[[:alnum:]]{32}" in your URL 
- which it doesn't find.
Use eregi_replace instead

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"Software is like sex: the best is for free" -- Linus Torvalds




I have $File, and I want the context of hello.txt to be stored in $file, 

Is there a function for this or do I use fopen?

- peter




[EMAIL PROTECTED] wrote:
> I have $File, and I want the context of hello.txt to be stored in
> $file,
>
> Is there a function for this or do I use fopen?

$file = implode("",file($File));

RTM for explainations.

regards
Wagner

-- 
Three may keep a secret, if two of them are dead.




Can I configure PHP4 for to process .php .php4 .php3 and .phtml ??

I'm a first timer to configuring the PHP engine, so a few detials on how to
would be appreciated as well.

Thanks,
Jeff Gannaway
_______________________________________________________

 2001 Wall Calendars....
   * Art, Jazz, Blues, Women's, African-American.
   * Everyday Discounts.
   * Excellent paper and reproductions.
 
 And as always, a great selection of abstract,
 contemporary and African-American art prints.

 PopStreet.com is your avenue to art.
 http://www.popstreet.com
_______________________________________________________




Hello,

    I think this is rather a Web server issue.
    In Apache, just add in your conf file a line for each extension :

        AddType application/x-httpd-php .php3
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php .php4
        AddType application/x-httpd-php .phtml

HTH
Sorin Ifrim

----- Original Message -----
From: Jeff Gannaway <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 17, 2001 12:39 PM
Subject: [PHP] .php3 in PHP4?


> Can I configure PHP4 for to process .php .php4 .php3 and .phtml ??
>
> I'm a first timer to configuring the PHP engine, so a few detials on how
to
> would be appreciated as well.
>
> Thanks,
> Jeff Gannaway
> _______________________________________________________
>
>  2001 Wall Calendars....
>    * Art, Jazz, Blues, Women's, African-American.
>    * Everyday Discounts.
>    * Excellent paper and reproductions.
>
>  And as always, a great selection of abstract,
>  contemporary and African-American art prints.
>
>  PopStreet.com is your avenue to art.
>  http://www.popstreet.com
> _______________________________________________________
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Trim should do exactly what you're looking for without needing
ereg_replace, etc.

Trim trims all whitespace before the first non-whitespace character and
after the last non-whitespace character. I've included an example and
its output below.

File: test.php
<?php

header("Content-type: text/plain");

$test_str = "      This is my test str      ";
echo "'$test_str'\n\n";

$test_str = trim($test_str);
echo "'$test_str'";

?>

Output: test.php
'      This is my test str      '

'This is my test str'

Note: The single quotes are included in the output to show where the
spaces are.

Hope this helps!

--Toby

jaskirat wrote:
> 
> Since this thread is running I would like to know the gurus' opinons on the
> similar following situation
> 
> Suppose there is a variable like this
> 
> $var = "This is a variable          ";
> 
> Now I want to strip off white spaces on the end without losing them in the
> middle of the sentence ..
> 
> I had figured that there is a no direct way of doing it and some thing like
> this
> works
> $var = trim (ereg_replace("  ","",$var));
> 
> the first argument to ereg_replace is  "two spaces" so that single spaces
> between the words are not removed
> then trim to remove any space on the end which may still remain.
> 
> But I feel its still not a fool proof solution because there may be two
> spaces in between words some where also
> which will then be clubbed together.
> 
> Any body has a better idea.
> 
> Jaskirat
> 
> At 09:51 PM 2/16/01 -0500, you wrote:
> >> Trim() will in fact only strip whitespace from the beginning or end of
> >> the string; if he has \n's anywhere in the middle of the string, trim
> >> will do perform the desired operation.
> >
> >CORRECTION : "trim will not perform the desired operation"
> >
> ><snip>
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >




I'm trying to find an enviroment variable, or something, that will let me
know if the client's browser has cookies enabled or not.  I'm doing this,
because I don't want to pass the SID in the URL if I don't have to, and the
PHP I am working with is not compiled with --trans-sid

I'm guessing I could do this in a roundabout way, by setting a cookie, then
trying to read it back.  However, I was wondering if there way a simpler
way?

- John Vanderbeck
- Admin, GameDesign






if your server does not have --trans-sid enabled the SID will not
automatically be appended to the URL, I think this is what your looking for,
to NOT have the SID appended right? then your server is set.

I test for cookies support in the same manner you mentioned, set it, see if
its still there.


--


Chris Lee
Mediawaveonline.com

em. [EMAIL PROTECTED]

ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120



""John Vanderbeck"" <[EMAIL PROTECTED]> wrote in message
002601c098f9$797715a0$[EMAIL PROTECTED]">news:002601c098f9$797715a0$[EMAIL PROTECTED]...
> I'm trying to find an enviroment variable, or something, that will let me
> know if the client's browser has cookies enabled or not.  I'm doing this,
> because I don't want to pass the SID in the URL if I don't have to, and
the
> PHP I am working with is not compiled with --trans-sid
>
> I'm guessing I could do this in a roundabout way, by setting a cookie,
then
> trying to read it back.  However, I was wondering if there way a simpler
> way?
>
> - John Vanderbeck
> - Admin, GameDesign
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






At 08:35 AM 2/17/01 -0800, Chris Lee wrote:
>I test for cookies support in the same manner you mentioned, set it, see if
>its still there.

Can this be done on one page?  Or does one page have to set it, then when
the visitor goes to the next page, have that page check to see if it was set?

Thanks,
Jeff
_______________________________________________________

 2001 Wall Calendars....
   * Art, Jazz, Blues, Women's, African-American.
   * Everyday Discounts.
   * Excellent paper and reproductions.
 
 And as always, a great selection of abstract,
 contemporary and African-American art prints.

 PopStreet.com is your avenue to art.
 http://www.popstreet.com
_______________________________________________________




Well, since cookies are set in the header, I would say you would have to at
least refresh the same page.  I'm just putting a cookie into my home page
for now. and it will be checked in just afew areas of the site that REQUIRE
the cookies to work right.

- John Vanderbeck
- Admin, GameDesign
----- Original Message -----
From: "Jeff Gannaway" <[EMAIL PROTECTED]>
To: "Chris Lee" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, February 17, 2001 6:29 AM
Subject: Re: [PHP] Determingin if cookies are useable?


> At 08:35 AM 2/17/01 -0800, Chris Lee wrote:
> >I test for cookies support in the same manner you mentioned, set it, see
if
> >its still there.
>
> Can this be done on one page?  Or does one page have to set it, then when
> the visitor goes to the next page, have that page check to see if it was
set?
>
> Thanks,
> Jeff
> _______________________________________________________
>
>  2001 Wall Calendars....
>    * Art, Jazz, Blues, Women's, African-American.
>    * Everyday Discounts.
>    * Excellent paper and reproductions.
>
>  And as always, a great selection of abstract,
>  contemporary and African-American art prints.
>
>  PopStreet.com is your avenue to art.
>  http://www.popstreet.com
> _______________________________________________________
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





That figures :)

I was using Off-Line manual I downloaded from PHP.net homepage and that note
is not in it, but it's well documented in the On-Line Manual :)

Thanks!

SED

-----Original Message-----
From: Alexander Wagner [mailto:[EMAIL PROTECTED]]
Sent: 17. febrúar 2001 15:07
To: SED; [EMAIL PROTECTED]
Subject: Re: [PHP] Apache on Linux vs. IIS on W2K


SED wrote:
>       $foo = round (1.95583, 0);
>
> When I saved the code on a different server, Apache on Linux, I got
> this error up:
>
>       Warning: Wrong parameter count for round() ... bla, bla

A look into the manual reveals:
"Note:  The precision parameter is only available in PHP 4."
Looks like your Apache is running PHP 3.

> So the question is, why is this acting like this? (When I meet "pro"
> they say Apache, Linux e.g.. is the best, and curse the IIS and W2K,
> but at this time I would say it's a myth..)

Well, LAMP and IIS should at least meet on equal ground.
You just can't compare two servers, when they are running different
versions of PHP or have different configurations in php.ini.

regards
Wagner

--
Three may keep a secret, if two of them are dead.





SED wrote:
> That figures :)
>
> I was using Off-Line manual I downloaded from PHP.net homepage and
> that note is not in it, but it's well documented in the On-Line
> Manual :)

I also used an offline-Manual, but a more recent one, obviously. Just 
grab a new one.

regards
Wagner

-- 
Three may keep a secret, if two of them are dead.




Hi, Newbie question here. I'm trying to write a function to check an image
extension, part of the code is:

if (substr($imgName, -4) != ".jpg")

my question is what's the syntax for adding (or) ".gif" to this?

TIA

@lvin









> Hi, Newbie question here. I'm trying to write a function to check an image
> extension, part of the code is:
>
> if (substr($imgName, -4) != ".jpg")

if ((substr($imgName, -4) != ".jpg") || (substr($imgName, -4) != ".gif"))
{
 echo "<P CLASS=Error>I'm sorry, but the ikmage format you submitted is not
a supported format.</P>";
}

- John Vanderbeck
- Admin, GameDesign






Sumarlidi,
I have come across this same problem with earlier versions of PHP3.  There
are versions of PHP3 that do not have the extra parameter.  I have 3.0.12 on
one of my machines and it doesn't work.  You will have to manually calculate
your precision using something like:

round(100*number)/100

or

function my_rounder($value)
{ 
    $buffer = $value * 100; 
    $rounded = round($buffer); 
    $buffer = $rounded / 100; 
     return $buffer; 
}
 

Sincerely,

Robert T. Covell
President / Owner
Rolet Internet Services, LLC
Web: www.rolet.com
Email: [EMAIL PROTECTED]
Phone: 816.210.7145
Fax: 816.753.1952

-----Original Message-----
From: SED [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 16, 2001 7:32 PM
To: [EMAIL PROTECTED]
Subject: [PHP] [S.O.S.] round() problem


I have been writing this project in PHP4 but had to save it for PHP3 an
apache server.

        http://www.sed.is/sereign_145.php3

When I saved it on an apache server (I have W2K - where it's 100% ok!) as
php3 I get these errors:

Warning: Wrong parameter count for round() in <sniped>/sereign_145.php3 on
line 152

Warning: Wrong parameter count for round() in <sniped>/sereign_145.php3 on
line 161

According to the manuals this function should work like in both PHP3 and
4...

Can anyone point me to a solution?

Regards,
Sumarlidi Einar Dadason

SED - Graphic Design

------------------------------------------
Phone:       (+354) 4615501
Mobile:      (+354) 8960376
Fax:         (+354) 4615503
E-mail:      [EMAIL PROTECTED]
Homepage:    www.sed.is <- New Homepage!
------------------------------------------


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]







If i'm going to let users select multiple choices from a list in a form, let
say the part in the form is like this:

<select name="category" multiple size="4">
        <option value="Praise">Fruit</option>
        <option value="Worship">Vegetables</option>
        <option value="Fellowship">Fish</option>
</select>

what code should i put in the submit part of the php to collect the multiple
inputs? I tried array, but it seems not working. Please help.

Thanks.







i am having some issues with dbf files...some fields are being displayed
correctly, some are not.

can someone direct me to a howto or faq that might address these and
other dbf issues?

thanx,
-robt




Dave, 

The ODBC functions in PHP mostly address this.  A good ODBC driver will also
translate full SQL92 functionality into the underlying dialect that the
database supports. 

Let me know if you have any questions.

Best regards,
Andrew
---------------------------------------
Andrew Hill - OpenLink Software
Director Technology Evangelism
eBusiness Infrastructure Technology
http://www.openlinksw.com


On 2/16/01 11:54 PM, "Dave Haggerty" <[EMAIL PROTECTED]> wrote:

> I haven't seen this issue discussed, sorry if I missed it:
> 
> My question is why are the PHP database functions so unportable?  Is there a
> reason why they have to be specific to, say MySQL.  It seems to me (even
> though I am an amatuer to this stuff) that the code should be much more
> easily portable from one db to another?
> 
> Do most coders add an abstraction layer themselves?  Or maybe people just
> don't port PHP code much and so don't worry about it?
> 
> Mainly curious....
> 
> Dave
> 
> 
> 





I spoke to the BBEdit folks at MacWorld.

A MacOS X port is forthcoming.

regards,
andrew


On 2/16/01 7:46 PM, "Alexander Wagner" <[EMAIL PROTECTED]> wrote:

> Dave Goodrich wrote:
>> The only reason I have a Mac on my desk is for Bbedit. Hoping they
>> port to OSX and allow it to run on my FBSD box.
> 
> Isnt BBedit originally from BeOS? This way, you could at least run it
> on your x86-Box.
> 
> regards
> Wagner





I'm really crappy with regex's, and I can't find a good tutorial on using
them , and all the syntaxes.  What I need to do is strip all HTML tags from
a string.

This is from a form, where a user can submit comments on things, but I need
to strip the HTML out, in case anyone tries to abuse it :)

- John Vanderbeck
- Admin, GameDesign






Ok, ignore me. I'm an idiot.. I just found the striptags() fucntion.

- John Vanderbeck
- Admin, GameDesign

----- Original Message -----
From: "John Vanderbeck" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 17, 2001 12:33 PM
Subject: [PHP] Strip HTML codes from a string?


> I'm really crappy with regex's, and I can't find a good tutorial on using
> them , and all the syntaxes.  What I need to do is strip all HTML tags
from
> a string.
>
> This is from a form, where a user can submit comments on things, but I
need
> to strip the HTML out, in case anyone tries to abuse it :)
>
> - John Vanderbeck
> - Admin, GameDesign
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>





Thank you. That was too easy.
Jeff Oien

> alter table $TableName add column $ColumnName NOT NULL AUTO_INCREMENT
> PRIMARY KEY;
> 
> Have a nice day!
> 
> Brian Drexler
> Precision Web Design
> 
> > Could you tell me how to add a field to an existing
> > database? I'm having trouble finding out how to do it.
> > Thanks.
> > Jeff Oien
> >
> > > just add a field unique_id int auto_increment in the table...u dont have
> to
> > > do anything more...it will start at 1 and every time a new record is
> added
> > > to the table this value will be incremented....
> > >
> > > > I have an existing database from a flat file that I
> > > > imported into a MySQL table. Some of the title
> > > > fields are duplicates - songs with the same name
> > > > from different song books. So if I want to delete
> > > > a record by title, I'll end up deleting all songs with
> > > > that title. Is there a way I can add a unique id field
> > > > and have it automatically generate a unique number to
> > > > each record? Hope that made sense.
> > > > Jeff Oien
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 




How can i get the count of a multi-dimensional array?

if I have

$myarray[0][chicken]
$myarray[0][fish]
$myarray[0][meat]
$myarray[1][fries]
$myarray[1][chips]
$myarray[2][coke]
$myarray[2][pepsi]
$myarray[2][rootbeer]

How can I get the number of first elements (which would be 3 above)?

thanks,

bill





count($myarray) will give you 3

On Sat, 17 Feb 2001, bill wrote:

> How can i get the count of a multi-dimensional array?
>
> if I have
>
> $myarray[0][chicken]
> $myarray[0][fish]
> $myarray[0][meat]
> $myarray[1][fries]
> $myarray[1][chips]
> $myarray[2][coke]
> $myarray[2][pepsi]
> $myarray[2][rootbeer]
>
> How can I get the number of first elements (which would be 3 above)?
>
> thanks,
>
> bill
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





Hi,
I would like to use Apache and PHP4 on W2K.
If you have any good Httpd.conf file for the 
Apache, please send me.
Thank you.
Paul. [mailto:[EMAIL PROTECTED]]




Hi,

I enabled sessions via session.auto_start feature, and attempting to
simulate sessions when a user has disabled cookies.  I remember it used to
automatically append SESSIONID= to every href, etc.. (I compiled
with --enable-trans-sid), but now it doesn't append it.

What am I missing?

Thanks in advance,
Yev





And I remind you all to buy them at WeberDev.com and help
us pay the hosting :)

Sincerely

      berber

Visit http://www.weberdev.com Today!!! 
To see where PHP might take you tomorrow.
 

-----Original Message-----
From: Brian V Bonini [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 16, 2001 11:14 PM
To: PHP Lists
Subject: [PHP] PHP Book Recommendations


Can I get some recommendations on some good PHP
books. Something broad but with good novice
concepts........

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Hi guys,

I'd like to restrict the characters a client is inputting to a database.

I already have a system that'll exclude certain characters.  Alpha Numerics
are permitted, together with the underscore and spaces.  Is there a
collective expression for the following characters? :

!",.?@()

Because I'd like to allow those too.  And I'm useless with RegEx.

Thanks as always,
James.






im trying to make somthing that takes the user to the members page if
the authentecation is right, but i keep getting this error:

Warning: Cannot add header information - headers already sent by (output
started at C:\www\login2.PHP:7) in C:\www\login2.PHP on line 30

and this is my code:

<HTML>
<HEAD>

<TITLE>My Login Form</TITLE>
</HEAD>

<?
require ('header.php');
switch ($do) {

 case "authenticate":

 $connection = mysql_connect("localhost", "brandon", "******")
    or die ("Couldn't connect to server.");

 $db = mysql_select_db("TNB", $connection)
  or die ("Couldn't select database.");

 $sql = "SELECT id
  FROM members
  WHERE username='$username' and password='$password'";

  $result = mysql_query($sql)
  or die("Couldn't execute query.");

 $num = mysql_numrows($result);

 if ($num == 1) {

 header("Location:index.php");

 }else if ($num == 0)  {

  unset($do);
  echo "<font color='ff0000'>You are not authorized! Please try
again.</font></p>";
  include("login_form.irc");

 }

 break;

 default:

  include("login_form.irc");

}
require ('footer.php');
?>

</BODY>
</HTML>

Line 30 is in bold.
what should i do? PLEASE HELP





from: http://www.php.net/manual/en/function.header.php
"Remember that the header() function must be called before any actual output
is sent, either by normal HTML tags blank lines in a file, or from PHP. It
is a very common error to read code with include(), or require(), functions,
or another file access function, and have spaces or empty lines that will
output before header() is called. The same problem exists when using a
single PHP/HTML file."

- John Vanderbeck
- Admin, GameDesign

----- Original Message -----
From: "Brandon Feldhahn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 17, 2001 4:05 PM
Subject: [PHP] php


> im trying to make somthing that takes the user to the members page if
> the authentecation is right, but i keep getting this error:
>
> Warning: Cannot add header information - headers already sent by (output
> started at C:\www\login2.PHP:7) in C:\www\login2.PHP on line 30
>
> and this is my code:
>
> <HTML>
> <HEAD>
>
> <TITLE>My Login Form</TITLE>
> </HEAD>
>
> <?
> require ('header.php');
> switch ($do) {
>
>  case "authenticate":
>
>  $connection = mysql_connect("localhost", "brandon", "******")
>     or die ("Couldn't connect to server.");
>
>  $db = mysql_select_db("TNB", $connection)
>   or die ("Couldn't select database.");
>
>  $sql = "SELECT id
>   FROM members
>   WHERE username='$username' and password='$password'";
>
>   $result = mysql_query($sql)
>   or die("Couldn't execute query.");
>
>  $num = mysql_numrows($result);
>
>  if ($num == 1) {
>
>  header("Location:index.php");
>
>  }else if ($num == 0)  {
>
>   unset($do);
>   echo "<font color='ff0000'>You are not authorized! Please try
> again.</font></p>";
>   include("login_form.irc");
>
>  }
>
>  break;
>
>  default:
>
>   include("login_form.irc");
>
> }
> require ('footer.php');
> ?>
>
> </BODY>
> </HTML>
>
> Line 30 is in bold.
> what should i do? PLEASE HELP
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>





If I have the source of a <textarea> indented, the spaces are added to
the left side.  Can this be avoided or do I have to make sure that me
source is on the left side of the script?

This will have spaces for the two lines:

    <textarea name="textareaName" cols="62" rows="19">
    This is line 1.
    This is line 2.
    </textarea>

This will not:

<textarea name="textareaName" cols="62" rows="19">
This is line 1.
This is line 2.
</textarea>

Todd

--
Todd Cary
Ariste Software
[EMAIL PROTECTED]






Hi!
I am trying to build a flashchat and got problems with browser cache.
Every 2 sec flash send these variables to server
loadVariablesNum ("http://www.myserver.com/eget9.php3?name=" add name
add "...) and gets the answer from server. All files are cached by IE5.5
and looks like this: http://www.myserver.com/eget9.php3?name=" carl and
so on.
The variables are stored in a textfile on sever controled by thePHP.
Is there any way to stop IE to chache theses files.  If I have the
appliction running several hours it fills up my cache. My thought was to
use it to be online on my homepage ready to answer questions.

Thanks for answer.
Regards

Jan





I've recently been banging my head against the wall because I was getting a number of 
selects that would occasionally return zero rows, even though 1 or more rows should 
have been returned.

I cannot reproduce the problem with pg_connect. The problem only occurs when I am 
using pg_pconnect.

Has anyone run across this behavior? Any ideas why this might be occuring? Is it an 
apache issue?

Matt Friedman





is there a way to sell domains? like have a php domain search and have
permission to sell it, how would i do that?





I am hoping that someone really understands arrays reads this and can tell
me why the following isn't working as I expect it to. I've been trying for
days to get it to work. 

$pages=mysql_query("SELECT CP.page_id, pagename FROM cluster_pagetbl as CP,
pagetbl WHERE 
CP.cluster_id = '$id' AND CP.page_id=pagetbl.page_id order by page_id");

/*
SQL Result for $id=1:
page_id pagename 
 1   breakingnews  
 3   weather  
*/
 
if (mysql_Numrows($pages)>0) {

        $prows=mysql_NumRows($pages);
        $i=0;
        while ($i<$prows){
 
//figure out how to get page ids into array
$pid= mysql_result($pages,$i, page_id);
$pagename =mysql_result($pages, $i, pagename);
 
 $pgids= array("$pid" => "$pagename");

foreach($pgids as $pid => $pagename){
 print $pid.' => '.$pagename.'<br>';
}

/* prints:
1 => breakingnews
3 => weather

At this point the correct number of values appear to be in the pgids array
*/

$i++;
}
}

$query2=mysql_query("select page_id, pagename FROM 
pagetbl order by page_id");

/*
SQL Result:
page_id pagename 
 1   breakingnews  
 2   pastnews  
 3   weather 
*/

if (mysql_Numrows($query2)>0) {

        $numrows=mysql_NumRows($query2);
        $x=0;
        while ($x<$numrows){
                
$mpid=mysql_result($query2,$x, page_id);
$mpagename=mysql_result($query2,$x, pagename);

$mpgids= array("$mpid" => "$mpagename");   
  
foreach ($mpgids as $mpid => $mpagename){
print '<input type=checkbox name=page_ids[] value="'.$mpid.'"';

if ($pgids == $mpgids){         print " checked"; }
print '>'.$mpagename;
}

// prints out three checkboxes, since that's the total number of pages
present
//but only the third checkbox (weather) gets checked, the first one should
be checked also

$x++;
}
}

//I used the array intersect function to doublecheck what is going on and it
finds only weather also
//What is happening to the first value?

$diff = array_intersect($mpgids,$pgids);

foreach ($diff as $element){
print '<p>'.$element.'<br>';} 
 
//prints: weather


Reply via email to