php-general Digest 4 Aug 2009 09:03:58 -0000 Issue 6266
Topics (messages 296240 through 296250):
underscore in php functions?
296240 by: Oral Timocin
296241 by: Stuart
296242 by: Oral Timocin
296243 by: Ashley Sheridan
Re: Multiple MySQL Queries
296244 by: sono-io.fannullone.us
Re: Dan Brown
296245 by: Paul M Foster
296246 by: Paul M Foster
296248 by: Martin Scotta
296249 by: Sam Stelfox
296250 by: Colin Guthrie
Re: What makes _SERVER stop working
296247 by: Shawn McKenzie
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Hi all,
i am a newbie to php an want to learn it. Aftere reading some sample Code
an the documetation i have an unanswered question!
for example:
public function _example(){
}
what does the _ mean in that function. Could anyone help me?
regards
--- End Message ---
--- Begin Message ---
2009/8/3 Oral Timocin <o_timo...@gmx.de>:
> Hi all,
>
> i am a newbie to php an want to learn it. Aftere reading some sample Code
> an the documetation i have an unanswered question!
>
> for example:
>
> public function _example(){
> }
>
> what does the _ mean in that function. Could anyone help me?
Absolutely. But some developers use it as a convention for private
methods or some other indicator.
-Stuart
--
http://stut.net/
--- End Message ---
--- Begin Message ---
Stuart wrote:
> 2009/8/3 Oral Timocin <o_timo...@gmx.de>:
>> Hi all,
>>
>> i am a newbie to php an want to learn it. Aftere reading some sample Code
>> an the documetation i have an unanswered question!
>>
>> for example:
>>
>> public function _example(){
>> }
>>
>> what does the _ mean in that function. Could anyone help me?
>
> Absolutely. But some developers use it as a convention for private
> methods or some other indicator.
>
> -Stuart
>
Thank you for the answer. I have looked for the sample code again and you
are right. Some of the marked funtions are protected and some are private.
Now i have understand that. Thank you again.
regards
--- End Message ---
--- Begin Message ---
On Mon, 2009-08-03 at 22:46 +0200, Oral Timocin wrote:
> Stuart wrote:
>
> > 2009/8/3 Oral Timocin <o_timo...@gmx.de>:
> >> Hi all,
> >>
> >> i am a newbie to php an want to learn it. Aftere reading some sample Code
> >> an the documetation i have an unanswered question!
> >>
> >> for example:
> >>
> >> public function _example(){
> >> }
> >>
> >> what does the _ mean in that function. Could anyone help me?
> >
> > Absolutely. But some developers use it as a convention for private
> > methods or some other indicator.
> >
> > -Stuart
> >
>
> Thank you for the answer. I have looked for the sample code again and you
> are right. Some of the marked funtions are protected and some are private.
> Now i have understand that. Thank you again.
>
> regards
>
Also, there are some special cases, like the __construct() function,
which use a double underscore, and have a special meaning for classes.
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
I'd like to revisit this one last time. Below is the revised code
I'm using, but I don't like having individual 'Add To Cart' buttons
for each item. I've tried to find a way to have only one that resides
outside the nested tables for all items, but without luck. It would
need to send every item that has a quantity to the cart, but only
those items. The URL that would be passed needs to look like this:
/shop.cgi?
c=viewcart.htm&itemid=P74S&i_P74S=80&S2448S&i_S2448S=100&AC&i_AC=26
(The above URL is sending 3 items and quantities to the cart; 80 -
P74S, 100 - S2448S and 26 - AC.)
Thanks again for all your help. I'm learning a lot on this list -
albeit slowly! ;)
Regards,
Frank
------------------------
<?php
$cats = array('02121-19222-13349-11451' => 'Stationary
Posts','04103-99222-48340-11422' => 'Solid Galvanized Shelves');
echo '<table border="1"><tr>';
foreach ( $cats AS $cat => $title) {
echo <<<START
<td valign="top">
<table border="1">
<tr><th align="center" colspan="4">{$title}</th></tr>
<tr>
<td class="text-header" align="center">Item#</td>
<td class="text-header" align="center">Description<br />
<span class="text-small">(Click for more info)</span></td>
<td class="text-header" align="center">Price</td>
<td class="text-header" align="center">Qty</td>
</tr>
START;
$cat = mysql_real_escape_string($cat, $db); //sanitizes the data
to prevent SQL injection
$SQL = "SELECT itemid,description,unitprice
FROM catalog
WHERE categories='$cat'
ORDER BY itemid";
if ( ($result = mysql_query($SQL, $db)) !== false ) {
while ( $item = mysql_fetch_assoc($result) ) {
$price = "$" . number_format($item['unitprice'],2);
echo <<<ROW
<tr>
<td class="text-med">{$item['itemid']}</td>
<td class="text-med"><a href="/shop.cgi?
c=detail.htm&itemid={$item['itemid']}">{$item['description']}</a></td>
<td class="text-med" align="right">{$price}</td>
<td class="text-med">
<form action="/shop.cgi" method="get">
<input type="hidden" name="itemid"
value="{$item['itemid']}" />
<input type="text" name="i_{$item['itemid']}" value=""
size="4" />
<input type="hidden" name="c" value="viewcart.htm" />
<input type="image" src="/graphics/addtocart.png"
name="addToCartButton" alt="Add To Cart" />
</form>
</td>
</tr>
ROW;
}
} else {
echo "No results for category #{$cat}!";
}
echo '</table></td>';
}
echo '</tr></table>';
?>
--- End Message ---
--- Begin Message ---
On Mon, Aug 03, 2009 at 01:54:05PM -0400, tedd wrote:
<snip>
> Everything is backed up at least three fold. I am considering online
> backup and waiting for the cost to go down.
Tried Carbonite.com? I think they're like US$55 / year. Work on Mac and
PC, but I doubt Linux, and I don't know about their space limits.
Paul
--
Paul M. Foster
--- End Message ---
--- Begin Message ---
On Mon, Aug 03, 2009 at 12:29:29PM -0400, Daniel Brown wrote:
> ALL:
>
> It's far easier to drop a line to the mailing lists and BCC a few
> others than to write back to many individually.
<snip>
(I thought you were just heads down coding, not adding to the Brown
population. ;-)
And this means that while Dan's family and business are recuperating, we
should be on our best mailing list behavior, no top posting, no
flamewars, etc. Right? (Yeah, right.)
And of course, all the best to Dan, his wife and new daughter. I'm with
Tedd; you'll love your daughter to pieces until she gets to puberty.
Then take your wife and leave the country, no forwarding address.
"Haileigh who?"
;-}
Paul
--
Paul M. Foster
--- End Message ---
--- Begin Message ---
I want to say 'Congratulations' in the php-style!
<?php
Interface Brown
{
function getName();
}
Class HaileighBrown implements Brown
{
protected $_bornTime = '02:45 EDT';
protected $_bornDate = '27 July, 2009';
protected $_bornSize = '17.5"';
protected $_bornWeight = '6lbs 4oz';
function getName()
{
return 'Haileigh G. Brown';
}
}
Class DanielBrown implements Brown
{
protected $_daughters = array();
function __construct()
{
$this->_daughters[] = new HaileighBrown();
}
function getName()
{
return 'Daniel P. Brown';
}
}
$dan = new DanielBrown();
On Mon, Aug 3, 2009 at 1:29 PM, Daniel Brown<danbr...@php.net> wrote:
> ALL:
>
> It's far easier to drop a line to the mailing lists and BCC a few
> others than to write back to many individually.
>
> Thanks for the concern and well-wishes from the many who wrote to
> me during the last 10 days. It's very, very kind of you, and much
> appreciated. I'm honored that you would think of me at all outside of
> the context of the various mailing lists.
>
> For those of you who do not know, on Sunday my wife, Debi, and I
> went into the hospital because she was nine months pregnant, but had
> not felt the baby move for several hours. She was attached to a
> monitor, and while everything seemed fine at first, that quickly
> changed. The baby's heart rate - which should be between 120 and 160
> beats per minute - dropped as low as 49, which is very, very, very
> bad. It happened a couple of times, and during an emergency
> ultrasound scan, the baby - on the screen - stuck her tongue right out
> at us, then proceeded to bring her fist to her mouth to suck. And
> inside her little fist was her umbilical cord --- she was literally
> squeezing it so tight that she was cutting off the blood and oxygen
> flow to herself. Because of this, they decided to induce labor in
> Debi.
>
> After several hours of labor with no pain relief, the baby's
> condition was continuing to deteriorate, so at approximately 02:30
> EDT, the doctor made the decision to perform a Caesarean section
> (surgical delivery) of the baby. Things were rushed along, and I
> walked into the delivery room just in time to see a purple leg
> sticking out of a hole in Debi's belly. As I walked past, they lifted
> the baby out, cut the cord, and rushed her past me to get her to
> breathe. Her skin was purple, as is normal, but her eyes were wide
> open as she went past. At about 02:46 EDT, she cried for the first
> time.
>
> So Haileigh Grace Brown, born at 02:45 EDT Monday morning, 27
> July, 2009, weighed in at 6lbs 4oz and was 17.5 inches long. She has
> blue(-ish) eyes and a full head of hair. There have been several
> other life-threatening complications in both her and Debi, including
> the baby being completely unable to breathe due to fluid in her lungs,
> requiring emergency response and suction, but as of today, she is
> doing much better. Because of all of this, and some complications in
> the days just before her birth, I've been rather silent, which is what
> apparently gained the attention of the thirty-four (yes, I counted!
> ;-P) people who sent me emails privately to see if I was alright.
> Yes, I am, and thankfully, so is my little family.
>
> Both Debi and Haileigh are doing well now. Haileigh doesn't sleep
> through the night yet, of course, but she doesn't yet sleep through
> the day, either. She remains awake, wide-eyed, and very alert and
> aware of her surroundings --- which is great, except for the fact that
> it means that, during the day, we need to pay more attention to her,
> and at night, I'm awake the whole time with her. In the hospital (we
> had her in our room) and here at home, I've been allowing Debi to
> sleep through the night in bed, to heal from the surgery, and I stay
> awake with the baby. I sleep between one and four hours per day, at
> maximum. I can't so nobody warned me about this! ;-P
>
> On a different note, thanks to all of the rain we've had here in
> the northeast US this year, my basement office flooded while I was
> away in the hospital, tending to more important issues. As a result,
> both my development and backup machines were destroyed, including all
> of my undelivered work, research projects, et cetera. So in addition
> to no sleep, I get to enjoy no peace as I work to deliver what I can
> (behind schedule) and distribute refunds to clients. Having a baby is
> difficult enough; having a baby and a career is more difficult; having
> a baby and working as a freelancer or owner/operator of a company is
> the epitome of masochism --- I'm learning that quite thoroughly
> through experience.
>
> Still, all in all, everything is fine. It'll be tight and
> stressful until things are caught back up work-wise, but I'm just fine
> with that. Because from the moment my little girl filled those lungs
> and executed her first "Hello, World!" application at quarter-to-three
> in the morning last Monday, there's been a completely new Dan Brown.
>
> Thanks for everyone's checking in and well-wishing, once again,
> and I'll get back to everyone personally as soon as I can. In the
> meantime, I'll be back here at my desk, so zip me an email if you need
> me. It may take a bit longer for me to reply until I get caught up,
> but I will.
>
> For those of you with no interest in this, please exercise your
> email-delete capabilities at this time.
>
> Thanks!
>
> --
> </Daniel P. Brown>
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> Check out our great hosting and dedicated server deals at
> http://twitter.com/pilotpig
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Martin Scotta
--- End Message ---
--- Begin Message ---
tedd wrote:
Everything is backed up at least three fold. I am considering online
backup and waiting for the cost to go down.
You should add paper backups to that list!
http://ollydbg.de/Paperbak/
Sam Stelfox
--- End Message ---
--- Begin Message ---
'Twas brillig, and Daniel Brown at 03/08/09 17:29 did gyre and gimble:
my basement office flooded
I think everyone on this list has been inconsiderate to the clearly
massive tragedy of your flooded basement. May I be the first to pass on
my condolences for all the dead computers that are now bobbing around
downstairs.
I hope they've gone to Silicon Heaven.
Sad news indeed.
Col
PS Oh yeah and congrats on the whole baby thing too although it's hardly
the most poignant story :p
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
Day Job:
Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
Mandriva Linux Contributor [http://www.mandriva.com/]
PulseAudio Hacker [http://www.pulseaudio.org/]
Trac Hacker [http://trac.edgewall.org/]
--- End Message ---
--- Begin Message ---
Miller, Terion wrote:
> All of a sudden this stopped working and keeps defaulting to A again
>
> if ($_SERVER['SCRIPT_FILENAME'] = "browse.php" ) {
>
> $default = "A";
>
> }
>
>
> else {
>
> $default = "";
>
> }
>
It stopped working or never worked because your if statement is wrong ==
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---