php-general Digest 26 Apr 2009 15:40:27 -0000 Issue 6088

Topics (messages 291981 through 291995):

Re: inexplicable behaviour
        291981 by: kranthi
        291985 by: 9el
        291987 by: Phpster

Re: Formating Numbers
        291982 by: Warren Vail
        291992 by: Nathan Rixham

Re: How can I detect an exception without using try/catch?
        291983 by: kranthi

Help with scandir()
        291984 by: Deivys Delgado Hernandez
        291993 by: Nathan Rixham
        291994 by: Nathan Rixham

Re: Change color of anything in double/single quotes
        291986 by: Nitsan Bin-Nun
        291988 by: tedd
        291989 by: Ashley Sheridan
        291990 by: Robert Cummings
        291995 by: tedd

Maverick Money Makers - It's Easy!
        291991 by: Roly Sullivan

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 ---
if $Count1 is never referenced after this, then certainly this
assignment operation is redundent. but assignment is not the ONLY
operation of this statement. if u hav not noticed a post increment
operator has been used which will affect the value of $Count as well,
and this operation is required for the script to work.

the script should work even if u replace
$Count1 = $Count++;
with
$Count++;

Kranthi.

--- End Message ---
--- Begin Message ---
I have pagination set up and the number for pages "next" has a link but
the "next" does not. I have experimented with all sorts of
configurations of the code but the only thing that works (and this is
totally "off the wall") is to do this
*$Count* = *mysql_num_rows($results);*
$Count1=*$Count++;* // without this, the "next" does not do the link---
but there is no other $Count1 in the code either in the original page or
the include page.
>
>
>
> the script should work even if u replace
> $Count1 = $Count++;
> with
> $Count++;
>


There's a NICE video tutorial available on pagination over the internet. You
should watch it.

You are counting the number of rows of a result. And you are asking to
increase the count by 1.   :D

Thats not realistic.

pagination is done with  the help of mySQL's * LIMIT recNUMBER, count*
*
Look for "Pagination with PHP + MySQL" and watchit


http://www.google.com/url?sa=t&source=web&ct=res&cd=10&url=http%3A%2F%2Fwww.bestechvideos.com%2F2008%2F07%2F02%2Fsampsonvideos-php-pagination-part-2&ei=ohn0SdnlL8KLkAWQrNTbCg&usg=AFQjCNEGKOIG3791BpgeVqCiiq5-cikbRA

Dont miss this SampsonVideos . PERIOD


*Regards

Lenin

www.twitter.com/nine_L
www.lenin9l.wordpress.com

--- End Message ---
--- Begin Message --- What parameters are you pasing in the link? That will be the telling point of what you are doing wrong. You could pass the search params ( though these are best kept in a session or cookie ) and the offset counter to get the next block of results.

Sorry for top posting.

Bastien

Sent from my iPod

On Apr 26, 2009, at 4:23, 9el <[email protected]> wrote:

I have pagination set up and the number for pages "next" has a link but
the "next" does not. I have experimented with all sorts of
configurations of the code but the only thing that works (and this is
totally "off the wall") is to do this
*$Count* = *mysql_num_rows($results);*
$Count1=*$Count++;* // without this, the "next" does not do the link--- but there is no other $Count1 in the code either in the original page or
the include page.



the script should work even if u replace
$Count1 = $Count++;
with
$Count++;



There's a NICE video tutorial available on pagination over the internet. You
should watch it.

You are counting the number of rows of a result. And you are asking to
increase the count by 1.   :D

Thats not realistic.

pagination is done with  the help of mySQL's * LIMIT recNUMBER, count*
*
Look for "Pagination with PHP + MySQL" and watchit


http://www.google.com/url?sa=t&source=web&ct=res&cd=10&url=http%3A%2F%2Fwww.bestechvideos.com%2F2008%2F07%2F02%2Fsampsonvideos-php-pagination-part-2&ei=ohn0SdnlL8KLkAWQrNTbCg&usg=AFQjCNEGKOIG3791BpgeVqCiiq5-cikbRA

Dont miss this SampsonVideos . PERIOD


*Regards

Lenin

www.twitter.com/nine_L
www.lenin9l.wordpress.com

--- End Message ---
--- Begin Message ---
As an alternative you might consider;

$number = sprintf("%01.2f",$number);  

There was a time many years ago you had to be careful doing math with
floats. Test, test and test some more.

Warren 

> -----Original Message-----
> From: kranthi [mailto:[email protected]] 
> Sent: Saturday, April 25, 2009 8:38 PM
> To: Gary
> Cc: [email protected]
> Subject: Re: [PHP] Formating Numbers
> 
> pl post the desired result, the functions
> 
> if u r trying to get $ 34,567.25
> i dont understand y this is not working for u...
> http://php.net/manual/en/function.number-format.php#88486
> 
> --
> PHP General Mailing List (http://www.php.net/) To 
> unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
Gary wrote:
I cant seem to get this to work for me. I want the number to be formated to money (us, 2 decimal points).

/**
 * returns 4.3 as $4.30 (formats us dollars)
 *
 * @param $amount
 * @return string
 */
function us_dollar_format( $amount )
{
        return ( '$' . number_format($amount, 2, '.', '') );
}

echo us_dollar_format(4.3);

--- End Message ---
--- Begin Message ---
a POSSIBLE work round.

see if u can use
http://in2.php.net/manual/en/function.error-get-last.php or
http://in2.php.net/manual/en/reserved.variables.phperrormsg.php but
they are not working as expected with xdebug. use them in the
__destruct function to check for an uncaught exception

alternatively.. this approach is NOT RECOMMENDED. use it only if u run
out of options

keep the destructor empty. catch the exception and call a function to
perform destruction and then unset the object.
at the end of script, check if the object is set, call the function to
perform destruction. (php dosent destroy the object if the exception
is caught)

Kranthi.

--- End Message ---
--- Begin Message ---
Hi,
I'm having problems when i try to use the function scandir()  in a Novell 
Netware Volumen or a Windows Shared Folder
they both are mapped as a windows network drive, so i suppose i could access 
them as local drive, but i can't. instead i receive this message:

Warning: scandir(R:\) [function.scandir]: failed to open dir: Invalid argument 
in C:\WebServ\wwwroot\htdocs\index.php on line 3
Warning: scandir() [function.scandir]: (errno 22): Invalid argument in 
C:\WebServ\wwwroot\htdocs\index.php on line 3


this is the script:

 <?php
  $dir = "R:\\";                        //Some Windows Network Drive (Novell 
Netware Volumen or a Windows Shared Folder)
  $files1 = scandir($dir);
  print_r($files1);
 ?>

i' m logged to novell as an administrator (testing only)
if i use scandir() in a local drive it works fine for example: scandir("D:\\")

i have appache server 2.0 installed on a WXP SP3 workstation (only for testing) 
and a Novell Netware Server v5.0 used as a File Server, PHP 5.0.2

did i say something wrong in the previus post that nobody answer it? This is 
the first time i have access to a mailing list and maybe i don't know how to 
ask right?

Saludos,
Dedel.


---------------------------------------
    Red Telematica de Salud - Cuba
          CNICM - Infomed

--- End Message ---
--- Begin Message ---
Deivys Delgado Hernandez wrote:
Hi,
I'm having problems when i try to use the function scandir()  in a Novell 
Netware Volumen or a Windows Shared Folder
they both are mapped as a windows network drive, so i suppose i could access 
them as local drive, but i can't. instead i receive this message:

Warning: scandir(R:\) [function.scandir]: failed to open dir: Invalid argument 
in C:\WebServ\wwwroot\htdocs\index.php on line 3
Warning: scandir() [function.scandir]: (errno 22): Invalid argument in 
C:\WebServ\wwwroot\htdocs\index.php on line 3


try using the network path instead :) you have to do this for samba drives on windows too.

$dir = '//machine.local/share/path';

regards,

nathan

ps: many people just don't answer if they do not know

--- End Message ---
--- Begin Message ---
Deivys Delgado Hernandez wrote:
Hi,
I'm having problems when i try to use the function scandir()  in a Novell 
Netware Volumen or a Windows Shared Folder
they both are mapped as a windows network drive, so i suppose i could access 
them as local drive, but i can't. instead i receive this message:

Warning: scandir(R:\) [function.scandir]: failed to open dir: Invalid argument 
in C:\WebServ\wwwroot\htdocs\index.php on line 3
Warning: scandir() [function.scandir]: (errno 22): Invalid argument in 
C:\WebServ\wwwroot\htdocs\index.php on line 3


try using the network path instead :) you have to do this for samba drives on windows too.

$dir = '//machine.local/share/path';

regards,

nathan

ps: many people just don't answer if they do not know

--- End Message ---
--- Begin Message ---
That's what I was just about saying, in addition try to add the HTML
entities to the regular expression as well:

$string = preg_replace('/(?:& #34;|")(.*?)(?:& #34;|")/', '<font
color="color">"\\1"</font>', $string);

Also if you don't to get caught by the HTML validator you better surround
the color name with double quotes ;)

HTH,
Nitsan

On Sat, Apr 25, 2009 at 9:42 PM, Daniel Brown <[email protected]> wrote:

> On Sat, Apr 25, 2009 at 13:50, Marc Steinert <[email protected]> wrote:
> >
> > $string = preg_replace('/"(.*?)"/', '<font color=color>"\\1"</font>',
> > $string);
>
>     Close, but I'd also recommend dropping in a 'Us' modifier so that
> it is `U`ngreedy and `s`pans lines.
>
> <?php
>  $regexp = '/"(.*?)"/Us';
> ?>
>
> --
> </Daniel P. Brown>
> [email protected] || [email protected]
> http://www.parasane.net/ || http://www.pilotpig.net/
> 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
At 1:40 PM -0400 4/25/09, Andrew Hucks wrote:
If I have something like $string = '"hello" there'; (the word hello is
in double quotes, if you can't see it), how would I output it as
something like <font color=color>"hello"</font> there.

Arrggg.

Don't use: "<font color=color>"hello"</font>"

The font tag is dead and embedded styling should moved to css.

There are lot's of ways to do this, here's one:

<span class="red"><?php echo('hello'); ?></span><?php echo(' there'); ?>

You might also check out first-child in css. That way you can make "hello" in red and "there" in whatever the element color is in one statement.

Cheers,

tedd


--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Sun, 2009-04-26 at 09:41 -0400, tedd wrote:
> At 1:40 PM -0400 4/25/09, Andrew Hucks wrote:
> >If I have something like $string = '"hello" there'; (the word hello is
> >in double quotes, if you can't see it), how would I output it as
> >something like <font color=color>"hello"</font> there.
> 
> Arrggg.
> 
> Don't use: "<font color=color>"hello"</font>"
> 
> The font tag is dead and embedded styling should moved to css.
> 
> There are lot's of ways to do this, here's one:
> 
> <span class="red"><?php echo('hello'); ?></span><?php echo(' there'); ?>
> 
> You might also check out first-child in css. That way you can make 
> "hello" in red and "there" in whatever the element color is in one 
> statement.
> 
> Cheers,
> 
> tedd
> 
> 
> -- 
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
I'd go further on that and say don't call your class 'red', as it
doesn't do anything for semantic code, but that's just me trolling ;)


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote:
> On Sun, 2009-04-26 at 09:41 -0400, tedd wrote:
> > At 1:40 PM -0400 4/25/09, Andrew Hucks wrote:
> > >If I have something like $string = '"hello" there'; (the word hello is
> > >in double quotes, if you can't see it), how would I output it as
> > >something like <font color=color>"hello"</font> there.
> > 
> > Arrggg.
> > 
> > Don't use: "<font color=color>"hello"</font>"
> > 
> > The font tag is dead and embedded styling should moved to css.
> > 
> > There are lot's of ways to do this, here's one:
> > 
> > <span class="red"><?php echo('hello'); ?></span><?php echo(' there'); ?>
> > 
> > You might also check out first-child in css. That way you can make 
> > "hello" in red and "there" in whatever the element color is in one 
> > statement.
> > 
> > Cheers,
> > 
> > tedd
> > 
> > 
> > -- 
> > -------
> > http://sperling.com  http://ancientstones.com  http://earthstones.com
> > 
> I'd go further on that and say don't call your class 'red', as it
> doesn't do anything for semantic code, but that's just me trolling ;)

I was about to say the same thing *lol*. tis true though, the class
should be "doubleQuoted" or something similar. What happens when they
decide it should be blue?

span.red
{
    color: blue;
}

Uh huh, uh huh, uh huh :)

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
At 9:47 AM -0400 4/26/09, Robert Cummings wrote:
On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote:
 > On Sun, 2009-04-26 at 09:41 -0400, tedd wrote:
 > > <span class="red"><?php echo('hello'); ?></span><?php echo(' there'); ?>
 > >
 > I'd go further on that and say don't call your class 'red', as it
 > doesn't do anything for semantic code, but that's just me trolling ;)

I was about to say the same thing *lol*. tis true though, the class
should be "doubleQuoted" or something similar. What happens when they
decide it should be blue?

span.red
{
    color: blue;
}

Uh huh, uh huh, uh huh :)


I fully understand, but I also see two side to this.

On one side, I agree that one should always keep attributes vague enough so they can be anything, such as class="warning" and that way the client may say "I don't want it red now, but orange" and it will be easy enough to change.

On the other side, some attributes may be exactly what they claim, such as class="center" or class="red". There is little confusion about what those classes mean as compared to more vague terms. As such, exact attributes are indeed semantic.

So as I see it, with *some* attributes it's a toss-up -- you can add a layer of abstraction by making them vague OR you can use a more exact (semantic) meaning. I don't find much fault with either way provided that it's not a big problem later. The dividing line here is one of how much work it causes.

Additional consideration, one can combine exact attributes, such as class="center red" and it both works and is obvious.

I often have in my css, rules such as:

.center
   {
   text-align: center;
   }

.red
   {
   color: red;
    }

While it might not fit with the purest css, it works for me. YMMV.  :-)

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Attention: If you are an online income seeker, discover the most effective 
step-by-step money making system in existence! You now have this excellent 
opportunity.

People, using this system, are making thousands of dollars per month and you 
can start using it 15 minutes from now!

Guaranteed to work even if you're "un-motivated" - in fact, it's best if you 
only put in an hour or so per day!

Wanna try? We are here to present the Risk-Free Trial of the System. Reply to 
us to [email protected] if you want more information!

MMM Club Affiliates











------------------------------------------------------------------
This email has been written and proved to be in compliance with the recently 
established can-spam act law in US. We are not provoking or forcing any person 
in any way to participate in our programs. To participate is your own decision 
and you carry the responsibility of taking further part in this promotion. 
Anyway, if you don't want to receive more good offers from us, you can simply 
Unsubscribe by sending us a notification email to [email protected] 
with a mail-subject and text "Unsubscribe me", and we will get your email out 
of our list within 10 days.

This message is STRICTLY CONFIDENTIAL and is solely for the individual or 
organisation to whom it is addressed. It may contain PRIVILEGED and 
CONFIDENTIAL information. If you are not the intended recipient, you are hereby 
notified that any dissemination, distribution or copying of this communication 
and its contents is strictly prohibited. If you are not the intended recipient 
you should not read, copy, distribute, disclose or otherwise use the 
information in this email. Email may be susceptible to data corruption, 
interception and unauthorised amendment, and we do not accept liability for any 
such corruption, interception or amendment or the consequences thereof or your 
reliance on any information contained therein if you are not the intended 
recipient. If you are not interested in the offered promotions, please just 
don't answer. If you think you have received this message and its contents in 
error, please delete it from your computer, or follow the unsubscribing 
procedure shown above.
------------------------------------------------------------------
                

--- End Message ---

Reply via email to