php-general Digest 6 Apr 2003 11:10:18 -0000 Issue 1982

Topics (messages 142538 through 142580):

Re: HTTP or HTTPS
        142538 by: Rasmus Lerdorf
        142541 by: Alexander Weber

Re: error while quering from MSSQL server from a Linux box
        142539 by: Alexander Weber

Re: newbie alternate row colours in dynamic table
        142540 by: Daevid Vincent
        142544 by: Chris Hayes
        142545 by: Don Read

Re: Right Click
        142542 by: Leif K-Brooks
        142550 by: daniel
        142551 by: Leif K-Brooks

Prefix question
        142543 by: Sparky Kopetzky
        142546 by: Chris Hayes

Re: newbie alternate row colours in dynamic table -- timed tests
        142547 by: Daevid Vincent
        142553 by: Philip Olson
        142555 by: John W. Holmes

Roadblock When One Page Calls ANother to Log In Users
        142548 by: Stephen Tiano

Timing test of the parser... Makes no difference
        142549 by: Daevid Vincent
        142578 by: daniel

Design - Database, Hard File, Combination?
        142552 by: Mike
        142557 by: Burhan Khalid

combining text with $_POST
        142554 by: David McGlone
        142556 by: John W. Holmes
        142558 by: Don Read
        142560 by: David McGlone
        142561 by: Sebastian
        142562 by: John W. Holmes

Re: Query
        142559 by: Burhan Khalid

Problem with mysql versions. help
        142563 by: NeXaS

Another problem with mysql version coding
        142564 by: NeXaS
        142565 by: John W. Holmes

When to use a text file rather then a database
        142566 by: Charles Kline
        142567 by: John W. Holmes

array_unique wierdness
        142568 by: Greg Robillard
        142570 by: John W. Holmes

array_unique wierdness -addendum
        142569 by: Greg Robillard

Re: Finding the height of a JPG in pixels using PHP
        142571 by: De deco
        142572 by: Tom Rogers

Great Opportunity for all group members!!!
        142573 by: Chinmoy Barua
        142574 by: Matt Giddings
        142575 by: Sebastian
        142577 by: daniel

Re: RedHat
        142576 by: John Taylor-Johnston

any package for lost and found
        142579 by: SayOrange.com

alignment
        142580 by: Diksha  Neel

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 ---
No, the destination port will not change.  You must be looking at the
source port.

-Rasmus

On Sat, 5 Apr 2003, Alexander Weber wrote:

> So far so good, the next problem is now, that the port changes with every
> new request. Tried this on my "personal" server an my hoster's one.
>
> Perhaps there is another way? JScript, xml or anything other?
>
> Thanx so far,
>
> Alex
>
>
> "Rasmus Lerdorf" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:[EMAIL PROTECTED]
> > Presumably you know the HTTPS port on your server.  Anything not SSL is
> > going to be straight HTTP.  The point here is that SSL happens a layer
> > below PHP.  PHP doesn't care whether it is running over SSL or not.  In
> > fact it has no idea what transport layer is below it.  So your only way to
> > tell is to depend on whatever the web server tells you.  Look at a
> > phpinfo() for both an SSL and a non-SSL request and see what the
> > differences are on your server.  For me, checking SERVER_PORT has been the
> > most portable/reliable mechanism.
> >
> > -Rasmus
> >
> >
> >
> > On Sat, 5 Apr 2003, Alexander Weber wrote:
> >
> > > But SERVER PORT is not always 80 using HTTP (not HTTPS). So this way is
> not
> > > really secure.
> > >
> > > Alex
> > >
> > > "Rasmus Lerdorf" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > > news:[EMAIL PROTECTED]
> > > > I usually just use $_SERVER['SERVER_PORT']
> > > >
> > > > -Rasmus
> > > >
> > > > On Sat, 5 Apr 2003, Alexander Weber wrote:
> > > >
> > > > > Unfortunally is not set. It's like the variable does not exist,
> because
> > > when
> > > > > I extract the varaible $_SERVER with foreach I don't get HTTPS as
> key,
> > > only
> > > > > SERVER_PROTOCOL.
> > > > >
> > > > > I'm using PHP 4.3.1 as Apache2 Module on Win2k SP3.
> > > > > register_globals OFF
> > > > > safe:mode OFF
> > > > >
> > > > > stunnel 4.04 on x86-pc-mingw32-gnu WIN32 with OpenSSL 0.9.7 31 Dec
> 2002
> > > > >
> > > > > If you need more info:
> > > > >
> > > > > ICQ 46858764.
> > > > >
> > > > > Thanx
> > > > >
> > > > > Alex
> > > > >
> > > > > "John W. Holmes" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > > > > news:[EMAIL PROTECTED]
> > > > > > > anybody knows how to find out the connection type (http or
> httpS)?
> > > > > > Tried
> > > > > > > out
> > > > > > > $HTTP_SERVER_VARS.
> > > > > >
> > > > > > $_SERVER['HTTPS'] will be set if it's over HTTPS.
> > > > > >
> > > > > > ---John W. Holmes...
> > > > > >
> > > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your
> > > copy
> > > > > > today. http://www.phparch.com/
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
For sure, and this port changes every time I make a new request.

Alex

"Rasmus Lerdorf" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> No, the destination port will not change.  You must be looking at the
> source port.
>
> -Rasmus
>
> On Sat, 5 Apr 2003, Alexander Weber wrote:
>
> > So far so good, the next problem is now, that the port changes with
every
> > new request. Tried this on my "personal" server an my hoster's one.
> >
> > Perhaps there is another way? JScript, xml or anything other?
> >
> > Thanx so far,
> >
> > Alex
> >
> >
> > "Rasmus Lerdorf" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > news:[EMAIL PROTECTED]
> > > Presumably you know the HTTPS port on your server.  Anything not SSL
is
> > > going to be straight HTTP.  The point here is that SSL happens a layer
> > > below PHP.  PHP doesn't care whether it is running over SSL or not.
In
> > > fact it has no idea what transport layer is below it.  So your only
way to
> > > tell is to depend on whatever the web server tells you.  Look at a
> > > phpinfo() for both an SSL and a non-SSL request and see what the
> > > differences are on your server.  For me, checking SERVER_PORT has been
the
> > > most portable/reliable mechanism.
> > >
> > > -Rasmus
> > >
> > >
> > >
> > > On Sat, 5 Apr 2003, Alexander Weber wrote:
> > >
> > > > But SERVER PORT is not always 80 using HTTP (not HTTPS). So this way
is
> > not
> > > > really secure.
> > > >
> > > > Alex
> > > >
> > > > "Rasmus Lerdorf" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> > > > news:[EMAIL PROTECTED]
> > > > > I usually just use $_SERVER['SERVER_PORT']
> > > > >
> > > > > -Rasmus
> > > > >
> > > > > On Sat, 5 Apr 2003, Alexander Weber wrote:
> > > > >
> > > > > > Unfortunally is not set. It's like the variable does not exist,
> > because
> > > > when
> > > > > > I extract the varaible $_SERVER with foreach I don't get HTTPS
as
> > key,
> > > > only
> > > > > > SERVER_PROTOCOL.
> > > > > >
> > > > > > I'm using PHP 4.3.1 as Apache2 Module on Win2k SP3.
> > > > > > register_globals OFF
> > > > > > safe:mode OFF
> > > > > >
> > > > > > stunnel 4.04 on x86-pc-mingw32-gnu WIN32 with OpenSSL 0.9.7 31
Dec
> > 2002
> > > > > >
> > > > > > If you need more info:
> > > > > >
> > > > > > ICQ 46858764.
> > > > > >
> > > > > > Thanx
> > > > > >
> > > > > > Alex
> > > > > >
> > > > > > "John W. Holmes" <[EMAIL PROTECTED]> schrieb im
Newsbeitrag
> > > > > > news:[EMAIL PROTECTED]
> > > > > > > > anybody knows how to find out the connection type (http or
> > httpS)?
> > > > > > > Tried
> > > > > > > > out
> > > > > > > > $HTTP_SERVER_VARS.
> > > > > > >
> > > > > > > $_SERVER['HTTPS'] will be set if it's over HTTPS.
> > > > > > >
> > > > > > > ---John W. Holmes...
> > > > > > >
> > > > > > > PHP Architect - A monthly magazine for PHP Professionals. Get
your
> > > > copy
> > > > > > > today. http://www.phparch.com/
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >



--- End Message ---
--- Begin Message ---
Tell us more about your script please.

Cheers, Alex


"Dhaval" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi All,
>
> I m trying to build a drop down dynamically. I m quering fields from MSSQL
> 2000 Server. Now look wat is happning when i run my php from a Win2K PC
and
> from a Linux Box.
>
> Linux Machine
> ABIDA PARVEEN
> AHMED HUSSAIN MOHD.HUSSAIN
> AHMED HUSSAIN,MOHAMMED HUSSAIN
> ANWAR USSAI
> ARVINDER SINGHOHAMMED HUSSA
> ASHA BHOSLEGHOHAMMED
> ASHA BHOSLE ,GHULAM ALIUSSAN
> ASHA BHOSLE,GHULAM ALIUSSAN
> ASHOK KHOSLAHULAM ALI
> ASHOK KHOSLA,SUMITA CHAKRABORTY SAME
> BEGUM AKHTAR UMITA CHAKRA
> BHUPINDER SINGHITA CHAKRAORT
> BHUPINDER SINGH, MITHALEE SINGHSAME
> BHUPINDER SINGH,MITALEEE SINGHSAME
> C.H. ATMASINGH,MI
> C.H.ATMASINGH,
> CHHAYA GANGULI,IALEEE SI
> CHITRA SINGHI,IALEE
> CHITRA SINGH,JAGJIT SINGHSIGHSAME
> DILRAAJ KAURJAGJIT SING
>
>
> Win 2K Server
>
> ABIDA PARVEEN
> AHMED HUSSAIN MOHD.HUSSAIN
> AHMED HUSSAIN,MOHAMMED HUSSAIN
> ANWAR
> ARVINDER SINGH
> ASHA BHOSLE
> ASHA BHOSLE ,GHULAM ALI
> ASHA BHOSLE,GHULAM ALI
> ASHOK KHOSLA
> ASHOK KHOSLA,SUMITA CHAKRABORTY SAME
> BEGUM AKHTAR
> BHUPINDER SINGH
> BHUPINDER SINGH, MITHALEE SINGH
> BHUPINDER SINGH,MITALEE
> C.H. ATMA
> C.H.ATMA
> CHHAYA GANGULI
> CHITRA SINGH
> CHITRA SINGH,JAGJIT SINGH
> DILRAAJ KAUR
>
>
> Values are getting cat after the original value. Can any one help in this.
> I have tried using both sybase and mssql functions the results are the
same.
>
>
>
>
> Regards
> Dhaval
>
>
>



--- End Message ---
--- Begin Message ---
Wow you guys are going about that way more complicated than it needs to
be:

$i = 0;
echo "<TR BGCOLOR='#". (($i++ % 2 == 0) ? "'E3E3E3" : "FFFFFF") ."'>";

Then it just alternates and takes care of itself (plus you get a nice
little index counter as well  as a bonus if you want to use $i 

DÆVID.

"A good friend will come and bail you out of jail...but a true friend
will be sitting next to you in the holding cell, laughing and saying
-'That was fucking awesome!'" 

> -----Original Message-----
> From: Bobby Rahman [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, April 05, 2003 2:09 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] RE: newbie alternate row colours in dynamic table
> 
> 
> 
> 
> Hiya people
> 
> After a lot of soul searching, exploring the web and help 
> from many people I 
> came up with this simple solution:
> 
> Thank you Chris for explaining the toggle $colorset. In the 
> end I decided 
> this made life alot simplier.
> 
> (clearly the brackets have to be correctly aligned)
> 
> while( $row = mysql_fetch_array($db_result) )
> {
> echo("
>      <tr $c>
>      <td>" . $row['bugid'] . "</td>
>      </tr>
>      ");
> if ( !isset($c) )
> {
> $c = "bgcolor=#9999FF";
> echo $c;
> }
> else
> {
> unset($c);
> }
> }
> 
> 
> 
> 
> >From: Chris Hayes <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: Re: [PHP] RE: newbie alternate row colours in dynamic table
> >Date: Sat, 05 Apr 2003 22:32:17 +0200
> >
> >At 22:14 5-4-2003, you wrote:
> >
> >
> >>Hiya I have a dynamic table and am trying to get the rows to be two 
> >>different alternate colours. well Ive looked at a couple of 
> snippets of 
> >>this colour code and previous mails regarding this. Im having major 
> >>troubles intergrating any of these suggestions with my 
> code. Can anyone 
> >>suggest where I am going wrong. Main problems are
> >>1. where to put the loop for changing the colour 
> (complicated due to the 
> >>loop retrieving data from db)i.e in the do loop....in the 
> while loop?
> >Within the loop that prints the rows, whcih is usually a 
> while loop. But 
> >that depends on your preferences.
> >
> >
> >>2. Also how to echo my rows in the colours.(something like 
> this I think)
> >>print "<tr bgcolor='$trcolor'>"$db_fetch['bugid']; ?></td>;
> >>
> >>
> >>e.g here is the code snippet for alternate coloured rows
> >>$trcolor="#F0F8FF";
> >>while ($myrow = mysql_fetch_array($result)){
> >>$colorset=0;
> >>if ($trcolor=='#F0F8FF'){
> >>$trcolor='#B0C4DE';
> >>$colorset=1;
> >>}
> >>if ($colorset==0){
> >>if ($trcolor=='#B0C4DE'){
> >>$trcolor='#F0F8FF';}
> >>}
> >>print "<tr bgcolor='$trcolor'>";
> >>}
> >I see that you are using a helping variable $colorset.
> >I have a problem reading your code in email, as i do not see 
> hte indents 
> >well, so i restructure it here with _ underscores to make 
> the indents 
> >survive the email program.
> >
> >
> >$trcolor="#F0F8FF";             //1
> >
> >while ($myrow = mysql_fetch_array($result))
> >{
> >___$colorset=0;
> >___if ($trcolor=='#F0F8FF')    //1
> >___{$trcolor='#B0C4DE'; //2
> >____$colorset=1;
> >___}
> >
> >___if ($colorset==0)
> >___{ if ($trcolor=='#B0C4DE')   //2
> >______{$trcolor='#F0F8FF';       //1
> >______}
> >___}
> >
> >print "<tr bgcolor='$trcolor'>";
> >}
> >
> >Lets walk through.
> >In the 1st walk,
> >1a) you enter with color#1 and colorset=0.
> >2b) the first 'if' then sets it to color#2 and colorset=1
> >3c) The second if sees that both conditions are true and set 
> the color back 
> >to color#1.
> >
> >So the first row prints color1.
> >
> >Ok. The code remembers the values, which are color#1 and colorset1.
> >In the next walkthrough,
> >2a) the colorset is set to 0 to start with.
> >At this moment you have the exact situation as with 1a).
> >
> >do you see that? it would be much easier to see what is 
> happening if you 
> >would have only colorset toggling its value and just before 
> printing, 
> >decide what the color is as a result of the value of colorset.
> >Give it a try!
> >
> >Basically:
> >
> >$colorset=0;
> >
> >while (....)
> >{ toggle collorset (toggle: if 1 then 0 and opposite)
> >  if colorser=0 color=ffffff else color=aaaaa
> >  print color.
> >}
> >
> >Chris Hayes
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> 
> _________________________________________________________________
> Surf together with new Shared Browsing 
> http://join.msn.com/?page=features/browse&pgmarket=en-gb&XAPID
> =74&DI=1059
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
At 00:42 6-4-2003, you wrote:
Wow you guys are going about that way more complicated than it needs to
be:

$i = 0;
echo "<TR BGCOLOR='#". (($i++ % 2 == 0) ? "'E3E3E3" : "FFFFFF") ."'>";

Then it just alternates and takes care of itself (plus you get a nice
little index counter as well  as a bonus if you want to use $i

DÆVID.

Or in my belief even faster, (without the bonus):


$i = TRUE;
{$i=!$i;
 echo "<TR BGCOLOR='#". (($i) ? "'E3E3E3" : "FFFFFF") ."'>";
}


Since your code has these steps: 1. increment $i 2. divide $i by 2 and keep the remains 3. compare remains with 0 4. make the true/false decision

And the TRUE type:
1. toggle boolean
4. make the true/false decision








--- End Message ---
--- Begin Message ---
On 05-Apr-2003 Bobby Rahman wrote:
> 
> 
> Hiya people
> 
> After a lot of soul searching, exploring the web and help from many
> people I 
> came up with this simple solution:
> 

Okey-doke. simple is in the eye of the beholder.

    $bgcolor = ($bgcolor == '#E3E8F0' ? '#C7D0E2' : '#E3E8F0');

<snip>

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

--- End Message ---
--- Begin Message --- There NEEDS to be a manual page for this! PHP is SERVER-SIDE! That means that once the page loads (actually, a little before that), PHP is done. IT DOES NOT KEEP RUNNING! IT RUNS ON THE SERVER'S MACHINE, NOT THE CLIENT! RTFA!

Shantenese Williams wrote:

Does anyone know if there is a function in PHP that allows you to
right-click on an item, and from there a drop down menu pops
up and you can go to another screen, preserving that value that was
clicked on?



If there is no function for right-clicking, then is there a way that
when you are selecting something, not on a form, but in a tree,
that you can get the value of what you clicked on into the PHP file?

Thanks





-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.




--- End Message ---
--- Begin Message ---
man chill out , message me off list and i can give you a jscript example , as 
the description says , "hypertext processor", i dont think jscript even html 
is OT !
>===== Original Message From Leif K-Brooks <[EMAIL PROTECTED]> =====
>There NEEDS to be a manual page for this!  PHP is SERVER-SIDE!  That
>means that once the page loads (actually, a little before that), PHP is
>done.  IT DOES NOT KEEP RUNNING!  IT RUNS ON THE SERVER'S MACHINE, NOT
>THE CLIENT!  RTFA!
>
>Shantenese Williams wrote:
>
>>Does anyone know if there is a function in PHP that allows you to
>>right-click on an item, and from there a drop down menu pops
>>up and you can go to another screen, preserving that value that was
>>clicked on?
>>
>>
>>
>>If there is no function for right-clicking, then is there a way that
>>when you are selecting something, not on a form, but in a tree,
>>that you can get the value of what you clicked on into the PHP file?
>>
>>Thanks
>>
>>
>>
>>
>
>--
>The above message is encrypted with double rot13 encoding.  Any unauthorized 
attempt to decrypt it will be prosecuted to the full extent of the law.
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message --- OF COURSE IT'S OT! The name is PHP: hypertext PREprocessor! This is a list for PHP, not HTML, javascript, or house decorating!

daniel wrote:

man chill out , message me off list and i can give you a jscript example , as the description says , "hypertext processor", i dont think jscript even html is OT !


===== Original Message From Leif K-Brooks <[EMAIL PROTECTED]> =====
There NEEDS to be a manual page for this!  PHP is SERVER-SIDE!  That
means that once the page loads (actually, a little before that), PHP is
done.  IT DOES NOT KEEP RUNNING!  IT RUNS ON THE SERVER'S MACHINE, NOT
THE CLIENT!  RTFA!

Shantenese Williams wrote:



Does anyone know if there is a function in PHP that allows you to
right-click on an item, and from there a drop down menu pops
up and you can go to another screen, preserving that value that was
clicked on?



If there is no function for right-clicking, then is there a way that
when you are selecting something, not on a form, but in a tree,
that you can get the value of what you clicked on into the PHP file?

Thanks






--
The above message is encrypted with double rot13 encoding. Any unauthorized


attempt to decrypt it will be prosecuted to the full extent of the law.




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








-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



--- End Message ---
--- Begin Message ---
Does anyone know of a prefix convention used for PHP? What I'm talking about is using 
a type of Hungarian notation for PHP variables. I know they use 'g', 'm', and 'r' for 
global, method and reference variables but for other variable types. I get confused 
once and a while, while I am coding and want to make things clearer than mud...

Just a thought...

Robin Kopetzky
Black Mesa Computers/Internet Services


--- End Message ---
--- Begin Message --- At 01:12 6-4-2003, you wrote:
Does anyone know of a prefix convention used for PHP? What I'm talking about is using a type of Hungarian notation for PHP variables. I know they use 'g', 'm', and 'r' for global, method and reference variables but for other variable types. I get confused once and a while, while I am coding and want to make things clearer than mud...

In a nutshell: it is entirely up to you.


There are some coding standards out there, but there is not such as thing as The Standard. You might be interested in reading
http://pear.php.net/manual/en/standards.php (coding standards) with as a paragraph of it http://pear.php.net/manual/en/standards.naming.php (naming conventions, but as far as i see it does not go much further than
$_UNDERSCORE_WITH_CAPITALS means it is global. )


or another site:
http://utvikler.start.no/code/php_coding_standard.html#stacknames.

I can see the use of such conventions especially when you are working in a group.

And when you are combining several applications, it is very usefull if the global variables are called $APP1_name and $APP2_name in stead of both being called $name.... That's why module developers in the nuketype CMSes are asked not to use globals and if they must, use reserved prefixes.


In VBA conventions are much stricter, and go a bit in your direction, e.g. strname would be a string variable. I found some sites, http://www.triadconsulting.com/Resources/Reddick.htm and http://www.mvps.org/access/general/gen0012.htm, that list their standards.





Chris







--- End Message ---
--- Begin Message ---
I had to know... ;-)

Output:

version one:    0.56761503219604 seconds
version two:    0.3099730014801 seconds
version three:  0.36320495605469 secondss

So the boolean (V2)is faster:

Mine is slightly slower by a 'smidge' (0.06 seconds)

Top one is cleanest but slower.

--- test ---

<?php
function getmicrotime(){ 
    list($usec, $sec) = explode(" ",microtime()); 
    return ((float)$usec + (float)$sec); 
} 

$ITERATIONS = 100000;

$time_start = getmicrotime();
for ($i = 1; $i < $ITERATIONS; $i++)
{
        $bgcolor = ($bgcolor == '#E3E8F0') ? '#C7D0E2' : '#E3E8F0';
}
$time_end = getmicrotime();
$time1 = $time_end - $time_start;
echo "version one: \t$time1 seconds<P>\n";

$time_start = getmicrotime();
$tf = TRUE;
for ($i = 1; $i < $ITERATIONS; $i++)
{
        $tf=!$tf;
        ($tf) ? "'C7D0E2" : "E3E8F0";
}
$time_end = getmicrotime();
$time2 = $time_end - $time_start;
echo "version two: \t$time2 seconds<P>\n";

$time_start = getmicrotime();
$r = 0;
for ($i = 1; $i < $ITERATIONS; $i++)
{
        (($r++ % 2 == 0) ? "'C7D0E2" : "E3E8F0");
}
$time_end = getmicrotime();
$time3 = $time_end - $time_start;
echo "version three: \t$time3 seconds<P>\n";
?>


--- End Message ---
--- Begin Message ---
If you really want to be optimal, use bitwise instead 
of modulus :)  And ++$i instead of $i++ :)  And,
use single not double quotes :)  Silly, but true.

  http://www.faqts.com/knowledge_base/view.phtml/aid/783/fid/9

And, write less code, so:
  
  $bgcolor = (++$i & 1) ? '#ffffff' : '#eeeeee';

Regards,
Philip


On Sat, 5 Apr 2003, Daevid Vincent wrote:

> I had to know... ;-)
> 
> Output:
> 
> version one:  0.56761503219604 seconds
> version two:  0.3099730014801 seconds
> version three:        0.36320495605469 secondss
> 
> So the boolean (V2)is faster:
> 
> Mine is slightly slower by a 'smidge' (0.06 seconds)
> 
> Top one is cleanest but slower.
> 
> --- test ---
> 
> <?php
> function getmicrotime(){ 
>     list($usec, $sec) = explode(" ",microtime()); 
>     return ((float)$usec + (float)$sec); 
> } 
> 
> $ITERATIONS = 100000;
> 
> $time_start = getmicrotime();
> for ($i = 1; $i < $ITERATIONS; $i++)
> {
>       $bgcolor = ($bgcolor == '#E3E8F0') ? '#C7D0E2' : '#E3E8F0';
> }
> $time_end = getmicrotime();
> $time1 = $time_end - $time_start;
> echo "version one: \t$time1 seconds<P>\n";
> 
> $time_start = getmicrotime();
> $tf = TRUE;
> for ($i = 1; $i < $ITERATIONS; $i++)
> {
>       $tf=!$tf;
>       ($tf) ? "'C7D0E2" : "E3E8F0";
> }
> $time_end = getmicrotime();
> $time2 = $time_end - $time_start;
> echo "version two: \t$time2 seconds<P>\n";
> 
> $time_start = getmicrotime();
> $r = 0;
> for ($i = 1; $i < $ITERATIONS; $i++)
> {
>       (($r++ % 2 == 0) ? "'C7D0E2" : "E3E8F0");
> }
> $time_end = getmicrotime();
> $time3 = $time_end - $time_start;
> echo "version three: \t$time3 seconds<P>\n";
> ?>
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
Darn you Phillip! ;) I was just about to post that. Also, since we're
being picky, you should also assign the result to $bgcolor in each of
your tests like you are the first one, instead of just testing a
condition. Here are the results with the fourth method that Phillip
mentioned (along with single quotes, etc, to make each test the same):

version one: 0.400743961334 seconds
version two: 0.331864953041 seconds
version three: 0.322684049606 seconds
version four: 0.293377041817 seconds

There's really not much a difference between any of them. Use the one
you understand.

Complete _new_ code included below.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

<?php
function getmicrotime(){ 
    list($usec, $sec) = explode(" ",microtime()); 
    return ((float)$usec + (float)$sec); 
} 

$ITERATIONS = 100000;

//METHOD ONE
$time_start1 = getmicrotime();
$bgcolor = '';
for ($i = 1; $i < $ITERATIONS; $i++)
{
    $bgcolor = ($bgcolor == '#E3E8F0') ? '#C7D0E2' : '#E3E8F0';
}
$time_end1 = getmicrotime();
$time1 = $time_end1 - $time_start1;
echo "version one: \t$time1 seconds<P>\n";

//METHOD TWO
$time_start2 = getmicrotime();
$tf = TRUE;
for ($i = 1; $i < $ITERATIONS; $i++)
{
    $tf=!$tf;
    $bgcolor = ($tf) ? '#C7D0E2' : '#E3E8F0';
}
$time_end2 = getmicrotime();
$time2 = $time_end2 - $time_start2;
echo "version two: \t$time2 seconds<P>\n";

//METHOD THREE
$time_start3 = getmicrotime();
$r = 0;
for ($i = 1; $i < $ITERATIONS; $i++)
{
    $bgcolor = (($r++ % 2 == 0) ? '#C7D0E2' : '#E3E8F0');
}
$time_end3 = getmicrotime();
$time3 = $time_end3 - $time_start3;
echo "version three: \t$time3 seconds<P>\n";

//METHOD FOUR
$time_start4 = getmicrotime();
$z = 0;
for ($i = 1; $i < $ITERATIONS; $i++)
{
    $bgcolor = ((++$z & 1) ? '#C7D0E2' : '#E3E8F0');
}
$time_end4 = getmicrotime();
$time4 = $time_end4 - $time_start4;
echo "version four: \t$time4 seconds<p>\n";
    
?>


> -----Original Message-----
> From: Philip Olson [mailto:[EMAIL PROTECTED]
> Sent: Saturday, April 05, 2003 7:42 PM
> To: Daevid Vincent
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] RE: newbie alternate row colours in dynamic table
--
> timed tests
> 
> 
> If you really want to be optimal, use bitwise instead
> of modulus :)  And ++$i instead of $i++ :)  And,
> use single not double quotes :)  Silly, but true.
> 
>   http://www.faqts.com/knowledge_base/view.phtml/aid/783/fid/9
> 
> And, write less code, so:
> 
>   $bgcolor = (++$i & 1) ? '#ffffff' : '#eeeeee';
> 
> Regards,
> Philip
> 
> 
> On Sat, 5 Apr 2003, Daevid Vincent wrote:
> 
> > I had to know... ;-)
> >
> > Output:
> >
> > version one:        0.56761503219604 seconds
> > version two:        0.3099730014801 seconds
> > version three:      0.36320495605469 secondss
> >
> > So the boolean (V2)is faster:
> >
> > Mine is slightly slower by a 'smidge' (0.06 seconds)
> >
> > Top one is cleanest but slower.
> >
> > --- test ---
> >
> > <?php
> > function getmicrotime(){
> >     list($usec, $sec) = explode(" ",microtime());
> >     return ((float)$usec + (float)$sec);
> > }
> >
> > $ITERATIONS = 100000;
> >
> > $time_start = getmicrotime();
> > for ($i = 1; $i < $ITERATIONS; $i++)
> > {
> >     $bgcolor = ($bgcolor == '#E3E8F0') ? '#C7D0E2' : '#E3E8F0';
> > }
> > $time_end = getmicrotime();
> > $time1 = $time_end - $time_start;
> > echo "version one: \t$time1 seconds<P>\n";
> >
> > $time_start = getmicrotime();
> > $tf = TRUE;
> > for ($i = 1; $i < $ITERATIONS; $i++)
> > {
> >     $tf=!$tf;
> >     ($tf) ? "'C7D0E2" : "E3E8F0";
> > }
> > $time_end = getmicrotime();
> > $time2 = $time_end - $time_start;
> > echo "version two: \t$time2 seconds<P>\n";
> >
> > $time_start = getmicrotime();
> > $r = 0;
> > for ($i = 1; $i < $ITERATIONS; $i++)
> > {
> >     (($r++ % 2 == 0) ? "'C7D0E2" : "E3E8F0");
> > }
> > $time_end = getmicrotime();
> > $time3 = $time_end - $time_start;
> > echo "version three: \t$time3 seconds<P>\n";
> > ?>
> >
> >
> > --
> > 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 --- When accessing a page called "Create Users", it checks that the user doing just that is properly logged in--this is part of the admin section of the site, not the public end. If not, it sends one to a page created by "login.php". There one is met by instructions to type in a username and password, then press a button labeled "Login". Upon pressing the latter, a box lowers from the top of the screen; it contains the instruction to select a username from a list [of all the usernames I'd previously used in the books earlier exercise]. When I choose one, it and a password appear in the appropriate fields. I then press "Login" again and the process repeats--i.e., the fields are cleared and the box lowers from above with the instructions to type in a username and password, then press a button labeled "Login".

I'm using Netscape 7, and when I go to Tools --> Password Manager --> Manage Stored Passwords and clear the stored passwords, I am no closer to anything working. In fact, after pressing the login button after filling in the username and password fields produces nothing at all until I try a few times and some usernames accumulate and thereby send the window down from the top of the screen.

Would anyone be willing to take a look at the coupla files to see if I've messed up the code?

Thank you.

Steve Tiano


--- End Message ---
--- Begin Message ---
It seems that it makes almost no difference if you switch in and out of
the parser or stay within it...
Does this seem like a fair test? Having said that, I would suggest
always using the first method as it's much cleaner to read and color
coding works in most editors.

-- output ---

version one:    0.098537087440491 seconds
version two:    0.096035003662109 seconds

--- test ---

<?php
function getmicrotime(){ 
    list($usec, $sec) = explode(" ",microtime()); 
    return ((float)$usec + (float)$sec); 
} 

$ITERATIONS = 10000;

$time_start = getmicrotime();
for ($i = 1; $i < $ITERATIONS; $i++)
{
        ?>
        blah <?=$i?>
        <?php
}
$time_end = getmicrotime();
$time1 = $time_end - $time_start;

$time_start = getmicrotime();
$tf = TRUE;
for ($i = 1; $i < $ITERATIONS; $i++)
{
        echo "blah ".$i."\n";
}
$time_end = getmicrotime();
$time2 = $time_end - $time_start;

echo "<P>version one: \t$time1 seconds<P>\n";
echo "version two: \t$time2 seconds<P>\n";
?>



--- End Message ---
--- Begin Message ---
here is the trick the solaris guy showed me , i've intergrated it into a 
webpage for showing the results

time php somebenchmark.php > /dev/null time will show u the results of the 
compiling , the microtime version has to allow time for running through apache 
:)
>===== Original Message From "Daevid Vincent" <[EMAIL PROTECTED]> =====
>It seems that it makes almost no difference if you switch in and out of
>the parser or stay within it...
>Does this seem like a fair test? Having said that, I would suggest
>always using the first method as it's much cleaner to read and color
>coding works in most editors.
>
>-- output ---
>
>version one:   0.098537087440491 seconds
>version two:   0.096035003662109 seconds
>
>--- test ---
>
><?php
>function getmicrotime(){
>    list($usec, $sec) = explode(" ",microtime());
>    return ((float)$usec + (float)$sec);
>}
>
>$ITERATIONS = 10000;
>
>$time_start = getmicrotime();
>for ($i = 1; $i < $ITERATIONS; $i++)
>{
>       ?>
>       blah <?=$i?>
>       <?php
>}
>$time_end = getmicrotime();
>$time1 = $time_end - $time_start;
>
>$time_start = getmicrotime();
>$tf = TRUE;
>for ($i = 1; $i < $ITERATIONS; $i++)
>{
>       echo "blah ".$i."\n";
>}
>$time_end = getmicrotime();
>$time2 = $time_end - $time_start;
>
>echo "<P>version one: \t$time1 seconds<P>\n";
>echo "version two: \t$time2 seconds<P>\n";
>?>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php



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

So I'm working on a CMS that has the ability to move pages from one
category to another, and whole sub-categories (and all their pages) to a
different categories. I have a file that defines the hierarchy of the
menu:

.|Something
..|sub-something
..|sub-something else
.|something -else
..|sub-something-else
...|etc.
.|else-something
..|it's children

the ones with 1 dot are 1st level, 2 dots, second level, and so on...
the menu is defined in order that it is shown (it doesn't check each
item, it just replaces the periods with the correct items). So if I
wanted to move, say, "something -else" under "sub-something else" (the
child of "Something") and all the stuff under it without affecting
else-something and it's children how could I move it in the text file?

Sorry if I don't make sense. Please ask for clarification if you need.
My other question is if there is an easier way to do this? With a
database or something? I would still need to output a file with the same
format from that for my menu...

Thanks in advance.

-Michael
-- 
Mike <[EMAIL PROTECTED]>


--- End Message ---
--- Begin Message --- Mike wrote:
Hi,

So I'm working on a CMS that has the ability to move pages from one
category to another, and whole sub-categories (and all their pages) to a
different categories. I have a file that defines the hierarchy of the
menu:

.|Something
..|sub-something
..|sub-something else
.|something -else
..|sub-something-else
...|etc.
.|else-something
..|it's children

[ snip ]

I think if you were to change you menu definition file to XML, it would make this a lot easier. Then you can use the domxml functions to grab your parent/child relationships.


-- Burhan Khalid phplist[at]meidomus[dot]com



--- End Message ---
--- Begin Message ---
Hi all, how can I combine this line to use just 1 echo statement?

echo "Name: "; echo $_POST['name']

Am I being too picky here?

Thanks,
-- 
David M.
Edification Web Solutions
http://www.edificationweb.com

--- End Message ---
--- Begin Message ---
> Hi all, how can I combine this line to use just 1 echo statement?
> 
> echo "Name: "; echo $_POST['name']

The period is used for string concatenation:

echo "Name: " . $_POST['name'];

Many ways you can do it:

echo "Name: {$_POST['name']}";
echo 'Name: ' . $_POST['name'];
echo "Name: $_POST[name]";
echo 'Name: ' . $_POST["name"];
etc...

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message ---
On 06-Apr-2003 David McGlone wrote:
> Hi all, how can I combine this line to use just 1 echo statement?
> 
> echo "Name: "; echo $_POST['name']
> 

echo 'Name: ', $_POST['name'];

-or-

echo 'Name: ' .$_POST['name'];


Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

--- End Message ---
--- Begin Message ---
On Saturday 05 April 2003 08:00 pm, John W. Holmes wrote:
> > Hi all, how can I combine this line to use just 1 echo statement?
> >
> > echo "Name: "; echo $_POST['name']
>
> The period is used for string concatenation:
>
> echo "Name: " . $_POST['name'];
>
> Many ways you can do it:
>
> echo "Name: {$_POST['name']}";
> echo 'Name: ' . $_POST['name'];
> echo "Name: $_POST[name]";
> echo 'Name: ' . $_POST["name"];
> etc...

Thank you all for the quick response. I was using this method and now I 
finally see my error which was I forgot to put the " . " before " $_POST"

As you all can see, im relativly new to PHP and I think I'll thank you all for 
putting up with me now instead of later.. : - )
-- 
David M.
Edification Web Solutions
http://www.edificationweb.com

--- End Message ---
--- Begin Message ---
you also really don't need single quotes in the $_POST...

echo "Name: $_POST[name]";

.. should work.

cheers,
- Sebastian


----- Original Message ----- 
From: "Don Read" <[EMAIL PROTECTED]>


| 
| On 06-Apr-2003 David McGlone wrote:
| > Hi all, how can I combine this line to use just 1 echo statement?
| > 
| > echo "Name: "; echo $_POST['name']
| > 
| 
| echo 'Name: ', $_POST['name'];
| 
| -or-
| 
| echo 'Name: ' .$_POST['name'];
| 
| 
| Regards,
| -- 
| Don Read                                       [EMAIL PROTECTED]
| -- It's always darkest before the dawn. So if you are going to 
|    steal the neighbor's newspaper, that's the time to do it.
| 
| -- 
| PHP General Mailing List (http://www.php.net/)
| To unsubscribe, visit: http://www.php.net/unsub.php
| 


--- End Message ---
--- Begin Message ---
> you also really don't need single quotes in the $_POST...

(if the variable is within a string delimited by _double_ quotes)
 
> echo "Name: $_POST[name]";
> 
> .. should work.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message --- Ajay Lal wrote:
 Can you please spend some time with my doubt...
 My query is that ...
 Is there any option or function in PHP to implement
 automatic updation of web pages with the latest
 contents from other sites. Like news from news sites etc.
 Or do you have any idea about doing it.
 Thank you for spending your valuable time for me
 Expecting your helpful reply


Ajay :


There are a few ways to go about this :

1. Use cURL to read the pages and their relevant data, parse it, and stick it on your site.

2. If the site that you want has an RSS/RDF feed, PHP can parse that information using the xml/rss functions.

3. If you are on a unix box, you can copy a page on that site, and then at an iterval copy another page, and run diff on it to see if it changes (this is the most rediculous way of doing it, but I have seen it done).


-- Burhan Khalid phplist[at]meidomus[dot]com



--- End Message ---
--- Begin Message ---
Hello, I wrote the code for deleting the oldest string in the mysql if
it reaches over 15 strings, but it works only under 4.x.x series of MySQL and i have
3.x.x. What should I change in the code that it would work under 3.x.x
version of MySQL? Here`s the code:


$quer = "SELECT COUNT(id) FROM logai";
$rez = mysql_query($quer);
$sk = mysql_result($rez,0);
    if ( $sk > 15 ) {
      $wad = $sk - 15;
      $queryz = "DELETE FROM logai WHERE id <> 'a nu nakuj' ORDER BY id LIMIT $wad";
      mysql_query($queryz);
    }*/



                Thank You. Sorry for my bad english :-(



--- End Message ---
--- Begin Message ---
Hey all, the next code i wrote is for deleting users who don`t login
for 60 days. This script should work under 4.x.x series of MySQL DB,
but i have 3.x.x version. What should i change in this code that it
should work on 3.x.x version of MySQL. ( time is given as a timestamp
( saved as time() in mysql ) ).

The Code:

$GLOBALS['data'] = date ("Y-m-d",$timelt);
$GLOBALS['laik'] = date("H:i:s",$timelt);
$queriz = "SELECT vartotojas, laikas FROM useriai WHERE (CAST(UNIX_TIMESTAMP(NOW()) AS 
SIGNED) - CAST(UNIX_TIMESTAMP(laikas) AS SIGNED))>5184000 AND admin != '1'";
$rezult = mysql_query($queriz);
if (mysql_num_rows($rezult) != 0) {
      while ($row2 = mysql_fetch_array($rezult)) {
           $ka = $row2['vartotojas'];
           $query = "INSERT INTO logai SET kas='SISTEMA', ka='$ka', 
data='$GLOBALS[data]', laikas='$GLOBALS[laik]'";
           echo mysql_error();
           mysql_query($query);
           $delete = "DELETE FROM useriai WHERE (CAST(UNIX_TIMESTAMP(NOW()) AS SIGNED) 
- CAST(UNIX_TIMESTAMP(laikas) AS SIGNED))>5184000 AND admin != '1'";
           $del = mysql_query($delete);
      }
}


P.S. It Also add info to mysql db as logo who delete the user ;-)

Thanks if someone could help! NeXaS



--- End Message ---
--- Begin Message ---
You should be asking these questions on a MySQL list...

DELETE FROM table WHERE laikas < NOW() - INTERVAL 60 DAY AND admin != 1

Works on MySQL 3 and 4. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

> -----Original Message-----
> From: NeXaS [mailto:[EMAIL PROTECTED]
> Sent: Saturday, April 05, 2003 10:37 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Another problem with mysql version coding
> 
> Hey all, the next code i wrote is for deleting users who don`t login
> for 60 days. This script should work under 4.x.x series of MySQL DB,
> but i have 3.x.x version. What should i change in this code that it
> should work on 3.x.x version of MySQL. ( time is given as a timestamp
> ( saved as time() in mysql ) ).
> 
> The Code:
> 
> $GLOBALS['data'] = date ("Y-m-d",$timelt);
> $GLOBALS['laik'] = date("H:i:s",$timelt);
> $queriz = "SELECT vartotojas, laikas FROM useriai WHERE
> (CAST(UNIX_TIMESTAMP(NOW()) AS SIGNED) - CAST(UNIX_TIMESTAMP(laikas)
AS
> SIGNED))>5184000 AND admin != '1'";
> $rezult = mysql_query($queriz);
> if (mysql_num_rows($rezult) != 0) {
>       while ($row2 = mysql_fetch_array($rezult)) {
>            $ka = $row2['vartotojas'];
>            $query = "INSERT INTO logai SET kas='SISTEMA', ka='$ka',
> data='$GLOBALS[data]', laikas='$GLOBALS[laik]'";
>            echo mysql_error();
>            mysql_query($query);
>            $delete = "DELETE FROM useriai WHERE
> (CAST(UNIX_TIMESTAMP(NOW()) AS SIGNED) - CAST(UNIX_TIMESTAMP(laikas)
AS
> SIGNED))>5184000 AND admin != '1'";
>            $del = mysql_query($delete);
>       }
> }
> 
> 
> P.S. It Also add info to mysql db as logo who delete the user ;-)
> 
> Thanks if someone could help! NeXaS
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




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

I have a text blurb that is on the home page of a site. I need to make this block of text editable through a form in the admin section of the site. Is it worth having a table in the db or would I be better off writing to a file for this?

Thanks,
Charles


--- End Message ---
--- Begin Message ---
> I have a text blurb that is on the home page of a site. I need to make
> this block of text editable through a form in  the admin section of
the
> site. Is it worth having a table in the db or would I be better off
> writing to a file for this?

Just use a file. The only problem you'll have is if two people try to
edit the file at the same time, but it doesn't sound like that'll be an
issue. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--- End Message ---
--- Begin Message ---
I would like to remove duplicate array values, and I
presume that array_unique should do this, but the
results are not what I am expecting
Anyone see this before:
$dayarray=(9,22,22);
$duparray = array_unique($dayarray);
$darray = count($duparray);
for($d=0;$d<$darray;$d++){
  echo "$d: ".$duparray[$d]."<br>";
}
## returns:
0: 9
1: 
rather than
0: 9
1: 22

Is that what it is supposed to do? Does array_unique
remove all instances of duplicate values? 
If so, is there a way to remove every instance but the
first?
Thanks, 

gr





__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

--- End Message ---
--- Begin Message ---
I cut and pasted your code and it worked fine for me with PHP 4.3.0

(assuming the first line is really $dayarray = array(9,22,22); )

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/

> -----Original Message-----
> From: Greg Robillard [mailto:[EMAIL PROTECTED]
> Sent: Saturday, April 05, 2003 10:27 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] array_unique wierdness
> 
> I would like to remove duplicate array values, and I
> presume that array_unique should do this, but the
> results are not what I am expecting
> Anyone see this before:
> $dayarray=(9,22,22);
> $duparray = array_unique($dayarray);
> $darray = count($duparray);
> for($d=0;$d<$darray;$d++){
>   echo "$d: ".$duparray[$d]."<br>";
> }
> ## returns:
> 0: 9
> 1:
> rather than
> 0: 9
> 1: 22
> 
> Is that what it is supposed to do? Does array_unique
> remove all instances of duplicate values?
> If so, is there a way to remove every instance but the
> first?
> Thanks,
> 
> gr
> 
> 
> 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Tax Center - File online, calculators, forms, and more
> http://tax.yahoo.com
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




--- End Message ---
--- Begin Message ---
Oh yeah - I'm using Version 4.2.3 on Linux

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

--- End Message ---
--- Begin Message ---
<snip from "Andrew Brampton" [EMAIL PROTECTED]>
You can use getimagesize on a jpg file to read its size, so either
save the jpg in MySQL to a file and then do a getImageSize, or before you place the 
jpg in to the database read its size and store its dimensions with it in the db.
</>

I disagree with Andrew. In my humble opinion, I don't think you need to duplicate 
information. Before you decide, have a better viewing of the problem.
Not a good solution for me.
I know little about JPEG files, but I know they have a HEADER. This header may contain 
the value (binary, o' course) you need, and even more info than you think. :) So, 
search a for JPG file's spec before you continue. Very easy to find.
After you know about the files you work with, you have to know how to tell PHP to do 
what you want to do. I am not a good person to tell you that, as I am such a newbie to 
PHP. I can only tell that this would be "pisso chocka cake" in assembly. (VERY VERY 
easy =)

<snip from "Phil Schwarzmann" [EMAIL PROTECTED]>
I have JPG files stored as binary in a MySQL database.  I am
displaying the JPGs on the screen and also want to know the height (in pixels) of the 
JPG.
</>

Another solution would be if PHP *already* has integrated processing of JPG files, 
wich maybe true, judging by the intricate relation of PHP and internet, and JPG being 
this commom. I think a file extension wouldn't stand in the way (wich I think is what 
you, Phil, meant by "stored as binary" - no extension) Just check that.

Also, Phil, snipets of the code you use, help you and us much better.

Regards,

-- 
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup


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

Sunday, April 6, 2003, 2:51:36 PM, you wrote:
Dd> <snip from "Andrew Brampton" [EMAIL PROTECTED]>
Dd> You can use getimagesize on a jpg file to read its size, so either
Dd> save the jpg in MySQL to a file and then do a getImageSize, or before you place 
the jpg in to the database read its size and store its dimensions with it in the db.
Dd> </>

Dd> I disagree with Andrew. In my humble opinion, I don't think you need to duplicate 
information. Before you decide, have a better viewing of the problem.
Dd> Not a good solution for me.
Dd> I know little about JPEG files, but I know they have a HEADER. This header may 
contain the value (binary, o' course) you need, and even more info than you think. :) 
So, search a for JPG file's
Dd> spec before you continue. Very easy to find.
Dd> After you know about the files you work with, you have to know how to tell PHP to 
do what you want to do. I am not a good person to tell you that, as I am such a newbie 
to PHP. I can only tell
Dd> that this would be "pisso chocka cake" in assembly. (VERY VERY easy =)

Dd> <snip from "Phil Schwarzmann" [EMAIL PROTECTED]>
Dd> I have JPG files stored as binary in a MySQL database.  I am
Dd> displaying the JPGs on the screen and also want to know the height (in pixels) of 
the JPG.
Dd> </>

Dd> Another solution would be if PHP *already* has integrated processing of JPG files, 
wich maybe true, judging by the intricate relation of PHP and internet, and JPG being 
this commom. I think a
Dd> file extension wouldn't stand in the way (wich I think is what you, Phil, meant by 
"stored as binary" - no extension) Just check that.

Dd> Also, Phil, snipets of the code you use, help you and us much better.

Dd> Regards,

Dd> -- 
Dd> __________________________________________________________
Dd> Sign-up for your own FREE Personalized E-mail at Mail.com
Dd> http://www.mail.com/?sr=signup

You will find it much easier to store the size info at the time of upload than dicking 
around with
binary files. In fact I would store the whole serialized array that is returned by 
getimagesize()
so all info would be available later.

-- 
regards,
Tom


--- End Message ---
--- Begin Message ---
Great Opportunity for all group members!!!

Please Join its free!!! You will have $50 extra Bonuses and earnings 
only with sign up this progam.

Bonuses and Earnings:

A $50.00 sign-up bonus will be awarded to each new member of Platinum-
Mails. This bonus will become payable when the member has earned 
$200.00. A member will receive a $15.00 bonus for each new member who
joins Platinum-Mails through their referral link. This bonus will 
become payable when that new member has earned $200.00. It is real 

Limited number of new user will accepted. Good luck!!!

For join please visit:
http://platinum-mails.ebiz-enterprises.com/?r=chinmoy



---------------------------------
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more

--- End Message ---
--- Begin Message ---
<?php

  $user = "Chinmoy Barua [mailto:[EMAIL PROTECTED]";

  function spam-o-meter( $sender ) {
    return( is_real($sender) ? 'not spam' : 'spam' );
  }

  if( spam-o-meter($user) == 'spam' ) {
    echo "punt user!";
  }

?>

This sender is correct; this was a great opportunity for me to brush up
on some PHP programming and code analysis.  For example if we were to
study this simple script we'll discover that it will always return SPAM
and suggests that the user should be punted.


      
> -----Original Message-----
> From: Chinmoy Barua [mailto:[EMAIL PROTECTED]
> Sent: Sunday, April 06, 2003 1:43 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Great Opportunity for all group members!!!
> 
> 
> Great Opportunity for all group members!!!
> 
> Please Join its free!!! You will have $50 extra Bonuses and earnings
> only with sign up this progam.
> 
> Bonuses and Earnings:
> 
> A $50.00 sign-up bonus will be awarded to each new member of Platinum-
> Mails. This bonus will become payable when the member has earned
> $200.00. A member will receive a $15.00 bonus for each new member who
> joins Platinum-Mails through their referral link. This bonus will
> become payable when that new member has earned $200.00. It is real
> 
> Limited number of new user will accepted. Good luck!!!
> 
> For join please visit:
> http://platinum-mails.ebiz-enterprises.com/?r=chinmoy
> 
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Tax Center - File online, calculators, forms, and more
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.467 / Virus Database: 266 - Release Date: 4/1/2003
> 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.467 / Virus Database: 266 - Release Date: 4/1/2003
 


--- End Message ---
--- Begin Message ---
hehe. i should get me one of those ;)

cheers,
- Sebastian


----- Original Message ----- 
From: "Matt Giddings" <[EMAIL PROTECTED]>


| <?php
| 
|   $user = "Chinmoy Barua [mailto:[EMAIL PROTECTED]";
| 
|   function spam-o-meter( $sender ) {
|     return( is_real($sender) ? 'not spam' : 'spam' );
|   }
| 
|   if( spam-o-meter($user) == 'spam' ) {
|     echo "punt user!";
|   }
| 
| ?>
| 
| This sender is correct; this was a great opportunity for me to brush up
| on some PHP programming and code analysis.  For example if we were to
| study this simple script we'll discover that it will always return SPAM
| and suggests that the user should be punted.
| 
| 
|       
| > -----Original Message-----
| > From: Chinmoy Barua [mailto:[EMAIL PROTECTED]
| > Sent: Sunday, April 06, 2003 1:43 AM
| > To: [EMAIL PROTECTED]
| > Subject: [PHP] Great Opportunity for all group members!!!
| > 
| > 
| > Great Opportunity for all group members!!!
| > 
| > Please Join its free!!! You will have $50 extra Bonuses and earnings
| > only with sign up this progam.
| > 
| > Bonuses and Earnings:
| > 
| > A $50.00 sign-up bonus will be awarded to each new member of Platinum-
| > Mails. This bonus will become payable when the member has earned
| > $200.00. A member will receive a $15.00 bonus for each new member who
| > joins Platinum-Mails through their referral link. This bonus will
| > become payable when that new member has earned $200.00. It is real
| > 
| > Limited number of new user will accepted. Good luck!!!
| > 
| > For join please visit:
| > http://platinum-mails.ebiz-enterprises.com/?r=chinmoy
| > 
| > 
| > 
| > ---------------------------------
| > Do you Yahoo!?
| > Yahoo! Tax Center - File online, calculators, forms, and more
| > 
| > ---
| > Incoming mail is certified Virus Free.
| > Checked by AVG anti-virus system (http://www.grisoft.com).
| > Version: 6.0.467 / Virus Database: 266 - Release Date: 4/1/2003
| > 
| 
| ---
| Outgoing mail is certified Virus Free.
| Checked by AVG anti-virus system (http://www.grisoft.com).
| Version: 6.0.467 / Virus Database: 266 - Release Date: 4/1/2003
|  
| 
| 
| -- 
| PHP General Mailing List (http://www.php.net/)
| To unsubscribe, visit: http://www.php.net/unsub.php
| 


--- End Message ---
--- Begin Message ---
lol this would have to be the first i got from this list, i get dozens of 
korean spam everyday , the encoding is all wrong and all comes out is 
gibberish characters , how do i stop this ?
>===== Original Message From "Sebastian" <[EMAIL PROTECTED]> =====
>hehe. i should get me one of those ;)
>
>cheers,
>- Sebastian
>
>
>----- Original Message -----
>From: "Matt Giddings" <[EMAIL PROTECTED]>
>
>
>| <?php
>|
>|   $user = "Chinmoy Barua [mailto:[EMAIL PROTECTED]";
>|
>|   function spam-o-meter( $sender ) {
>|     return( is_real($sender) ? 'not spam' : 'spam' );
>|   }
>|
>|   if( spam-o-meter($user) == 'spam' ) {
>|     echo "punt user!";
>|   }
>|
>| ?>
>|
>| This sender is correct; this was a great opportunity for me to brush up
>| on some PHP programming and code analysis.  For example if we were to
>| study this simple script we'll discover that it will always return SPAM
>| and suggests that the user should be punted.
>|
>|
>|
>| > -----Original Message-----
>| > From: Chinmoy Barua [mailto:[EMAIL PROTECTED]
>| > Sent: Sunday, April 06, 2003 1:43 AM
>| > To: [EMAIL PROTECTED]
>| > Subject: [PHP] Great Opportunity for all group members!!!
>| >
>| >
>| > Great Opportunity for all group members!!!
>| >
>| > Please Join its free!!! You will have $50 extra Bonuses and earnings
>| > only with sign up this progam.
>| >
>| > Bonuses and Earnings:
>| >
>| > A $50.00 sign-up bonus will be awarded to each new member of Platinum-
>| > Mails. This bonus will become payable when the member has earned
>| > $200.00. A member will receive a $15.00 bonus for each new member who
>| > joins Platinum-Mails through their referral link. This bonus will
>| > become payable when that new member has earned $200.00. It is real
>| >
>| > Limited number of new user will accepted. Good luck!!!
>| >
>| > For join please visit:
>| > http://platinum-mails.ebiz-enterprises.com/?r=chinmoy
>| >
>| >
>| >
>| > ---------------------------------
>| > Do you Yahoo!?
>| > Yahoo! Tax Center - File online, calculators, forms, and more
>| >
>| > ---
>| > Incoming mail is certified Virus Free.
>| > Checked by AVG anti-virus system (http://www.grisoft.com).
>| > Version: 6.0.467 / Virus Database: 266 - Release Date: 4/1/2003
>| >
>|
>| ---
>| Outgoing mail is certified Virus Free.
>| Checked by AVG anti-virus system (http://www.grisoft.com).
>| Version: 6.0.467 / Virus Database: 266 - Release Date: 4/1/2003
>|
>|
>|
>| --
>| 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 ---
>John I'm not sure if you've noticed, ...

Larry, Pete et al.,

Point taken.  I won't exacerbate the point, but php.net does point out the lists, and 
this "general" group in particular, are for "talking about PHP".

"There are a number of mailing lists devoted to talking about PHP and related 
projects" (http://www.php.net/support.php)

If the "general" list is meant to be for coding questiosn only, so be it.
I'll try to be good :) But I am not the only one "off-topic". Indeed, 99% of
my questions are about coding. Indeed, I try my hand at answering a few
questions from time to time as well.

Thanks for the posted info and sorry.

John

"Larry E. Ullman" wrote:

> > Where would I go on the redHat site to ask when they are going to
> > upgrade to PHP 4.3 and MySQL 4.x (now in production). Our CS dept.
> > won't install them for me until RedHat bundles it. I'm using RH 7.3.
>
> This question would probably be best directed towards:
> 1) The RedHat site
> 2) A RedHat newsgroup
> 3) A RedHat mailing list
> 4) A RedHat forum
> 5) A RedHat ______, not the PHP general mailing list (since your
> question concerns RedHat packages).
>
> I expect that a RedHat support would be much more qualified to answer
> this question and your original one (when they'll upgrade).
>
> Larry


--- End Message ---
--- Begin Message --- I am working on a project that shall have a section for 'Lost and Found' people lists with photographs. Does anyone knows of any package or code that could be reused here.
Thanks in advance.
--
--
SayOrange.com
http://www.sayorange.com



--- End Message ---
--- Begin Message --- dear all,

hi!
an html file is being created by my php script.
i have used tables for the alignment of html file's text
and images.
i have an image and the value of variable $cname to be
displayed in a cell.
i want both of these items to appear on the same line.
but what happens is the $cname value appears under the
image in the center of the page.
my question is "is there any way without nesting tables to
ensure that my text will appear in the horizontal line
same as that of the image?"
the code is as under.

thanks,
diksha.

<table border="1" width="100%" height="430">
<tr>
<td width="100%" colspan="2" height="61"><img src="C:\Documents and Settings\mangesh\My Documents\My pictures\crows_eating_md_wht.gif">
<div align="center"><h1><u>';
$string.=$wname;
$string.='</u></h1></div></td>
</tr>


_______________________________________________________________________
Odomos - the only  mosquito protection outside 4 walls -
Click here to know more!
http://r.rediff.com/r?http://clients.rediff.com/odomos/Odomos.htm&&odomos&&wn


--- End Message ---

Reply via email to