php-general Digest 22 Jun 2010 01:43:39 -0000 Issue 6809

Topics (messages 306282 through 306301):

Re: function within a class function
        306282 by: Pete Ford
        306283 by: Richard Quadling
        306285 by: Gary .

Website content question
        306284 by: Ernie Kemp
        306286 by: Shreyas Agasthya
        306287 by: Ernie Kemp
        306288 by: Ernie Kemp
        306289 by: Ashley Sheridan
        306290 by: Ernie Kemp
        306291 by: Ashley Sheridan
        306295 by: Ernie Kemp
        306301 by: Hans Åhlin

PHP & Active Directory?
        306292 by: David Stoltz
        306293 by: Ashley Sheridan
        306294 by: Nathan Nobbe
        306296 by: David Stoltz
        306297 by: Nathan Nobbe
        306298 by: David Stoltz

fetching DB entries
        306299 by: Ashley Sheridan
        306300 by: larry.garfieldtech.com

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 ---
On 21/06/10 00:45, Rick Pasotto wrote:
Within a class function I have defined another function for use with the
usort() function. How do I reference it?

When it's not part of a class usort($arr,"cmp") works fine but when it's
within a class function I get this error:

PHP Parse error:  syntax error, unexpected T_STRING, expecting T_FUNCTION

Is it not in the scope of the class function?


you need to use an array to describe the callback function:

class Foo
{
        public function cmp($a,$b)
        {
                // do comparison and return result
        }
}

then

$foo = new Foo();
usort($arr,Array($foo,'cmp'));



I think that's right - doesn't the manual describe this sort of thing about using callback functions that are class members?


--
Peter Ford, Developer                 phone: 01580 893333 fax: 01580 893399
Justcroft International Ltd.                              www.justcroft.com
Justcroft House, High Street, Staplehurst, Kent   TN12 0AH   United Kingdom
Registered in England and Wales: 2297906
Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS

--- End Message ---
--- Begin Message ---
On 21 June 2010 00:45, Rick Pasotto <r...@niof.net> wrote:
> Within a class function I have defined another function for use with the
> usort() function. How do I reference it?
>
> When it's not part of a class usort($arr,"cmp") works fine but when it's
> within a class function I get this error:
>
> PHP Parse error:  syntax error, unexpected T_STRING, expecting T_FUNCTION
>
> Is it not in the scope of the class function?
>
> --
> "Memory is like an orgasm.  It's a lot better if you don't have to fake it."
>                -- Seymour Cray (on virtual memory)
>    Rick Pasotto    r...@niof.net    http://www.niof.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

<?php
class foo {
 public $array = array(3,2,1);
 private function cmp($a, $b) {
  return $a === $b ? 0 : ($a < $b ? -1 : 1);
 }
 public function bar() {
  usort($this->array, array($this, 'cmp'));
 }
}

$baz = new foo();
$baz->bar();
print_r($baz->array);


or

<?php
class foo {
 public $array = array(3,2,1);
 public function bar() {
  usort($this->array, function($a, $b) {
   return $a === $b ? 0 : ($a < $b ? -1 : 1);
   });
 }
}

$baz = new foo();
$baz->bar();
print_r($baz->array);

if you have closures available to you.


-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--- End Message ---
--- Begin Message ---
On Mon, Jun 21, 2010 at 10:49 AM, Pete Ford wrote:
> On 21/06/10 00:45, Rick Pasotto wrote:

> I think that's right - doesn't the manual describe this sort of thing about
> using callback functions that are class members?

Yes. 
http://www.php.net/manual/en/language.pseudo-types.php#language.types.callback

--- End Message ---
--- Begin Message ---
 

This is not a direct PHP question but I will be using PHP in the website.

 

I go to the php list because the wordpress forum does not respond to my
questions and I know some of you have a lot of expertise in other areas than
PHP.

 

I wish to a my own pages to a theme.

I created pages on my PC and added the code at the top of the page for
wordpress to use the page for a template page.

I than FTP'd the file over to web hosting server template location.

Through  wordpress "administrator" I added my file called homepage.php.

 

I FTP'd my CSS, images, js and flash folders over to the template location.

Went to load the website
http://localhost/Michael-8701/site_flash/wordpress/wp-content/homepage.php
and all I got was the html code displayed.

 

I tried moving the folder around but same results.

Read some docs on this but it's not clear to me why this will not work.

 

Please help this is new to me and I need to get over this wall.

Thanks,

..../Ernie

 

 

 

 

 

 


--- End Message ---
--- Begin Message ---
Ernie,

I am sure you know none of us could have accessed the link that you have
given there. Can you let us know what code you have written so that one of
us can guide you?

As a broad pitch, your php code has to be either in <?php ?> or <? ?>

I would wait for your code and other to probe a little more.

Regards,
Shreyas

On Mon, Jun 21, 2010 at 5:11 PM, Ernie Kemp <ernie.k...@sympatico.ca> wrote:

>   This is not a direct PHP question but I will be using PHP in the
> website.
>
>
>
> I go to the php list because the wordpress forum does not respond to my
> questions and I know some of you have a lot of expertise in other areas than
> PHP.
>
>
>
> I wish to a my own pages to a theme.
>
> I created pages on my PC and added the code at the top of the page for
> wordpress to use the page for a template page.
>
> I than FTP’d the file over to web hosting server template location.
>
> Through  wordpress “administrator” I added my file called homepage.php.
>
>
>
> I FTP’d my CSS, images, js and flash folders over to the template location.
>
> Went to load the website
> http://localhost/Michael-8701/site_flash/wordpress/wp-content/homepage.phpand 
> all I got was the html code displayed.
>
>
>
> I tried moving the folder around but same results.
>
> Read some docs on this but it’s not clear to me why this will not work.
>
>
>
> Please help this is new to me and I need to get over this wall.
>
> Thanks,
>
> ..../Ernie
>
>
>
>
>
>
>
>
>
>
>
>
>



-- 
Regards,
Shreyas Agasthya

--- End Message ---
--- Begin Message ---
So sorry about the link, in too much of a hurry.

My server site is http://digitalbiz4u.com/wordpress/ 
I used <?php 
/*
Template Name: Home Page 
*/
in my Homepage.php program.

They very much.
.../Ernie


-----Original Message-----
From: Shreyas Agasthya [mailto:shreya...@gmail.com] 
Sent: June-21-10 8:59 AM
To: Ernie Kemp
Cc: PHP General List
Subject: Re: [PHP] Website content question

Ernie,

I am sure you know none of us could have accessed the link that you have
given there. Can you let us know what code you have written so that one of
us can guide you?

As a broad pitch, your php code has to be either in <?php ?> or <? ?>

I would wait for your code and other to probe a little more.

Regards,
Shreyas

On Mon, Jun 21, 2010 at 5:11 PM, Ernie Kemp <ernie.k...@sympatico.ca> wrote:

>   This is not a direct PHP question but I will be using PHP in the
> website.
>
>
>
> I go to the php list because the wordpress forum does not respond to my
> questions and I know some of you have a lot of expertise in other areas
than
> PHP.
>
>
>
> I wish to a my own pages to a theme.
>
> I created pages on my PC and added the code at the top of the page for
> wordpress to use the page for a template page.
>
> I than FTP'd the file over to web hosting server template location.
>
> Through  wordpress "administrator" I added my file called homepage.php.
>
>
>
> I FTP'd my CSS, images, js and flash folders over to the template
location.
>
> Went to load the website
>
http://localhost/Michael-8701/site_flash/wordpress/wp-content/homepage.phpan
d all I got was the html code displayed.
>
>
>
> I tried moving the folder around but same results.
>
> Read some docs on this but it's not clear to me why this will not work.
>
>
>
> Please help this is new to me and I need to get over this wall.
>
> Thanks,
>
> ..../Ernie
>
>
>
>
>
>
>
>
>
>
>
>
>



-- 
Regards,
Shreyas Agasthya

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.829 / Virus Database: 271.1.1/2952 - Release Date: 06/20/10
14:36:00


--- End Message ---
--- Begin Message ---
Just as a follow up I'm including a link to a test site that I wish to have
the wordpress to be able to change the content, but I'm unable to have
wordpress use my includes.
I must be putting them in the wrong places so need some help with this.

Thanks,
.../Ernie




-----Original Message-----
From: Shreyas Agasthya [mailto:shreya...@gmail.com] 
Sent: June-21-10 8:59 AM
To: Ernie Kemp
Cc: PHP General List
Subject: Re: [PHP] Website content question

Ernie,

I am sure you know none of us could have accessed the link that you have
given there. Can you let us know what code you have written so that one of
us can guide you?

As a broad pitch, your php code has to be either in <?php ?> or <? ?>

I would wait for your code and other to probe a little more.

Regards,
Shreyas

On Mon, Jun 21, 2010 at 5:11 PM, Ernie Kemp <ernie.k...@sympatico.ca> wrote:

>   This is not a direct PHP question but I will be using PHP in the
> website.
>
>
>
> I go to the php list because the wordpress forum does not respond to my
> questions and I know some of you have a lot of expertise in other areas
than
> PHP.
>
>
>
> I wish to a my own pages to a theme.
>
> I created pages on my PC and added the code at the top of the page for
> wordpress to use the page for a template page.
>
> I than FTP'd the file over to web hosting server template location.
>
> Through  wordpress "administrator" I added my file called homepage.php.
>
>
>
> I FTP'd my CSS, images, js and flash folders over to the template
location.
>
> Went to load the website
>
http://localhost/Michael-8701/site_flash/wordpress/wp-content/homepage.phpan
d all I got was the html code displayed.
>
>
>
> I tried moving the folder around but same results.
>
> Read some docs on this but it's not clear to me why this will not work.
>
>
>
> Please help this is new to me and I need to get over this wall.
>
> Thanks,
>
> ..../Ernie
>
>
>
>
>
>
>
>
>
>
>
>
>



-- 
Regards,
Shreyas Agasthya

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.829 / Virus Database: 271.1.1/2952 - Release Date: 06/20/10
14:36:00


--- End Message ---
--- Begin Message ---
On Mon, 2010-06-21 at 10:04 -0400, Ernie Kemp wrote:

> Just as a follow up I'm including a link to a test site that I wish to have
> the wordpress to be able to change the content, but I'm unable to have
> wordpress use my includes.
> I must be putting them in the wrong places so need some help with this.
> 
> Thanks,
> .../Ernie
> 
> 
> 
> 
> -----Original Message-----
> From: Shreyas Agasthya [mailto:shreya...@gmail.com] 
> Sent: June-21-10 8:59 AM
> To: Ernie Kemp
> Cc: PHP General List
> Subject: Re: [PHP] Website content question
> 
> Ernie,
> 
> I am sure you know none of us could have accessed the link that you have
> given there. Can you let us know what code you have written so that one of
> us can guide you?
> 
> As a broad pitch, your php code has to be either in <?php ?> or <? ?>
> 
> I would wait for your code and other to probe a little more.
> 
> Regards,
> Shreyas
> 
> On Mon, Jun 21, 2010 at 5:11 PM, Ernie Kemp <ernie.k...@sympatico.ca> wrote:
> 
> >   This is not a direct PHP question but I will be using PHP in the
> > website.
> >
> >
> >
> > I go to the php list because the wordpress forum does not respond to my
> > questions and I know some of you have a lot of expertise in other areas
> than
> > PHP.
> >
> >
> >
> > I wish to a my own pages to a theme.
> >
> > I created pages on my PC and added the code at the top of the page for
> > wordpress to use the page for a template page.
> >
> > I than FTP'd the file over to web hosting server template location.
> >
> > Through  wordpress "administrator" I added my file called homepage.php.
> >
> >
> >
> > I FTP'd my CSS, images, js and flash folders over to the template
> location.
> >
> > Went to load the website
> >
> http://localhost/Michael-8701/site_flash/wordpress/wp-content/homepage.phpan
> d all I got was the html code displayed.
> >
> >
> >
> > I tried moving the folder around but same results.
> >
> > Read some docs on this but it's not clear to me why this will not work.
> >
> >
> >
> > Please help this is new to me and I need to get over this wall.
> >
> > Thanks,
> >
> > ..../Ernie
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> 
> 
> 
> -- 
> Regards,
> Shreyas Agasthya
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 9.0.829 / Virus Database: 271.1.1/2952 - Release Date: 06/20/10
> 14:36:00
> 
> 


There are guides online to creating Wordpress templates. Have you tried
editing an existing template first rather than create one from scratch?
It's how I've always made them.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Need to use the template http://www.digitalbiz4u.com/site_flash/ .

Thanks,

..../Ernie

 

 

From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: June-21-10 10:09 AM
To: Ernie Kemp
Cc: 'Shreyas Agasthya'; 'PHP General List'
Subject: RE: [PHP] Website content question

 

On Mon, 2010-06-21 at 10:04 -0400, Ernie Kemp wrote: 

 
Just as a follow up I'm including a link to a test site that I wish to have
the wordpress to be able to change the content, but I'm unable to have
wordpress use my includes.
I must be putting them in the wrong places so need some help with this.
 
Thanks,
.../Ernie
 
 
 
 
-----Original Message-----
From: Shreyas Agasthya [mailto:shreya...@gmail.com] 
Sent: June-21-10 8:59 AM
To: Ernie Kemp
Cc: PHP General List
Subject: Re: [PHP] Website content question
 
Ernie,
 
I am sure you know none of us could have accessed the link that you have
given there. Can you let us know what code you have written so that one of
us can guide you?
 
As a broad pitch, your php code has to be either in <?php ?> or <? ?>
 
I would wait for your code and other to probe a little more.
 
Regards,
Shreyas
 
On Mon, Jun 21, 2010 at 5:11 PM, Ernie Kemp <ernie.k...@sympatico.ca> wrote:
 
>   This is not a direct PHP question but I will be using PHP in the
> website.
> 
> 
> 
> I go to the php list because the wordpress forum does not respond to my
> questions and I know some of you have a lot of expertise in other areas
than
> PHP.
> 
> 
> 
> I wish to a my own pages to a theme.
> 
> I created pages on my PC and added the code at the top of the page for
> wordpress to use the page for a template page.
> 
> I than FTP'd the file over to web hosting server template location.
> 
> Through  wordpress "administrator" I added my file called homepage.php.
> 
> 
> 
> I FTP'd my CSS, images, js and flash folders over to the template
location.
> 
> Went to load the website
> 
http://localhost/Michael-8701/site_flash/wordpress/wp-content/homepage.phpan
d all I got was the html code displayed.
> 
> 
> 
> I tried moving the folder around but same results.
> 
> Read some docs on this but it's not clear to me why this will not work.
> 
> 
> 
> Please help this is new to me and I need to get over this wall.
> 
> Thanks,
> 
> ..../Ernie
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
 
 
 
-- 
Regards,
Shreyas Agasthya
 
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.829 / Virus Database: 271.1.1/2952 - Release Date: 06/20/10
14:36:00
 
 


There are guides online to creating Wordpress templates. Have you tried editing 
an existing template first rather than create one from scratch? It's how I've 
always made them.


Thanks,
Ash
http://www.ashleysheridan.co.uk



 

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.829 / Virus Database: 271.1.1/2952 - Release Date: 06/21/10 
02:36:00


--- End Message ---
--- Begin Message ---
On Mon, 2010-06-21 at 10:40 -0400, Ernie Kemp wrote:

> Need to use the template http://www.digitalbiz4u.com/site_flash/ .
> 
> Thanks,
> 
> ..../Ernie
> 
>  
> 
> 
> 
> From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
> Sent: June-21-10 10:09 AM
> To: Ernie Kemp
> Cc: 'Shreyas Agasthya'; 'PHP General List'
> Subject: RE: [PHP] Website content question
> 
>  
> 
> On Mon, 2010-06-21 at 10:04 -0400, Ernie Kemp wrote: 
> 
>  
> Just as a follow up I'm including a link to a test site that I wish to have
> the wordpress to be able to change the content, but I'm unable to have
> wordpress use my includes.
> I must be putting them in the wrong places so need some help with this.
>  
> Thanks,
> .../Ernie
>  
> 
> 
> 
> -----Original Message-----
> From: Shreyas Agasthya [mailto:shreya...@gmail.com] 
> Sent: June-21-10 8:59 AM
> To: Ernie Kemp
> Cc: PHP General List
> Subject: Re: [PHP] Website content question
>  
> Ernie,
>  
> I am sure you know none of us could have accessed the link that you have
> given there. Can you let us know what code you have written so that one of
> us can guide you?
>  
> As a broad pitch, your php code has to be either in <?php ?> or <? ?>
>  
> I would wait for your code and other to probe a little more.
>  
> Regards,
> Shreyas
>  
> On Mon, Jun 21, 2010 at 5:11 PM, Ernie Kemp <ernie.k...@sympatico.ca> wrote:
>  
> >   This is not a direct PHP question but I will be using PHP in the
> > website.
> > 
> > 
> > 
> > I go to the php list because the wordpress forum does not respond to my
> > questions and I know some of you have a lot of expertise in other areas
> than
> > PHP.
> > 
> > 
> > 
> > I wish to a my own pages to a theme.
> > 
> > I created pages on my PC and added the code at the top of the page for
> > wordpress to use the page for a template page.
> > 
> > I than FTP'd the file over to web hosting server template location.
> > 
> > Through  wordpress "administrator" I added my file called homepage.php.
> > 
> > 
> > 
> > I FTP'd my CSS, images, js and flash folders over to the template
> location.
> > 
> > Went to load the website
> > 
> http://localhost/Michael-8701/site_flash/wordpress/wp-content/homepage.phpan
> d all I got was the html code displayed.
> > 
> > 
> > 
> > I tried moving the folder around but same results.
> > 
> > Read some docs on this but it's not clear to me why this will not work.
> > 
> > 
> > 
> > Please help this is new to me and I need to get over this wall.
> > 
> > Thanks,
> > 
> > ..../Ernie
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
>  
> 
> 


You can still do that, just convert an existing template. You've still
not shown us the code you're using, so we can't really help you in the
way you want.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Resolved.  The paths are: wordpress-> flash

Ø  CSS

Ø  Js

Wordpress/mytheme -> your custom template files

 

Thanks,

..../Ernie

 

 

From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: June-21-10 10:43 AM
To: Ernie Kemp
Cc: 'Shreyas Agasthya'; 'PHP General List'
Subject: RE: [PHP] Website content question

 

On Mon, 2010-06-21 at 10:40 -0400, Ernie Kemp wrote: 

 
Need to use the template http://www.digitalbiz4u.com/site_flash/ .
 
Thanks,
 
..../Ernie
 
 
 
 
 
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: June-21-10 10:09 AM
To: Ernie Kemp
Cc: 'Shreyas Agasthya'; 'PHP General List'
Subject: RE: [PHP] Website content question
 
 
 
On Mon, 2010-06-21 at 10:04 -0400, Ernie Kemp wrote: 
 
 
Just as a follow up I'm including a link to a test site that I wish to have
the wordpress to be able to change the content, but I'm unable to have
wordpress use my includes.
I must be putting them in the wrong places so need some help with this.
 
Thanks,
.../Ernie
 
 
 
 
-----Original Message-----
From: Shreyas Agasthya [mailto:shreya...@gmail.com] 
Sent: June-21-10 8:59 AM
To: Ernie Kemp
Cc: PHP General List
Subject: Re: [PHP] Website content question
 
Ernie,
 
I am sure you know none of us could have accessed the link that you have
given there. Can you let us know what code you have written so that one of
us can guide you?
 
As a broad pitch, your php code has to be either in <?php ?> or <? ?>
 
I would wait for your code and other to probe a little more.
 
Regards,
Shreyas
 
On Mon, Jun 21, 2010 at 5:11 PM, Ernie Kemp <ernie.k...@sympatico.ca> wrote:
 
>   This is not a direct PHP question but I will be using PHP in the
> website.
> 
> 
> 
> I go to the php list because the wordpress forum does not respond to my
> questions and I know some of you have a lot of expertise in other areas
than
> PHP.
> 
> 
> 
> I wish to a my own pages to a theme.
> 
> I created pages on my PC and added the code at the top of the page for
> wordpress to use the page for a template page.
> 
> I than FTP'd the file over to web hosting server template location.
> 
> Through  wordpress "administrator" I added my file called homepage.php.
> 
> 
> 
> I FTP'd my CSS, images, js and flash folders over to the template
location.
> 
> Went to load the website
> 
http://localhost/Michael-8701/site_flash/wordpress/wp-content/homepage.phpan
d all I got was the html code displayed.
> 
> 
> 
> I tried moving the folder around but same results.
> 
> Read some docs on this but it's not clear to me why this will not work.
> 
> 
> 
> Please help this is new to me and I need to get over this wall.
> 
> Thanks,
> 
> ..../Ernie
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
 
 
 


You can still do that, just convert an existing template. You've still not 
shown us the code you're using, so we can't really help you in the way you want.


Thanks,
Ash
http://www.ashleysheridan.co.uk



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.829 / Virus Database: 271.1.1/2952 - Release Date: 06/21/10 
02:36:00


--- End Message ---
--- Begin Message ---
Did you include the necessary php code?


**********************************************
Hans Åhlin
  Tel: +46761488019
  icq: 275232967
  http://www.kronan-net.com/
  irc://irc.freenode.net:6667 - TheCoin
**********************************************


2010/6/21 Ernie Kemp <ernie.k...@sympatico.ca>

>   This is not a direct PHP question but I will be using PHP in the
> website.
>
>
>
> I go to the php list because the wordpress forum does not respond to my
> questions and I know some of you have a lot of expertise in other areas than
> PHP.
>
>
>
> I wish to a my own pages to a theme.
>
> I created pages on my PC and added the code at the top of the page for
> wordpress to use the page for a template page.
>
> I than FTP’d the file over to web hosting server template location.
>
> Through  wordpress “administrator” I added my file called homepage.php.
>
>
>
> I FTP’d my CSS, images, js and flash folders over to the template location.
>
> Went to load the website
> http://localhost/Michael-8701/site_flash/wordpress/wp-content/homepage.phpand 
> all I got was the html code displayed.
>
>
>
> I tried moving the folder around but same results.
>
> Read some docs on this but it’s not clear to me why this will not work.
>
>
>
> Please help this is new to me and I need to get over this wall.
>
> Thanks,
>
> ..../Ernie
>
>
>
>
>
>
>
>
>
>
>
>
>

--- End Message ---
--- Begin Message ---
Folks,

 

I'm trying to validate an email address which is entered in a form field
against our Active Directory.

 

I'm using some PHP scripting supplied by http://phpad.sunyday.net/ but
it's not working, and the site doesn't seem to be supported anymore.

 

Does anyone have any "good" method of doing this?

 

Thanks for any info.

-Dave


--- End Message ---
--- Begin Message ---
On Mon, 2010-06-21 at 10:59 -0400, David Stoltz wrote:

> Folks,
> 
>  
> 
> I'm trying to validate an email address which is entered in a form field
> against our Active Directory.
> 
>  
> 
> I'm using some PHP scripting supplied by http://phpad.sunyday.net/ but
> it's not working, and the site doesn't seem to be supported anymore.
> 
>  
> 
> Does anyone have any "good" method of doing this?
> 
>  
> 
> Thanks for any info.
> 
> -Dave
> 


Have you looked at the LDAP functions?

http://php.net/manual/en/ref.ldap.php 

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
On Mon, Jun 21, 2010 at 8:59 AM, David Stoltz <dsto...@shh.org> wrote:

> Folks,
>
> I'm trying to validate an email address which is entered in a form field
> against our Active Directory.
>
> Does anyone have any "good" method of doing this?
>

try the adLDAP class - its the chronic

http://adldap.sourceforge.net/

-nathan

--- End Message ---
--- Begin Message ---
Awesome – thanks – BTW, what does “it’s the chronic” mean?

 

 

From: Nathan Nobbe [mailto:quickshif...@gmail.com] 
Sent: Monday, June 21, 2010 11:27 AM
To: David Stoltz
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] PHP & Active Directory?

 

On Mon, Jun 21, 2010 at 8:59 AM, David Stoltz <dsto...@shh.org> wrote:

        Folks,
        
        I'm trying to validate an email address which is entered in a form field
        against our Active Directory.
        
        Does anyone have any "good" method of doing this?

 

try the adLDAP class - its the chronic

 

http://adldap.sourceforge.net/

 

-nathan 


--- End Message ---
--- Begin Message ---
On Mon, Jun 21, 2010 at 9:42 AM, David Stoltz <dsto...@shh.org> wrote:

>  Awesome – thanks – BTW, what does “it’s the chronic” mean?
>

listen to some dr. dre or come visit me in denver, co :)

-nathan

--- End Message ---
--- Begin Message ---
Lol – ok…I guess it’s comparable to “it’s the bomb”….

 

Thanks ;-)

 

From: Nathan Nobbe [mailto:quickshif...@gmail.com] 
Sent: Monday, June 21, 2010 11:46 AM
To: David Stoltz
Cc: php-gene...@lists.php.net
Subject: Re: [PHP] PHP & Active Directory?

 

On Mon, Jun 21, 2010 at 9:42 AM, David Stoltz <dsto...@shh.org> wrote:

        Awesome – thanks – BTW, what does “it’s the chronic” mean?

 

listen to some dr. dre or come visit me in denver, co :)

 

-nathan 


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

This is just a bit of a 'throw it out to the masses' sort of question to
see what people might recommend.

At the moment, if I am retrieving a single record from the DB, my code
looks like this:

$query = "SELECT * FROM table WHERE id=1";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
    return $row;
}

Now, aside from the actual SQL involved, is this efficient? Would it
gain me anything if I used mysql_result() statements instead, or would
that only be efficient if there were a small number of fields I was
retrieving data for? Should I use something else entirely?

I've not got to the testing this myself, as I figured something like
this might be common knowledge for all of you who are better than me at
optimisation.

Is it even an issue if I'm only retrieving a single record in this
manner (I always make my id field in a table the primary key, so it
means I won't ever be retrieving more than one record)

Thanks in advance for any input you guys have!

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message --- Performance-wise, SELECT * is slower than specifying fields (marginally). If you just want a single field then mysql_result() will be faster, but if you want multiple fields mysql_fetch_* is your best bet.

As far as the PHP goes, if you know there will be only a single record I'd suggest using:

if ($row = mysql_fetch_array($result)) {
  // Do stuff
}

As then you get an automatic "not found" else condition you can use. That should be the same performance as the while, but get you the extra information.

That said, you really shouldn't be using ext/mysql anymore. Use either ext/mysqli or PDO. Better APIs, more secure, faster, and actually maintained.

--Larry Garfield

On 6/21/10 1:31 PM, Ashley Sheridan wrote:
Hi All,

This is just a bit of a 'throw it out to the masses' sort of question to
see what people might recommend.

At the moment, if I am retrieving a single record from the DB, my code
looks like this:

$query = "SELECT * FROM table WHERE id=1";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
     return $row;
}

Now, aside from the actual SQL involved, is this efficient? Would it
gain me anything if I used mysql_result() statements instead, or would
that only be efficient if there were a small number of fields I was
retrieving data for? Should I use something else entirely?

I've not got to the testing this myself, as I figured something like
this might be common knowledge for all of you who are better than me at
optimisation.

Is it even an issue if I'm only retrieving a single record in this
manner (I always make my id field in a table the primary key, so it
means I won't ever be retrieving more than one record)

Thanks in advance for any input you guys have!

Thanks,
Ash
http://www.ashleysheridan.co.uk




--- End Message ---

Reply via email to