php-general Digest 5 Jun 2004 15:21:26 -0000 Issue 2804

Topics (messages 187660 through 187676):

Re: table formatting
        187660 by: Dennis Seavers

if/elseif/else v. switch
        187661 by: Dennis Seavers
        187663 by: Aidan Lister
        187664 by: Rachel Rodriguez
        187667 by: Aidan Lister
        187668 by: Lester Caine

Re: php as CGI and $_POST
        187662 by: Peter Risdon

generating graphs
        187665 by: Nitin
        187666 by: Ryszard Hapka
        187669 by: Nitin
        187673 by: Thomas Seifert

row colours
        187670 by: BigMark
        187675 by: Marek Kilimajer
        187676 by: James Kaufman

Refresh Page
        187671 by: Mike Mapsnac
        187672 by: Daniel Clark
        187674 by: Scot L. Harris

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 ---
Change the design of the HTML table.


> [Original Message]
> From: BigMark <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Date: 06/04/2004 8:07:51 PM
> Subject: [PHP] table formatting
>
> This script by Rob Sossomon works great --Thanks!
> however could anyone tell me if its possible to make it run horizontally.
at
> the moment the output is like this---
>
> ----------------------------------------------
>       Round Game Winning team Wins
>       1 1 Collingwood
>       1 2 Melbourne 4
>       1 3 Fremantle  4
>       1 4 Brisbane 4
>       1 5 St Kilda
>       1 6 Port Adelaide 4
>       1 7 Kangaroos 4
>       1 8 West Coast  4
>       2 1 Richmond
>       2 2 Collingwood 4
>       2 3 Brisbane 4
>       2 4 West Coast
>       2 5 Essendon
>       2 6 Fremantle
>       2 7 Carlton 4
>       2 8 Hawthorn
>
> ----------------------------------------------------------I would like it
> like this
> Round          game1        win        game2     win       game3     etc
>
>    1           Collingwood   4      Melbourne     4         Fremantle 4
>
>
> <?php
> session_start();
> include("connect.php");
> $Name = $_SESSION['first_name'] . " " . $_SESSION['last_name'];
>
> $sql = "SELECT * FROM Selections WHERE Name = '$Name'";
> $result = mysql_query($sql);
>
> /* Determine the number of records returned */
> while ($row = MYSQL_FETCH_array($result))
> $number = mysql_numrows($result);
>
>
> /* Start printing to make it look good */
> print "<table width=\"30%\" cellspacing=\"0\" cellpadding=\"0\"
> border=\"0\">";
> print
> "<tr><th>Round....</th><th>Game....</th><th>Winning
> Team....</th><th>Wins</th></tr>";
>
> $total_points=0;
> /* Iterate through to make it clean */
> while ($i < $number)
> {
>  $item_1 = mysql_result($result, $i,"Round");
>  $item_2 = mysql_result($result, $i,"Game");
>  $item_4 = mysql_result($result, $i,"Winner");
>  $item_5 = mysql_result($result, $i,"Points");
>
> /* This makes it print out in 2 separate color, depending on rows. */
>  if ($i%8 == 0)
>  {
>   print "<tr
>
bgcolor=\"#999999\"><td><center>$item_1</center></td><td><center>$item_2</ce
>
nter></td><td><center>$item_4</center></td><td><center>$item_5</center></td>
> </tr>\n";
>  }
>  else
>  {
>  print "<tr
>
bgcolor=\"#666666\"><td><center>$item_1</center></td><td><center>$item_2</ce
>
nter></td><td><center>$item_4</center></td><td><center>$item_5</center></td>
> </tr>\n";
>  }
>
>
>
> /* Increase record count and total_points to date */
>  $i++;
>  $total_points += $item_5;
> }
> /* close everything up */
>
>  print "<tr><th colspan=5>Total Points Earned: $total_points</th></tr>";
>  print "</table>";
>
> ?>
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Is there any noticeable difference (on the part of the client) between identical 
conditionals, one written as a switch, the other written as an if, elseif ... else 
conditional?  I realize that one programmer coming in behind another might prefer the 
gentler layout of a switch; but would there be any perceivable difference, 
client-side, between the options?

--- End Message ---
--- Begin Message ---
This appears to be a really, really stupid question.

If they are indentical in operation, then ofcourse there will be no
noticeable difference to the user.


One may note that a switch statement is faster, because the condition is
only evaluated once. However you did not ask about the speed difference.


"Dennis Seavers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there any noticeable difference (on the part of the client) between
identical conditionals, one written as a switch, the other written as an if,
elseif ... else conditional?  I realize that one programmer coming in behind
another might prefer the gentler layout of a switch; but would there be any
perceivable difference, client-side, between the options?

--- End Message ---
--- Begin Message ---
--- Aidan Lister <[EMAIL PROTECTED]> wrote:
> This appears to be a really, really stupid question.
> 

Is this level of condemnation of a poster necessary? 

Whether you think Dennis's question was stupid or not,
there is no need for such harsh criticism in front of
everyone on this list.

There are many ways you could have worded your
response to ask the poster to rephrase his question. 
Your approach was not appropriate.

=====
~Rachel


        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

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

You'll note I did not criticise the poster, merely his seemingly stupid
question.

I suggest you practice what you preach. If you have a comment on my reply to
a users post, feel free to contact me personally - [EMAIL PROTECTED]

There is equally no need to criticise my crticism - on the list, in front of
everyone, as you so boldly put it.


"Rachel Rodriguez" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> --- Aidan Lister <[EMAIL PROTECTED]> wrote:
> > This appears to be a really, really stupid question.
> >
>
> Is this level of condemnation of a poster necessary?
>
> Whether you think Dennis's question was stupid or not,
> there is no need for such harsh criticism in front of
> everyone on this list.
>
> There are many ways you could have worded your
> response to ask the poster to rephrase his question.
> Your approach was not appropriate.
>
> =====
> ~Rachel
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/

--- End Message ---
--- Begin Message ---
Now Now children ...

It is always worth remembering that for some posters English is not their first language and therefore while a question may sound silly, there may be perfectly good reasons for it being asked.

Always answer the bits that fit between the lines, that is usually the real question.

Returning to the question :)

If a case statement can be created with a switch, then that should be faster than a string of if then's, but I have seen compilers converting a set of switch values to a string of if then statement like checks. So internally there may well be no difference what so ever! But where a number of conditions need checking, then the result may not be practical with a simple switch anyway.

So the question is possibly - does a case statement switch get processed as a set of goto statements, or a list of equality checks? It makes no difference to the client, but would have an effect on processing times and perhaps the order of segments could be adjusted to account for the most likely state first.

--
Lester Caine
-----------------------------
L.S.Caine Electronic Services

--- End Message ---
--- Begin Message ---
David T-G wrote:

Peter --

...and then Peter Risdon said...
% % David T-G wrote:
% % > bash-2.05a$ /usr/local/bin/php -v
% > PHP 4.3.4 (cli) (built: Jan 6 2004 15:27:52)
% % You probably need the cgi version - not the command line one you % actually have.


Ooohhhhhhhhhhh... Ouch. So there are *three* possible PHP compiles:
module, CGI, and CLI?



So far as the php binary in /usr/local/bin is concerned there are two - cli and cgi. The module consists of different files (see the AddModule and LoadModule bits of httpd.conf). You can have both (I have made that my standard build for multi-homed machines) but need to muck about a bit for this.


OK. To save us the cost of rebuilding at this host, is there any way to
pass args to the CLI version of the script running as a CGI?



You might find you start getting odd problems with http headers if you use the cli version. In general you're better off using the cgi one. But you can get this by recompiling but not installing php cgi, then copy the php executable to, say, /usr/local/bin/php-cgi and prefacing your scripts with this in the shebang. That would mean zero disruption for users on the machine.



Peter.


Thanks & HAND

:-D



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

Please help me in this. How can I generate bar charts etc with PHP?

Thanks in advance

--- End Message ---
--- Begin Message ---
Nitin wrote:

Hi all,

Please help me in this. How can I generate bar charts etc with PHP?

Thanks in advance



http://www.aditus.nu/jpgraph/
--- End Message ---
--- Begin Message ---
thanks for the help, but my PHP ver is 4.0.6...
Any other suggestions??

----- Original Message ----- 
From: "Ryszard Hapka" <[EMAIL PROTECTED]>
To: "Nitin" <[EMAIL PROTECTED]>
Cc: "PHP List" <[EMAIL PROTECTED]>
Sent: Saturday, June 05, 2004 6:11 PM
Subject: Re: [PHP] generating graphs


> Nitin wrote:
> 
> >Hi all,
> >
> >Please help me in this. How can I generate bar charts etc with PHP?
> >
> >Thanks in advance
> >
> >  
> >
> http://www.aditus.nu/jpgraph/

--- End Message ---
--- Begin Message ---
On Sat, 5 Jun 2004 19:31:34 +0530 [EMAIL PROTECTED] (Nitin) wrote:

> thanks for the help, but my PHP ver is 4.0.6...
> Any other suggestions??
> 

hmm, upgrade? :)

really, its worth it!


thomas

--- End Message ---
--- Begin Message ---
 this piece of script makes alternate row colours, but i want the rows to be
coloured in blocks of 8. So the first 8 rows are white then the next are
mauve etc etc.

Alternatively i could make the rows all the same colour , but i need a blank
row after each 8 rows.? Any ideas


----------------------------------------------------------------------------
------
 if  ($i%8 == 0)

  {
  print "<tr
bgcolor=\"#ffffff\"><td>$item_1</td><td>$item_2</td><td>$item_4</td><td><cen
ter>$item_5</center></td></tr>\n";
 }
  else
 {
 print "<tr
bgcolor=\"#eeeeff\"><td>$item_1</td><td>$item_2</td><td>$item_4</td><td><cen
ter>$item_5</center></td></tr>\n";
 }
----------------------------------------------------------------------------
---

--- End Message ---
--- Begin Message --- BigMark wrote:
 this piece of script makes alternate row colours, but i want the rows to be
coloured in blocks of 8. So the first 8 rows are white then the next are
mauve etc etc.

Alternatively i could make the rows all the same colour , but i need a blank
row after each 8 rows.? Any ideas


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

untested: if($i % 16 > 8)

//  if  ($i%8 == 0)

  {
  print "<tr
bgcolor=\"#ffffff\"><td>$item_1</td><td>$item_2</td><td>$item_4</td><td><cen
ter>$item_5</center></td></tr>\n";
 }
  else
 {
 print "<tr
bgcolor=\"#eeeeff\"><td>$item_1</td><td>$item_2</td><td>$item_4</td><td><cen
ter>$item_5</center></td></tr>\n";
 }
----------------------------------------------------------------------------
---


--- End Message ---
--- Begin Message ---
On Sat, Jun 05, 2004 at 04:54:33PM +0200, Marek Kilimajer wrote:
> BigMark wrote:
> > this piece of script makes alternate row colours, but i want the rows to 
> > be
> >coloured in blocks of 8. So the first 8 rows are white then the next are
> >mauve etc etc.
> >
> >Alternatively i could make the rows all the same colour , but i need a 
> >blank
> >row after each 8 rows.? Any ideas
> >
> >
> >----------------------------------------------------------------------------
> >------
> 

How about:

$bgcolor = ($i % 16 > 8) ? #eeeeff : #ffffff;
print "<tr
bgcolor='$bgcolor'><td>$item_1</td><td>$item_2</td><td>$item_4</td><td><cen
ter>$item_5</center></td></tr>\n";

> 
> >//  if  ($i%8 == 0)
> >
> >  {
> >  print "<tr
> >bgcolor=\"#ffffff\"><td>$item_1</td><td>$item_2</td><td>$item_4</td><td><cen
> >ter>$item_5</center></td></tr>\n";
> > }
> >  else
> > {
> > print "<tr
> >bgcolor=\"#eeeeff\"><td>$item_1</td><td>$item_2</td><td>$item_4</td><td><cen
> >ter>$item_5</center></td></tr>\n";
> > }
> >----------------------------------------------------------------------------
> >---
> >
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Jim Kaufman
Linux Evangelist
public key 0x6D802619
http://www.linuxforbusiness.net
---
Duty then is the sublimest word in the English language. You should
do your duty in all things. You can never do more, you should never
wish to do less.
                -- General Robert E. Lee

--- End Message ---
--- Begin Message --- I want to refresh page every 10 seconds, without clicking on "Refresh" button.
Any ideas how this can be done?


Thanks

_________________________________________________________________
MSN 9 Dial-up Internet Access fights spam and pop-ups � now 3 months FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/

--- End Message ---
--- Begin Message ---
<meta http-equiv="refresh" content="10; url=test.php"> 

Put inside the <HEAD> tags, this refreshed the page every 10 seconds.


>>I want to refresh page every 10 seconds, without clicking on "Refresh" 
>>button.
>>Any ideas how this can be done?

--- End Message ---
--- Begin Message ---
On Sat, 2004-06-05 at 10:20, Mike Mapsnac wrote:
> I want to refresh page every 10 seconds, without clicking on "Refresh" 
> button.
> Any ideas how this can be done?
> 
> Thanks

I think you want to include something like this in your pages header
section:

<META HTTP-EQUIV="REFRESH" CONTENT="10">

-- 
Scot L. Harris
[EMAIL PROTECTED]

It is so soon that I am done for, I wonder what I was begun for.
                -- Epitaph, Cheltenham Churchyard 

--- End Message ---

Reply via email to