php-general Digest 19 Mar 2010 21:01:36 -0000 Issue 6648

Topics (messages 302995 through 303020):

Re: web sniffer
        302995 by: Jochen Schultz
        302996 by: Peter Lind
        302997 by: madunix
        303000 by: Jay Blanchard
        303001 by: Ashley Sheridan
        303002 by: Jochen Schultz
        303003 by: Jochen Schultz
        303004 by: Rene Veerman

Re: PHP in HTML code
        302998 by: Michael A. Peters
        302999 by: Peter Lind

any reason *not* to use PEAR DB module when accessing mysql?
        303005 by: Robert P. J. Day
        303007 by: Ashley Sheridan
        303010 by: Paul M Foster
        303011 by: Adam Richardson
        303012 by: Rene Veerman
        303014 by: Nilesh Govindarajan
        303015 by: larry.garfieldtech.com
        303016 by: Mattias Thorslund
        303017 by: Lester Caine
        303018 by: Robert P. J. Day

need a free sql table layout diagram app for linux, not phpmyadmin coz it has a 
bug with >7 tables opened in its designer.
        303006 by: Rene Veerman
        303008 by: Ashley Sheridan
        303013 by: Rene Veerman

Re: Example of good PHP namespace usage?
        303009 by: Adam Richardson

Event/Exhibition Organizers Management Software
        303019 by: Jochem Maas

where to make observations about current PHP manual?
        303020 by: Robert P. J. Day

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 --- Btw., when you use file_get_contets, is there a good way to tell the script to stop recieving the file after let's say 2 seconds - just in case the server is not reachable - to avoid using fsockopen?

regards
Jochen

madunix schrieb:
okay ..it works now i use
<?php
$data=file_get_contents("http://www.my.com";);
echo $data;
?>

On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson <simples...@gmail.com> wrote:
On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan <a...@ashleysheridan.co.uk>
wrote:
On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
trying http://us3.php.net/manual/en/function.fsockopen.php
do you a piece of code that  read parts  pages.


On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:


        On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

        > I've been trying to read the contents from a particular URL
into a
        > string in PHP, and can't get it to work.  any help.
        >
        > Thanks
        >
        > --
        > If there is a way, I will find one...***
        > If there is none, I will make one..."***
        > **************** madunix  ******************
        >




        How have you been trying to do it so far?

        There are a couple of ways. file_get_contents() and fopen()
        will work on URL's if the right ports are open.

        Most usually though cURL is used for this sort of thing.

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







--
If there is a way, I will find one...***
If there is none, I will make one..."***
**************** madunix  ******************


I think you're over-complicating things by using fsockopen(). Try one of
the functions I mentioned in my last email

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


I agree with Ashley, use one of the other options and then parse the
response to get the part of the page you'd like to work with.

--
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com





--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900            -
 26188 Edewecht      - GF: Michael Müllmann

--- End Message ---
--- Begin Message ---
You should be able to do that by setting context options:
http://www.php.net/manual/en/context.http.php

On 19 March 2010 08:53, Jochen Schultz <jschu...@sportimport.de> wrote:
> Btw., when you use file_get_contets, is there a good way to tell the script
> to stop recieving the file after let's say 2 seconds - just in case the
> server is not reachable - to avoid using fsockopen?
>
> regards
> Jochen
>
> madunix schrieb:
>>
>> okay ..it works now i use
>> <?php
>> $data=file_get_contents("http://www.my.com";);
>> echo $data;
>> ?>
>>
>> On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson <simples...@gmail.com>
>> wrote:
>>>
>>> On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
>>> <a...@ashleysheridan.co.uk>
>>> wrote:
>>>>
>>>> On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
>>>>>
>>>>> trying http://us3.php.net/manual/en/function.fsockopen.php
>>>>> do you a piece of code that  read parts  pages.
>>>>>
>>>>>
>>>>> On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
>>>>> <a...@ashleysheridan.co.uk> wrote:
>>>>>
>>>>>
>>>>>        On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:
>>>>>
>>>>>        > I've been trying to read the contents from a particular URL
>>>>> into a
>>>>>        > string in PHP, and can't get it to work.  any help.
>>>>>        >
>>>>>        > Thanks
>>>>>        >
>>>>>        > --
>>>>>        > If there is a way, I will find one...***
>>>>>        > If there is none, I will make one..."***
>>>>>        > **************** madunix  ******************
>>>>>        >
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>        How have you been trying to do it so far?
>>>>>
>>>>>        There are a couple of ways. file_get_contents() and fopen()
>>>>>        will work on URL's if the right ports are open.
>>>>>
>>>>>        Most usually though cURL is used for this sort of thing.
>>>>>
>>>>>        Thanks,
>>>>>        Ash
>>>>>        http://www.ashleysheridan.co.uk
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> If there is a way, I will find one...***
>>>>> If there is none, I will make one..."***
>>>>> **************** madunix  ******************
>>>>>
>>>>>
>>>> I think you're over-complicating things by using fsockopen(). Try one of
>>>> the functions I mentioned in my last email
>>>>
>>>> Thanks,
>>>> Ash
>>>> http://www.ashleysheridan.co.uk
>>>>
>>>>
>>> I agree with Ashley, use one of the other options and then parse the
>>> response to get the part of the page you'd like to work with.
>>>
>>> --
>>> Nephtali:  PHP web framework that functions beautifully
>>> http://nephtaliproject.com
>>>
>>
>>
>>
>
> --
>  Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
>  Industriestrasse 39 - HRB 1202900            -
>  26188 Edewecht      - GF: Michael Müllmann
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>

--- End Message ---
--- Begin Message ---
can any one give a complete sample script how to retrieve data content
from web (jpg, pdf, field).

Thanks

On Fri, Mar 19, 2010 at 9:53 AM, Jochen Schultz <jschu...@sportimport.de> wrote:
> Btw., when you use file_get_contets, is there a good way to tell the script
> to stop recieving the file after let's say 2 seconds - just in case the
> server is not reachable - to avoid using fsockopen?
>
> regards
> Jochen
>
> madunix schrieb:
>>
>> okay ..it works now i use
>> <?php
>> $data=file_get_contents("http://www.my.com";);
>> echo $data;
>> ?>
>>
>> On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson <simples...@gmail.com>
>> wrote:
>>>
>>> On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
>>> <a...@ashleysheridan.co.uk>
>>> wrote:
>>>>
>>>> On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
>>>>>
>>>>> trying http://us3.php.net/manual/en/function.fsockopen.php
>>>>> do you a piece of code that  read parts  pages.
>>>>>
>>>>>
>>>>> On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
>>>>> <a...@ashleysheridan.co.uk> wrote:
>>>>>
>>>>>
>>>>>        On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:
>>>>>
>>>>>        > I've been trying to read the contents from a particular URL
>>>>> into a
>>>>>        > string in PHP, and can't get it to work.  any help.
>>>>>        >
>>>>>        > Thanks
>>>>>        >
>>>>>        > --
>>>>>        > If there is a way, I will find one...***
>>>>>        > If there is none, I will make one..."***
>>>>>        > **************** madunix  ******************
>>>>>        >
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>        How have you been trying to do it so far?
>>>>>
>>>>>        There are a couple of ways. file_get_contents() and fopen()
>>>>>        will work on URL's if the right ports are open.
>>>>>
>>>>>        Most usually though cURL is used for this sort of thing.
>>>>>
>>>>>        Thanks,
>>>>>        Ash
>>>>>        http://www.ashleysheridan.co.uk
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> If there is a way, I will find one...***
>>>>> If there is none, I will make one..."***
>>>>> **************** madunix  ******************
>>>>>
>>>>>
>>>> I think you're over-complicating things by using fsockopen(). Try one of
>>>> the functions I mentioned in my last email
>>>>
>>>> Thanks,
>>>> Ash
>>>> http://www.ashleysheridan.co.uk
>>>>
>>>>
>>> I agree with Ashley, use one of the other options and then parse the
>>> response to get the part of the page you'd like to work with.
>>>
>>> --
>>> Nephtali:  PHP web framework that functions beautifully
>>> http://nephtaliproject.com
>>>
>>
>>
>>
>
> --
>  Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
>  Industriestrasse 39 - HRB 1202900            -
>  26188 Edewecht      - GF: Michael Müllmann
>



-- 
If there is a way, I will find one...***
If there is none, I will make one..."***
**************** madunix  ******************

--- End Message ---
--- Begin Message ---
[snip]
can any one give a complete sample script how to retrieve data content
from web (jpg, pdf, field).
[/snip]

Your question is a little too far reaching. You can use string functions
match portions of strings including tried and true regular expressions.

What do you want to do, specifically?

--- End Message ---
--- Begin Message ---
On Fri, 2010-03-19 at 06:25 -0500, Jay Blanchard wrote:

> [snip]
> can any one give a complete sample script how to retrieve data content
> from web (jpg, pdf, field).
> [/snip]
> 
> Your question is a little too far reaching. You can use string functions
> match portions of strings including tried and true regular expressions.
> 
> What do you want to do, specifically?


I assume he wants to retrieve the files for a page as well.

I'd recommend having PHP call wget on the shell, as that tool was built
for this sort of thing.

If you don't have access to wget, then you could use some sort of DOM or
string manipulation to find out what files are used in a web page and
then make separate requests via cURL to grab those, as
file_get_contents() might not be totally reliable for this sort of
thing.

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



--- End Message ---
--- Begin Message ---
Maybe this code may help you getting into it?

<?php

class simpleHttpSocket {

public function sendHttpRequest($host,$filename,$port=80,$timeout=1,$x=0,$result=array()) {
    $header  = 'GET /'.$filename.' HTTP/1.1'.PHP_EOL;
    $header .= 'Host: '.$host.PHP_EOL;
    $header .= 'Connection: close'.PHP_EOL;
    $header .= 'User-Agent: Simple(php-gene...@lists.php.net)'.PHP_EOL;
    $header .= "Referer: http://test-server.tld/".PHP_EOL.PHP_EOL;
    $sock...@fsockopen($host, $port, &$errno, &$errstr, $timeout);
    $result[-1]='';
    if (!$socket){
      trigger_error('Connection timeout',E_USER_NOTICE);
      $result["errno"]  = $errno;
      $result["errstr"] = $errstr;
      return $result;
    }
    fputs($socket, $header);
    while (!feof($socket)) {
      $result[$x++] = fgets($socket, 128);
      if (preg_match('/^Location:/',$result[$x-1])) {
        return $result[$x-1];
      }
      flush();
    }
    return $result;
  }
}

$post     = new simpleHttpSocket;
$host     = 'www.example.com';
$filename = '';  // leave empty for index file or else:
// $filename = 'image.jpg';
$file     = $post->sendHttpRequest($host,$header,80,2);

// Output
while(list($k,$v)=each($file)) {
  echo $v.'<br/>';
}

?>

regards
Jochen

madunix schrieb:
can any one give a complete sample script how to retrieve data content
from web (jpg, pdf, field).

Thanks

On Fri, Mar 19, 2010 at 9:53 AM, Jochen Schultz <jschu...@sportimport.de> wrote:
Btw., when you use file_get_contets, is there a good way to tell the script
to stop recieving the file after let's say 2 seconds - just in case the
server is not reachable - to avoid using fsockopen?

regards
Jochen

madunix schrieb:
okay ..it works now i use
<?php
$data=file_get_contents("http://www.my.com";);
echo $data;
?>

On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson <simples...@gmail.com>
wrote:
On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk>
wrote:
On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
trying http://us3.php.net/manual/en/function.fsockopen.php
do you a piece of code that  read parts  pages.


On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:


       On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

       > I've been trying to read the contents from a particular URL
into a
       > string in PHP, and can't get it to work.  any help.
       >
       > Thanks
       >
       > --
       > If there is a way, I will find one...***
       > If there is none, I will make one..."***
       > **************** madunix  ******************
       >




       How have you been trying to do it so far?

       There are a couple of ways. file_get_contents() and fopen()
       will work on URL's if the right ports are open.

       Most usually though cURL is used for this sort of thing.

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







--
If there is a way, I will find one...***
If there is none, I will make one..."***
**************** madunix  ******************


I think you're over-complicating things by using fsockopen(). Try one of
the functions I mentioned in my last email

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


I agree with Ashley, use one of the other options and then parse the
response to get the part of the page you'd like to work with.

--
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com



--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900            -
 26188 Edewecht      - GF: Michael Müllmann





--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900            -
 26188 Edewecht      - GF: Michael Müllmann

--- End Message ---
--- Begin Message ---
Thanks alot!

regards
Jochen

Peter Lind schrieb:
You should be able to do that by setting context options:
http://www.php.net/manual/en/context.http.php

On 19 March 2010 08:53, Jochen Schultz <jschu...@sportimport.de> wrote:
Btw., when you use file_get_contets, is there a good way to tell the script
to stop recieving the file after let's say 2 seconds - just in case the
server is not reachable - to avoid using fsockopen?

regards
Jochen

madunix schrieb:
okay ..it works now i use
<?php
$data=file_get_contents("http://www.my.com";);
echo $data;
?>

On Fri, Mar 19, 2010 at 12:32 AM, Adam Richardson <simples...@gmail.com>
wrote:
On Thu, Mar 18, 2010 at 6:08 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk>
wrote:
On Fri, 2010-03-19 at 00:11 +0200, madunix wrote:
trying http://us3.php.net/manual/en/function.fsockopen.php
do you a piece of code that  read parts  pages.


On Fri, Mar 19, 2010 at 12:00 AM, Ashley Sheridan
<a...@ashleysheridan.co.uk> wrote:


       On Fri, 2010-03-19 at 00:03 +0200, madunix wrote:

       > I've been trying to read the contents from a particular URL
into a
       > string in PHP, and can't get it to work.  any help.
       >
       > Thanks
       >
       > --
       > If there is a way, I will find one...***
       > If there is none, I will make one..."***
       > **************** madunix  ******************
       >




       How have you been trying to do it so far?

       There are a couple of ways. file_get_contents() and fopen()
       will work on URL's if the right ports are open.

       Most usually though cURL is used for this sort of thing.

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







--
If there is a way, I will find one...***
If there is none, I will make one..."***
**************** madunix  ******************


I think you're over-complicating things by using fsockopen(). Try one of
the functions I mentioned in my last email

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


I agree with Ashley, use one of the other options and then parse the
response to get the part of the page you'd like to work with.

--
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com



--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900            -
 26188 Edewecht      - GF: Michael Müllmann

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






--
 Sport Import GmbH   - Amtsgericht Oldenburg  - Tel:   +49-4405-9280-63
 Industriestrasse 39 - HRB 1202900            -
 26188 Edewecht      - GF: Michael Müllmann

--- End Message ---
--- Begin Message ---
"field"?

On Fri, Mar 19, 2010 at 9:46 AM, madunix <madu...@gmail.com> wrote:
> can any one give a complete sample script how to retrieve data content
> from web (jpg, pdf, field).
>

--- End Message ---
--- Begin Message ---
Jan G.B. wrote:
2010/3/18 tedd <tedd.sperl...@gmail.com>:
Calling it "ranting" or "religious" unjustly demeans the discussion and is
inflammatory.
In all of this, I've simply said it's your choice.

What I said was:
*persons ranting about short open tags* *are just like some religious people
*

I don't care what people do in their code.
I do not like released code with short tags, it has caused me problems when trying to run php webapps that use short tags, I have to go through the code and change them.

So what people do with their private code, I could care less about.
But if releasing php code for public consumption, I guess I'm a preacher asking people to get religion, because short tags do not belong in projects that are released to the public. Just like addslashes and magic quotes and most html entities should not be used in php code released for public consumption.
--- End Message ---
--- Begin Message ---
On 19 March 2010 10:17, Michael A. Peters <mpet...@mac.com> wrote:
>
> I don't care what people do in their code.
> I do not like released code with short tags, it has caused me problems when
> trying to run php webapps that use short tags, I have to go through the code
> and change them.
>
> So what people do with their private code, I could care less about.
> But if releasing php code for public consumption, I guess I'm a preacher
> asking people to get religion, because short tags do not belong in projects
> that are released to the public. Just like addslashes and magic quotes and
> most html entities should not be used in php code released for public
> consumption.
>

What he said. Now, could we get over this discussion? It's not exactly
going anywhere.

-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>

--- End Message ---
--- Begin Message ---
  (just a warning -- as a relative newbie to PHP, i'll probably have
the occasional dumb question.  just humour me.)

  i'm looking at some existing PHP code that accesses a mysql 5.0 db,
and it's coded using the mysql-specific calls:  mysql_connect,
mysql_select_db, etc, etc.

  is there any reason i *wouldn't* want to rewrite that code using the
more general PEAR DB module, and use mysqli?  certainly, as i read it,
using the PEAR DB module would make it easier down the road if i
suddenly decide to change the DB backend.

  anyway, any compelling arguments for or against?

rday
--


========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================

--- End Message ---
--- Begin Message ---
On Fri, 2010-03-19 at 10:17 -0400, Robert P. J. Day wrote:

> (just a warning -- as a relative newbie to PHP, i'll probably have
> the occasional dumb question.  just humour me.)
> 
>   i'm looking at some existing PHP code that accesses a mysql 5.0 db,
> and it's coded using the mysql-specific calls:  mysql_connect,
> mysql_select_db, etc, etc.
> 
>   is there any reason i *wouldn't* want to rewrite that code using the
> more general PEAR DB module, and use mysqli?  certainly, as i read it,
> using the PEAR DB module would make it easier down the road if i
> suddenly decide to change the DB backend.
> 
>   anyway, any compelling arguments for or against?
> 
> rday
> --
> 
> 
> ========================================================================
> Robert P. J. Day                               Waterloo, Ontario, CANADA
> 
>             Linux Consulting, Training and Kernel Pedantry.
> 
> Web page:                                          http://crashcourse.ca
> Twitter:                                       http://twitter.com/rpjday
> ========================================================================
> 


The only problem I can foresee is if the system you're looking to
replace the mysql calls in uses any specific mysql-only features and
functions. So, for example, not all database types support grabbing the
last inserted id (and grabbing the MAX(id) is just asking for trouble)

Have a look through the code to see if there any database calls that you
think might throw up any issues. I believe the Pear module supports all
the mysql functions, but there might be issues if you want to change the
back end at some point in the future.

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



--- End Message ---
--- Begin Message ---
On Fri, Mar 19, 2010 at 02:23:30PM +0000, Ashley Sheridan wrote:

> On Fri, 2010-03-19 at 10:17 -0400, Robert P. J. Day wrote:
> 
> > (just a warning -- as a relative newbie to PHP, i'll probably have
> > the occasional dumb question.  just humour me.)
> >
> >   i'm looking at some existing PHP code that accesses a mysql 5.0 db,
> > and it's coded using the mysql-specific calls:  mysql_connect,
> > mysql_select_db, etc, etc.
> >
> >   is there any reason i *wouldn't* want to rewrite that code using the
> > more general PEAR DB module, and use mysqli?  certainly, as i read it,
> > using the PEAR DB module would make it easier down the road if i
> > suddenly decide to change the DB backend.
> >
> >   anyway, any compelling arguments for or against?
> >
> > rday
> 
> 
> The only problem I can foresee is if the system you're looking to
> replace the mysql calls in uses any specific mysql-only features and
> functions. So, for example, not all database types support grabbing the
> last inserted id (and grabbing the MAX(id) is just asking for trouble)
> 
> Have a look through the code to see if there any database calls that you
> think might throw up any issues. I believe the Pear module supports all
> the mysql functions, but there might be issues if you want to change the
> back end at some point in the future.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 

I would suggest instead the built-in PDO module for PHP. This is
generic, and suitable for several DBMS back-ends. But any direct queries
using features unique to a specific DBMS (like Ash's "last inserted id")
will have to be coded specifically for your back-end.

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
On Fri, Mar 19, 2010 at 10:23 AM, Ashley Sheridan
<a...@ashleysheridan.co.uk>wrote:

> On Fri, 2010-03-19 at 10:17 -0400, Robert P. J. Day wrote:
>
> > (just a warning -- as a relative newbie to PHP, i'll probably have
> > the occasional dumb question.  just humour me.)
> >
> >   i'm looking at some existing PHP code that accesses a mysql 5.0 db,
> > and it's coded using the mysql-specific calls:  mysql_connect,
> > mysql_select_db, etc, etc.
> >
> >   is there any reason i *wouldn't* want to rewrite that code using the
> > more general PEAR DB module, and use mysqli?  certainly, as i read it,
> > using the PEAR DB module would make it easier down the road if i
> > suddenly decide to change the DB backend.
> >
> >   anyway, any compelling arguments for or against?
> >
> > rday
> > --
> >
> >
> > ========================================================================
> > Robert P. J. Day                               Waterloo, Ontario, CANADA
> >
> >             Linux Consulting, Training and Kernel Pedantry.
> >
> > Web page:                                          http://crashcourse.ca
> > Twitter:                                       http://twitter.com/rpjday
> > ========================================================================
> >
>
>
> The only problem I can foresee is if the system you're looking to
> replace the mysql calls in uses any specific mysql-only features and
> functions. So, for example, not all database types support grabbing the
> last inserted id (and grabbing the MAX(id) is just asking for trouble)
>
> Have a look through the code to see if there any database calls that you
> think might throw up any issues. I believe the Pear module supports all
> the mysql functions, but there might be issues if you want to change the
> back end at some point in the future.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
You also might prefer the level of abstraction and simplicity provided by
PDO (note that it's a data access abstraction layer, not a database
abstraction layer, http://www.php.net/manual/en/intro.pdo.php.)

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

--- End Message ---
--- Begin Message ---
another option: adodb.sf.net.

and yep, i'm fully for using a db abstraction layer.


On Fri, Mar 19, 2010 at 3:17 PM, Robert P. J. Day <rpj...@crashcourse.ca> wrote:
>
>  (just a warning -- as a relative newbie to PHP, i'll probably have
> the occasional dumb question.  just humour me.)
>
>  i'm looking at some existing PHP code that accesses a mysql 5.0 db,
> and it's coded using the mysql-specific calls:  mysql_connect,
> mysql_select_db, etc, etc.
>
>  is there any reason i *wouldn't* want to rewrite that code using the
> more general PEAR DB module, and use mysqli?  certainly, as i read it,
> using the PEAR DB module would make it easier down the road if i
> suddenly decide to change the DB backend.
>
>  anyway, any compelling arguments for or against?
>
> rday
> --
>
>
> ========================================================================
> Robert P. J. Day                               Waterloo, Ontario, CANADA
>
>            Linux Consulting, Training and Kernel Pedantry.
>
> Web page:                                          http://crashcourse.ca
> Twitter:                                       http://twitter.com/rpjday
> ========================================================================
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On 03/19/2010 08:51 PM, Rene Veerman wrote:
another option: adodb.sf.net.

and yep, i'm fully for using a db abstraction layer.


On Fri, Mar 19, 2010 at 3:17 PM, Robert P. J. Day<rpj...@crashcourse.ca>  wrote:

  (just a warning -- as a relative newbie to PHP, i'll probably have
the occasional dumb question.  just humour me.)

  i'm looking at some existing PHP code that accesses a mysql 5.0 db,
and it's coded using the mysql-specific calls:  mysql_connect,
mysql_select_db, etc, etc.

  is there any reason i *wouldn't* want to rewrite that code using the
more general PEAR DB module, and use mysqli?  certainly, as i read it,
using the PEAR DB module would make it easier down the road if i
suddenly decide to change the DB backend.

  anyway, any compelling arguments for or against?

rday
--


========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Adodb is the same one that is available in Visual Basic.

I suggest PDO. Easy to use and portable.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com

--- End Message ---
--- Begin Message --- Add me to the list of people recommending PDO. It's much nicer to work with than the ext/mysql API, and frankly more secure since you get prepared statements. It won't get you complete database independence for a number of reasons (mostly due to databases being too unstandardized because they all suck in different ways; I say this as someone who has written an abstraction layer atop PDO and it wasn't easy), but it will get you part way there and even if you only ever use MySQL is a nicer API to work with.

--Larry Garfield

On 3/19/10 9:17 AM, Robert P. J. Day wrote:

   (just a warning -- as a relative newbie to PHP, i'll probably have
the occasional dumb question.  just humour me.)

   i'm looking at some existing PHP code that accesses a mysql 5.0 db,
and it's coded using the mysql-specific calls:  mysql_connect,
mysql_select_db, etc, etc.

   is there any reason i *wouldn't* want to rewrite that code using the
more general PEAR DB module, and use mysqli?  certainly, as i read it,
using the PEAR DB module would make it easier down the road if i
suddenly decide to change the DB backend.

   anyway, any compelling arguments for or against?

rday
--


========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

             Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================


--- End Message ---
--- Begin Message ---
Robert P. J. Day wrote:
  (just a warning -- as a relative newbie to PHP, i'll probably have
the occasional dumb question.  just humour me.)

  i'm looking at some existing PHP code that accesses a mysql 5.0 db,
and it's coded using the mysql-specific calls:  mysql_connect,
mysql_select_db, etc, etc.

  is there any reason i *wouldn't* want to rewrite that code using the
more general PEAR DB module, and use mysqli?  certainly, as i read it,
using the PEAR DB module would make it easier down the road if i
suddenly decide to change the DB backend.

  anyway, any compelling arguments for or against?

rday
--

Well, the reason you shouldn't use PEAR DB in a new project is that it's being deprecated. MDB2 is the PEAR successor, and does provide emulation for some features that don't exist on all database platforms, such as LastInsertID. It can also help you convert your database from one platform to another, since it also provides methods for detecting and managing the database structure itself (the Manager and Reverse modules).

That said, if I were to start a new project at this time, I would look closer at whether PDO fits my needs.

Cheers,

Mattias

--- End Message ---
--- Begin Message ---
la...@garfieldtech.com wrote:
Add me to the list of people recommending PDO.  It's much nicer to work
with than the ext/mysql API, and frankly more secure since you get
prepared statements. It won't get you complete database independence for
a number of reasons (mostly due to databases being too unstandardized
because they all suck in different ways; I say this as someone who has
written an abstraction layer atop PDO and it wasn't easy), but it will
get you part way there and even if you only ever use MySQL is a nicer
API to work with.

Of cause ADODB will actually use PDO for those databases that are currently available in it, and the generic drivers for those which are not currently supported by PDO ;) One can also check performance by switching between PDO driver and generic if you want to ...

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
On Fri, 19 Mar 2010, Mattias Thorslund wrote:

> Robert P. J. Day wrote:
> >   (just a warning -- as a relative newbie to PHP, i'll probably have
> > the occasional dumb question.  just humour me.)
> >
> >   i'm looking at some existing PHP code that accesses a mysql 5.0 db,
> > and it's coded using the mysql-specific calls:  mysql_connect,
> > mysql_select_db, etc, etc.
> >
> >   is there any reason i *wouldn't* want to rewrite that code using the
> > more general PEAR DB module, and use mysqli?  certainly, as i read it,
> > using the PEAR DB module would make it easier down the road if i
> > suddenly decide to change the DB backend.
> >
> >   anyway, any compelling arguments for or against?
> >
> > rday
> > --
> >
>
> Well, the reason you shouldn't use PEAR DB in a new project is that
> it's being deprecated. MDB2 is the PEAR successor, ...

  you're right and, in fact, i knew that, i just forgot.  i'm also
taking seriously the recommendations for PDO and adodb.

rday
--


========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================

--- End Message ---
--- Begin Message ---
https://bugs.launchpad.net/ubuntu/+source/phpmyadmin/+bug/541922

phpmyadmin is on strike :(

can anyone recommend a good alternative? auto-scaling print function preferred.

--- End Message ---
--- Begin Message ---
On Fri, 2010-03-19 at 15:25 +0100, Rene Veerman wrote:

> https://bugs.launchpad.net/ubuntu/+source/phpmyadmin/+bug/541922
> 
> phpmyadmin is on strike :(
> 
> can anyone recommend a good alternative? auto-scaling print function 
> preferred.
> 


I needed software to do this a while ago, and the majority of the
responses on the list were to use MySQL Workbench.

The thread was called 'Linux ERD Software' if you want to have a look at
some of the other suggestions.

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



--- End Message ---
--- Begin Message ---
thanks.

On Fri, Mar 19, 2010 at 3:35 PM, Ashley Sheridan
<a...@ashleysheridan.co.uk>wrote:

>  On Fri, 2010-03-19 at 15:25 +0100, Rene Veerman wrote:
>
> https://bugs.launchpad.net/ubuntu/+source/phpmyadmin/+bug/541922
>
> phpmyadmin is on strike :(
>
> can anyone recommend a good alternative? auto-scaling print function 
> preferred.
>
>
>
> I needed software to do this a while ago, and the majority of the responses
> on the list were to use MySQL Workbench.
>
> The thread was called 'Linux ERD Software' if you want to have a look at
> some of the other suggestions.
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

--- End Message ---
--- Begin Message ---
On Fri, Mar 19, 2010 at 3:05 AM, D. Dante Lorenso <da...@lorenso.com> wrote:

> All,
>
> I want to start using PHP namespaces for my projects.  Currently, I name my
> classes similar to how Zend Framework names theirs and I end up with classes
> like:
>
>  LS_Util_String
>
> I'm thinking that if I converted this to namespaces, the classes would be
> named like:
>
>  LS\Util\String
>
> I'd like to look at an example of an open source project that has already
> adopted namespaces as "the way to do it" and would be a good best practices
> case for how I should go about setting up my library namespaces.
>
> I have been playing with concepts of using a Java-like naming convention
> for classes and have created my own namespace like:
>
>    com\larkspark\util\String
>
> And here I was thinking that packages would be lowercase and classes would
> be camelcase with initial caps.
>
> I'm getting ready to build a new project and wanted to do it in the
> future-forward style while removing legacy classes and refactoring
> everything to use namespaces.
>
> Any examples out there?  Everything I find from searching Google is novice
> intro to PHP namespaces blogs, but nothing concrete.  Also since namespaces
> are relatively new, I see a lot of misleading guides where they are using
> "::" instead of "\" to separate class name parts.  What does this list
> recommend?
>
> Dante
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I'm certainly not advocating my framework's conventions as "the way to do
it", but you can certainly look at my code just to see how I'm using
namespaces for my project.  The framework takes a largely functional
approach, so some of the Object-naming conventions aren't present, but you
still might see some things you like (or hate.)  It seems to work well with
Netbeans (I haven't tried other IDE's.)

http://code.google.com/p/nephtali/

Documentation and other stuff can be found at the website in my signature,
if it would help to sift through the functions.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

--- End Message ---
--- Begin Message ---
hi gang[tm],

I've been STFW for some kind of CRM package specifically geared at
event/exhibition organizers. I'm not having any luck, there *seems* to
be stuff out there but most of it's geared at single exhibitor/corporate
entity event management as opposed to the organization of events
where 100s of exhibitors need be approached, sold stand space to and
manage - of those that do seem to what I'd like they are a bit vague on
their website and don't give any pricing info (as usual price is a big issue :).

I've looked at the possibilities of using Salesforce or SugarCRM but neither
seem to have plugins/modules aimed at the specific requirements I have.

Basically I want something to manage:

1. multiple expos/exhibitions
2. selling standspace
3. manage tickets/ticket campaigns
4. floorplan management/creation/etc
5. speaker/debate-panel management
6. exhibitor pack/documentation management
5. the usual invoicing/lead/crm stuff

does anyone know of anything that comes remotely close?

rgds,
Jochem

--- End Message ---
--- Begin Message ---
 i don't see a separate mailing list for documentation so is this
where i would point at oddities in the manual?  as in, here:

http://www.php.net/manual/en/language.variables.external.php

we read:

"// Unavailable since PHP 6."

that just looks weird, no?

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================

--- End Message ---

Reply via email to