php-general Digest 12 Jul 2008 21:00:56 -0000 Issue 5565

Topics (messages 276683 through 276708):

Most popular per month
        276683 by: Ryan S

IPv6 validation
        276684 by: Yeti
        276685 by: Kevin Waterson
        276686 by: Bernhard Kohl
        276690 by: Eric Butera
        276691 by: Yeti
        276701 by: Eric Butera
        276708 by: Kevin Waterson

Re: OT - RE: [PHP] scalable web gallery
        276687 by: David Giragosian
        276689 by: tedd
        276692 by: David Giragosian
        276695 by: Daniel Brown
        276697 by: David Giragosian
        276702 by: Robert Cummings
        276707 by: tedd

Re: case and accent - insensitive regular expression?
        276688 by: tedd

Passing arguments as they are received to another function
        276693 by: Luigi Perroti
        276694 by: James Dempster
        276698 by: Luigi Perroti
        276699 by: James Dempster
        276700 by: Luigi Perroti

Re: scalable web gallery
        276696 by: Daniel Brown
        276703 by: Robert Cummings
        276704 by: tedd
        276705 by: Robert Cummings
        276706 by: Daniel Brown

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 ---
Hey!
Thanks for replying!



<snip>
..
.
$perc50=(img50 int)/$total;

You can do it per day, per month, per year, per 28 days, per PMS cycle, 
per anything you want provided you have the data to do it.
</snip>

:) this is the part where i am a bit confused actually, can you give me one or 
two examples and i'll work from there?


<snip>
Google had an pie chart thingie, check the archives of this list.
</snip>

Thanks! Will do!

Cheers!
Ryan


      

--- End Message ---
--- Begin Message ---
Hello community,

I have been working with alot of IPv6 lately.

Now i was wondering of what there might be the best way to validate an IPv6
address.

Couldn't think of any working regexp, since even ::1 or :: is valid
(localhost), so i tried it the following way:

<?php
//RFC 4291
//http://tools.ietf.org/html/rfc4291
function validate_ipv6($value) {
 if (substr_count($value, ":") < 2) return false; // has to contain ":" at
least twice like in ::1 or 1234::abcd
 if (substr_count($value, "::") > 1) return false; // only 1 double colon
allowed
 $groups = explode(':', $value);
 $num_groups = count($groups);
 if (($num_groups > 8) || ($num_groups < 3)) return false; // 3-8 groups of
0-4 digits (1 group has to be at leas 1 digit)
 $empty_groups = 0;
 foreach ($groups as $group) {
  $group = trim($group);
  if (!empty($group) && !(is_numeric($group) && ($group == 0))) {
  if (!preg_match('#([a-fA-F0-9]{0,4})#', $group)) return false;
  } else ++$empty_groups;
 }
 return ($empty_groups < $num_groups) ? true : false; // the unspecified
address :: is not valid in this case
}
var_dump(validate_ipv6("::")); // false (wanted result)
var_dump(validate_ipv6("::1")); // true
var_dump(validate_ipv6("1234::abcd")); // true
var_dump(validate_ipv6("2001:DB8:0:0:8:800:200C:417A")); // true
var_dump(validate_ipv6("0:0:0:0:0:0:0:1")); // true
var_dump(validate_ipv6("0:0:0:0:0:0:0:0")); // false (wanted result)
var_dump(validate_ipv6("0000:0000:0000:0000:0000:0000:0000:0000")); // false
(wanted result)
var_dump(validate_ipv6("2001:0DB8:0000:CD30:0000:0000:0000:0000")); // true
var_dump(validate_ipv6("FF01:0:0:0:0:0:0:101")); // true
var_dump(validate_ipv6("bananas")); // false
var_dump(validate_ipv6("1:2:3:4:5:6:7:8:9")); // false
?>

anybody with better ideas?

Yeti

--- End Message ---
--- Begin Message ---
This one time, at band camp, Yeti <[EMAIL PROTECTED]> wrote:

> Now i was wondering of what there might be the best way to validate an IPv6
> address.

from this url..
http://phpro.org/tutorials/Filtering-Data-with-PHP.html#9

<?php

/*** an IP address ***/
$ip = "2001:0db8:85a3:08d3:1319:8a2e:0370:7334";

/*** try to validate as IPV6 address ***/
if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === FALSE)
        {
        echo "$ip is not a valid IP";
        }
else
        {
        echo "$ip is valid";
        }
?>

--- End Message ---
--- Begin Message ---
Doesnt filter_var() require PHP5+ ?

I have quite some systems still running 4.4.8.

On 7/12/08, Kevin Waterson <[EMAIL PROTECTED]> wrote:
>
> This one time, at band camp, Yeti <[EMAIL PROTECTED]> wrote:
>
> > Now i was wondering of what there might be the best way to validate an
> IPv6
> > address.
>
>
> from this url..
> http://phpro.org/tutorials/Filtering-Data-with-PHP.html#9
>
> <?php
>
> /*** an IP address ***/
> $ip = "2001:0db8:85a3:08d3:1319:8a2e:0370:7334";
>
> /*** try to validate as IPV6 address ***/
> if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === FALSE)
>         {
>         echo "$ip is not a valid IP";
>         }
> else
>         {
>         echo "$ip is valid";
>         }
> ?>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Sat, Jul 12, 2008 at 9:13 AM, Bernhard Kohl <[EMAIL PROTECTED]> wrote:
> Doesnt filter_var() require PHP5+ ?
>
> I have quite some systems still running 4.4.8.
>
> On 7/12/08, Kevin Waterson <[EMAIL PROTECTED]> wrote:
>>
>> This one time, at band camp, Yeti <[EMAIL PROTECTED]> wrote:
>>
>> > Now i was wondering of what there might be the best way to validate an
>> IPv6
>> > address.
>>
>>
>> from this url..
>> http://phpro.org/tutorials/Filtering-Data-with-PHP.html#9
>>
>> <?php
>>
>> /*** an IP address ***/
>> $ip = "2001:0db8:85a3:08d3:1319:8a2e:0370:7334";
>>
>> /*** try to validate as IPV6 address ***/
>> if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === FALSE)
>>         {
>>         echo "$ip is not a valid IP";
>>         }
>> else
>>         {
>>         echo "$ip is valid";
>>         }
>> ?>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

PHP4 has been deprecated forever now.  Step up to the plate and get
with 5, especially if you're still writing new code.

--- End Message ---
--- Begin Message ---
It will still take some time until every provider has PHP5 running, at least
where I am from. I have many customers who want me to get their sites
running on some cheap webspace they got along with their internet
connection. Then you have to tell them it won't work because of some problem
with the versions. I would love to write code for PHP5+ only.

On 7/12/08, Eric Butera <[EMAIL PROTECTED]> wrote:
>
> On Sat, Jul 12, 2008 at 9:13 AM, Bernhard Kohl <[EMAIL PROTECTED]> wrote:
> > Doesnt filter_var() require PHP5+ ?
> >
> > I have quite some systems still running 4.4.8.
> >
> > On 7/12/08, Kevin Waterson <[EMAIL PROTECTED]> wrote:
> >>
> >> This one time, at band camp, Yeti <[EMAIL PROTECTED]> wrote:
> >>
> >> > Now i was wondering of what there might be the best way to validate an
> >> IPv6
> >> > address.
> >>
> >>
> >> from this url..
> >> http://phpro.org/tutorials/Filtering-Data-with-PHP.html#9
> >>
> >> <?php
> >>
> >> /*** an IP address ***/
> >> $ip = "2001:0db8:85a3:08d3:1319:8a2e:0370:7334";
> >>
> >> /*** try to validate as IPV6 address ***/
> >> if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === FALSE)
> >>         {
> >>         echo "$ip is not a valid IP";
> >>         }
> >> else
> >>         {
> >>         echo "$ip is valid";
> >>         }
> >> ?>
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
>
>
> PHP4 has been deprecated forever now.  Step up to the plate and get
> with 5, especially if you're still writing new code.
>

--- End Message ---
--- Begin Message ---
On Sat, Jul 12, 2008 at 11:24 AM, Yeti <[EMAIL PROTECTED]> wrote:
> It will still take some time until every provider has PHP5 running, at least
> where I am from. I have many customers who want me to get their sites
> running on some cheap webspace they got along with their internet
> connection. Then you have to tell them it won't work because of some problem
> with the versions. I would love to write code for PHP5+ only.
>
> On 7/12/08, Eric Butera <[EMAIL PROTECTED]> wrote:
>>
>> On Sat, Jul 12, 2008 at 9:13 AM, Bernhard Kohl <[EMAIL PROTECTED]> wrote:
>> > Doesnt filter_var() require PHP5+ ?
>> >
>> > I have quite some systems still running 4.4.8.
>> >
>> > On 7/12/08, Kevin Waterson <[EMAIL PROTECTED]> wrote:
>> >>
>> >> This one time, at band camp, Yeti <[EMAIL PROTECTED]> wrote:
>> >>
>> >> > Now i was wondering of what there might be the best way to validate
>> >> > an
>> >> IPv6
>> >> > address.
>> >>
>> >>
>> >> from this url..
>> >> http://phpro.org/tutorials/Filtering-Data-with-PHP.html#9
>> >>
>> >> <?php
>> >>
>> >> /*** an IP address ***/
>> >> $ip = "2001:0db8:85a3:08d3:1319:8a2e:0370:7334";
>> >>
>> >> /*** try to validate as IPV6 address ***/
>> >> if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === FALSE)
>> >>         {
>> >>         echo "$ip is not a valid IP";
>> >>         }
>> >> else
>> >>         {
>> >>         echo "$ip is valid";
>> >>         }
>> >> ?>
>> >>
>> >>
>> >> --
>> >> PHP General Mailing List (http://www.php.net/)
>> >> To unsubscribe, visit: http://www.php.net/unsub.php
>> >>
>> >>
>> >
>>
>>
>> PHP4 has been deprecated forever now.  Step up to the plate and get
>> with 5, especially if you're still writing new code.
>
>

I installed php5 on my local dev box years ago.  Since then, I've been
pulling down random sites off our servers and testing them and fixing
little gotchas.  Out of the hundreds of sites we host there were only
a few problems and once I figured out what those were it really became
quite easy to fix the issues with find and replace techniques.  Most
of it was limited to my oop code. ;)  So while I do understand this
argument, it is pretty old and needs to just stop.  Nobody was paying
my company to upgrade and fix code that busted in the transition.  It
is just the nature of the business.

--- End Message ---
--- Begin Message ---
This one time, at band camp, Yeti <[EMAIL PROTECTED]> wrote:

> It will still take some time until every provider has PHP5 running, at least
> where I am from. I have many customers who want me to get their sites
> running on some cheap webspace they got along with their internet
> connection. Then you have to tell them it won't work because of some problem
> with the versions. I would love to write code for PHP5+ only.This is a 
> terrible excuse for using 

PHP 4. Today, July 13, marks 4 years since
the release of PHP 5.0. _4 YEARS_ to move applications and code to PHP5.

Its either apathy or incometence.
Kevin

--- End Message ---
--- Begin Message ---
 Todd Boyd recently offered:

> Haven't taken a distributed computing class just yet, but I've still got
> a bit until I graduate, and these elective credits are burning a hole in
> my pocket...


The cost of public colleges and universities, as well as community colleges,
are truly astounding these days. I for one am quite happy learning from
books, web tutorials and the occasional ( ;-g ) mailing list thread.

--David.

--- End Message ---
--- Begin Message ---
At 9:13 AM -0500 7/12/08, David Giragosian wrote:
 Todd Boyd recently offered:

 Haven't taken a distributed computing class just yet, but I've still got
 a bit until I graduate, and these elective credits are burning a hole in
 my pocket...

The cost of public colleges and universities, as well as community colleges,
are truly astounding these days. I for one am quite happy learning from
books, web tutorials and the occasional ( ;-g ) mailing list thread.

--David.

Yes, but college degrees are the bill of goods we've been sold. We are lead to believe that if our children (and us) go to colleges and get that sheepskin then everything will be great for the rest of our lives. But unfortunately, that's not true.

In the meantime, academia and politician still demand more funding waving the same banner of yesteryear -- "Your children's education needs improving" -- while continuing to fail miserably in the global arena.

Like with everything else, you really don't realize the problem until you bounce off the bottom. We just haven't reached that yet, but we're doing our level best to get there.

Cheers (I guess),

tedd

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

--- End Message ---
--- Begin Message ---
On 7/12/08, tedd <[EMAIL PROTECTED]> wrote:
>
> At 9:13 AM -0500 7/12/08, David Giragosian wrote:
>
>>  Todd Boyd recently offered:
>>
>>  Haven't taken a distributed computing class just yet, but I've still got
>>>  a bit until I graduate, and these elective credits are burning a hole in
>>>  my pocket...
>>>
>>
>> The cost of public colleges and universities, as well as community
>> colleges,
>> are truly astounding these days. I for one am quite happy learning from
>> books, web tutorials and the occasional ( ;-g ) mailing list thread.
>>
>> --David.
>>
>
> Yes, but college degrees are the bill of goods we've been sold. We are lead
> to believe that if our children (and us) go to colleges and get that
> sheepskin then everything will be great for the rest of our lives. But
> unfortunately, that's not true.
>
> In the meantime, academia and politician still demand more funding waving
> the same banner of yesteryear -- "Your children's education needs improving"
> -- while continuing to fail miserably in the global arena.
>
> Like with everything else, you really don't realize the problem until you
> bounce off the bottom. We just haven't reached that yet, but we're doing our
> level best to get there.
>
> Cheers (I guess),
>
> tedd


We had an article in our local paper yesterday about the guy that made and
'starred' in the video that Daniel posted about here a couple of weeks ago
(Matt of 'Where in the World is Matt', fame). Seems his father didn't think
he was mature enough to be able to benefit from college, and he was advised
to do some traveling instead. That apparently led to an early version of the
current 15-minutes-of-fame video. When I read that, I thought, not everybody
is buying into the college degree to 'success' route. But that I'm sure is
the exception rather than the rule. I think the bigger problem, for
education and the USA at least, is that there are few middle-class jobs to
be prepared for, despite what you might learn in school. Learning for the
sake of learning is wonderful, and yes, I think it does benefit society by
broadening one's perspective, but as a path to financial success, defined
here as being able to support yourself and raise a family, I agree that a
college degree is a dicey undertaking for the expense.

(And to be clear, I've completed 10 years of post high school education.)

--David.

--- End Message ---
--- Begin Message ---
On Sat, Jul 12, 2008 at 11:36 AM, David Giragosian
<[EMAIL PROTECTED]> wrote:
>
> We had an article in our local paper yesterday about the guy that made and
> 'starred' in the video that Daniel posted about here a couple of weeks ago
> (Matt of 'Where in the World is Matt', fame).

    That was actually something I sent to just a few people directly.
However, if anyone wants to see it --- and I recommend it, because
it's "geekily-neat" --- you can view the video, entitled "Dancing
2008", at this link:

        http://www.wherethehellismatt.com/

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

--- End Message ---
--- Begin Message ---
On 7/12/08, Daniel Brown <[EMAIL PROTECTED]> wrote:
>
> On Sat, Jul 12, 2008 at 11:36 AM, David Giragosian
> <[EMAIL PROTECTED]> wrote:
> >
> > We had an article in our local paper yesterday about the guy that made
> and
> > 'starred' in the video that Daniel posted about here a couple of weeks
> ago
> > (Matt of 'Where in the World is Matt', fame).
>
>    That was actually something I sent to just a few people directly.
> However, if anyone wants to see it --- and I recommend it, because
> it's "geekily-neat" --- you can view the video, entitled "Dancing
> 2008", at this link:
>
>        http://www.wherethehellismatt.com/


Oops. My mistake.

--David.

--- End Message ---
--- Begin Message ---
On Sat, 2008-07-12 at 10:43 -0400, tedd wrote:
> At 9:13 AM -0500 7/12/08, David Giragosian wrote:
> >  Todd Boyd recently offered:
> >
> >>  Haven't taken a distributed computing class just yet, but I've still got
> >>  a bit until I graduate, and these elective credits are burning a hole in
> >>  my pocket...
> >
> >The cost of public colleges and universities, as well as community colleges,
> >are truly astounding these days. I for one am quite happy learning from
> >books, web tutorials and the occasional ( ;-g ) mailing list thread.
> >
> >--David.
> 
> Yes, but college degrees are the bill of goods we've been sold. We 
> are lead to believe that if our children (and us) go to colleges and 
> get that sheepskin then everything will be great for the rest of our 
> lives. But unfortunately, that's not true.

That may be why you went... but I triple major'd in drinking beer and
picking up chicks... hence the extra years I put in and all the
psychology electives ;)

It was well worth the investment... I met my wife there and our third
child will arrive in October.

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


--- End Message ---
--- Begin Message ---
At 2:35 PM -0400 7/12/08, Robert Cummings wrote:
On Sat, 2008-07-12 at 10:43 -0400, tedd wrote:
 > Yes, but college degrees are the bill of goods we've been sold. We
 are lead to believe that if our children (and us) go to colleges and
 get that sheepskin then everything will be great for the rest of our
 lives. But unfortunately, that's not true.

That may be why you went... but I triple major'd in drinking beer and
picking up chicks... hence the extra years I put in and all the
psychology electives ;)

It was well worth the investment... I met my wife there and our third
child will arrive in October.

Cheers,
Rob.

Well, most of us can have kids without college instruction.  :-)

I didn't go to college to make money, I went for other reasons. But, that didn't stop me from making and spending a couple million. College should have taught me how to save.

Cheers,

tedd

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

--- End Message ---
--- Begin Message ---
At 9:36 AM +0200 7/12/08, Giulio Mastrosanti wrote:
Hi,
I have a php page that asks user for a key ( or a list of keys ) and then shows a list of items matching the query.

every item in the list shows its data, and the list of keys it has ( a list of comma-separated words )

I would like to higlight, in the list of keys shown for every item,
the words matching the query,

this can be easily achieved with a search and replace, for every search word, i search it in the key list and replace it adding a style tag to higlight it such as for example to have it in red color:

if ( @stripos($keylist,$keysearch!== false ) {
$keylist = str_ireplace($keysearch,'<span style="color: #FF0000">'.$keysearch.'</span>',$keylist);
}

but i have some problem with accented characters:

i have mysql with character encoding utf8, and all the php pages are declared as utf8

mysql in configured to perform queries in  a case and accent insensitive way.
this mean that if you search for the word 'cafe', you have returned rows that contains in the keyword list 'cafe', but also 'café' with the accent. ( I think it has to do with 'collation' settings, but I'm not investigating at the moment because it is OK for me the way it works ).

now my problem is to find a way ( I imagine with some kind of regular expression ) to achieve in php a search and replace accent-insensitive, so that i can find the word 'cafe' in a string also if it is 'café', or 'CAFÉ', or 'CAFE', and vice-versa.

hope the problem is clear and well-explained in english,

thank you for any tip,

    Giulio

Giulio:

Three things:

1. Your English is fine.

2. Try using mb_ereg_replace()

http://www.php.net/mb_ereg_replace

Place the accents you want to change in that and change them to whatever you want.

3. Change:

<span style="color: #FF0000">'.$keysearch.'</span>'

to

<span class="keysearch">'.$keysearch.'</span>'

and add

.keysearch
   {
   color: #FF0000;
   }

to your css.

Cheers,

tedd


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

--- End Message ---
--- Begin Message ---
Hello, I'm trying to implement a few simple wrappers for some PHP functions.

Here's an example of what I'm trying to do:

function myWrapper() {
    return defaultPhpFunction(func_get_args());
}

The example above is broken since I'm just passing an array to the original
function.

The only way to achieve the desired result that I've found is something like
this:

function myWrapper() {
    $argsNumber = func_num_args();
    if ($argsNumber == 1) {
        return defaultPhpFunction(func_get_arg(0));
    }
    elseif ($argsNumber == 2) {
        return defaultPhpFunction(func_get_arg(0), func_get_arg(1));
    }
    // ...
    // ...
    // ...
}

Since the above code is clumsy to say the least any advice would be welcome.
Thanks for your time!

--- End Message ---
--- Begin Message ---
You might want to take a look at
http://php.net/manual/en/function.call-user-func-array.php



On Sat, Jul 12, 2008 at 4:57 PM, Luigi Perroti <[EMAIL PROTECTED]>
wrote:

> Hello, I'm trying to implement a few simple wrappers for some PHP
> functions.
>
> Here's an example of what I'm trying to do:
>
> function myWrapper() {
>    return defaultPhpFunction(func_get_args());
> }
>
> The example above is broken since I'm just passing an array to the original
> function.
>
> The only way to achieve the desired result that I've found is something
> like
> this:
>
> function myWrapper() {
>    $argsNumber = func_num_args();
>    if ($argsNumber == 1) {
>        return defaultPhpFunction(func_get_arg(0));
>    }
>    elseif ($argsNumber == 2) {
>        return defaultPhpFunction(func_get_arg(0), func_get_arg(1));
>    }
>    // ...
>    // ...
>    // ...
> }
>
> Since the above code is clumsy to say the least any advice would be
> welcome.
> Thanks for your time!
>

--- End Message ---
--- Begin Message ---
On Sat, Jul 12, 2008 at 6:00 PM, James Dempster wrote:

> You might want to take a look at
> http://php.net/manual/en/function.call-user-func-array.php



Thank you very much for your suggestion.
I've looked into it but I guess this doesn't work with what I'm trying to
do, although what you suggested should indeed work perfectly with my
previous example.
Here's a snippet from the code that I'm having problems with:

class MainDatabase {
    private static $mainDatabase = NULL;
    private static $statement = NULL;
    //...
    //...
    //...
    public static function prepare($query) {
        self::$mainDatabase->beginTransaction();
        self::$statement = self::$mainDatabase->prepare($query);
    }
    public static function bindParam() {

self::$statement->call_user_func_array(array('PDOStatement','bindParam'),func_get_args());
        // Results in:
        // PHP Fatal error:  Call to undefined method
PDOStatement::call_user_func_array() ...
        // I've also tried with
call_user_func_array('PDOStatement::fetchAll',func_get_args());
        // but no luck, same error.
    }
    //...
    //...
    //...
}

I thought that a solution for the previous example would work in this
scenario too, but I guess this isn't the case.
Any further suggestions would be very welcome, thanks.

--- End Message ---
--- Begin Message ---
On the line where you have
self::$statement->call_user_func_array(array('PDOStatement','bindParam'),func_get_args());
try this

call_user_func_array(array(self::$statement,'bindParam'),func_get_args());

see if that works...?


On Sat, Jul 12, 2008 at 5:36 PM, Luigi Perroti <[EMAIL PROTECTED]>
wrote:

> On Sat, Jul 12, 2008 at 6:00 PM, James Dempster wrote:
>
> > You might want to take a look at
> > http://php.net/manual/en/function.call-user-func-array.php
>
>
>
> Thank you very much for your suggestion.
> I've looked into it but I guess this doesn't work with what I'm trying to
> do, although what you suggested should indeed work perfectly with my
> previous example.
> Here's a snippet from the code that I'm having problems with:
>
> class MainDatabase {
>    private static $mainDatabase = NULL;
>    private static $statement = NULL;
>    //...
>    //...
>    //...
>    public static function prepare($query) {
>        self::$mainDatabase->beginTransaction();
>        self::$statement = self::$mainDatabase->prepare($query);
>    }
>    public static function bindParam() {
>
>
> self::$statement->call_user_func_array(array('PDOStatement','bindParam'),func_get_args());
>        // Results in:
>        // PHP Fatal error:  Call to undefined method
> PDOStatement::call_user_func_array() ...
>        // I've also tried with
> call_user_func_array('PDOStatement::fetchAll',func_get_args());
>        // but no luck, same error.
>    }
>    //...
>    //...
>    //...
> }
>
> I thought that a solution for the previous example would work in this
> scenario too, but I guess this isn't the case.
> Any further suggestions would be very welcome, thanks.
>

--- End Message ---
--- Begin Message ---
On Sat, Jul 12, 2008 at 6:42 PM, James Dempster <[EMAIL PROTECTED]> wrote:

> On the line where you have
> self::$statement->call_user_func_array(array('PDOStatement','bindParam'),func_get_args());
> try this
>
> call_user_func_array(array(self::$statement,'bindParam'),func_get_args());
>
> see if that works...?
>

Thanks, this is working fine. I only had to make the following adjustment:

  $args = func_get_args();
  call_user_func_array(array(self::$statement,'bindParam'),$args);

since func_get_args as an argument is allowed only on user defined
functions.

Thank you very much for your time!

Regards,
Luigi

--- End Message ---
--- Begin Message ---
On Fri, Jul 11, 2008 at 10:02 PM, tedd <[EMAIL PROTECTED]> wrote:
>
> For example, tedd.gif would compute to 4, whereas Rob.gif would be a meager
> 3, and Daniel.gif would be a six (which is probably over-rated for him
> anyway).  :-)

    Hope you didn't break a hip while making yourself laugh there, old man.  ;-P

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

--- End Message ---
--- Begin Message ---
On Sat, 2008-07-12 at 12:03 -0400, Daniel Brown wrote:
> On Fri, Jul 11, 2008 at 10:02 PM, tedd <[EMAIL PROTECTED]> wrote:
> >
> > For example, tedd.gif would compute to 4, whereas Rob.gif would be a meager
> > 3, and Daniel.gif would be a six (which is probably over-rated for him
> > anyway).  :-)
> 
>     Hope you didn't break a hip while making yourself laugh there, old man.  
> ;-P

Does it count if I broke a sweat?

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


--- End Message ---
--- Begin Message ---
At 12:03 PM -0400 7/12/08, Daniel Brown wrote:
On Fri, Jul 11, 2008 at 10:02 PM, tedd <[EMAIL PROTECTED]> wrote:

 For example, tedd.gif would compute to 4, whereas Rob.gif would be a meager
 3, and Daniel.gif would be a six (which is probably over-rated for him
 anyway).  :-)

Hope you didn't break a hip while making yourself laugh there, old man. ;-P

Hey, let's knock off that old shit, newlywed !

Just because you finally got laid doesn't mean you can beat me in memory loss. :-)

Cheers,

tedd

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

--- End Message ---
--- Begin Message ---
On Sat, 2008-07-12 at 14:37 -0400, tedd wrote:
> At 12:03 PM -0400 7/12/08, Daniel Brown wrote:
> >On Fri, Jul 11, 2008 at 10:02 PM, tedd <[EMAIL PROTECTED]> wrote:
> >>
> >>  For example, tedd.gif would compute to 4, whereas Rob.gif would be a 
> >> meager
> >>  3, and Daniel.gif would be a six (which is probably over-rated for him
> >>  anyway).  :-)
> >
> >     Hope you didn't break a hip while making yourself laugh there, 
> >old man.  ;-P
> 
> Hey, let's knock off that old shit, newlywed !
> 
> Just because you finally got laid doesn't mean you can beat me in 
> memory loss. :-)

Just because he got married doesn't mean he got laid :P

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


--- End Message ---
--- Begin Message ---
On Sat, Jul 12, 2008 at 2:37 PM, tedd <[EMAIL PROTECTED]> wrote:
>
> Hey, let's knock off that old shit, newlywed !
>
> Just because you finally got laid doesn't mean you can beat me in memory
> loss. :-)

    That's "lei'd", sir.

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

--- End Message ---

Reply via email to