php-general Digest 31 Oct 2011 09:44:58 -0000 Issue 7546

2011-10-31 Thread php-general-digest-help

php-general Digest 31 Oct 2011 09:44:58 - Issue 7546

Topics (messages 315551 through 315561):

Dependency Injection Implementation
315551 by: jean-baptiste verrey

Novice question
315552 by: John Allsopp
315553 by: Negin Nickparsa
315554 by: Marc Guay
31 by: Bastien
315558 by: Rico Secada

Re: Zend Amf and Drupal?
315556 by: Lars Nielsen

function.session-start in Webmaster Tools
315557 by: Rick Dwyer
315559 by: Jeremiah Dodds
315561 by: Stuart Dallas

Re: Array has `trailing comma`, why not the same for function parameter list?
315560 by: Jeremiah Dodds

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


--
---BeginMessage---
Hi everyone,

Dependency Injection is a very trendy subject and after reading about it I
kinda thought about rewriting the framework I'm doing with dependency
injection. So I made my own implementation and was wondering what would you
think about it? I have followed the article of Martin Fowler (
http://martinfowler.com/articles/injection.html)

with this implementation I have the following :
- you have both constructor and setter injection
- the Dependency class is a service locator
- we have at the same time service locator AND dependency injection
- you can always manually inject dependency
- you can pass arguments to the injected object constructor

So: am I missing something? Do you think it's good enough?

here is the code :
?php
class Dependency {
protected $_singletonInstances = array();
protected $_setInstances = array();
protected $_configuration;

public static function getInstance() {
static $instance = NULL;
if (NULL === $instance) {
$instance = new static();
}
return $instance;
}

public function setConfiguration(array $configuration) {
$this-_configuration = $configuration;
}

public function getConfiguration() {
return $this-_configuration;
}

public function __isset($serviceName) {
return isset($this-_serviceInstances[$serviceName]);
}

public function __call($serviceName, $args) {
// singleton
if (isset($this-_configuration[$serviceName]) 
$this-_configuration[$serviceName]['singleton']) {
if (!isset($this-_singletonInstances[$serviceName])) {
$rc = new
\ReflectionClass($this-_configuration[$serviceName]['class']);
$this-_singletonInstances[$serviceName] = empty($args) ?
$rc-newInstance() : $rc-newInstanceArgs($args);
}
$ret = $this-_singletonInstances[$serviceName];
} else {
// normal
if (isset($this-_setInstances[$serviceName])) {
$ret = $this-_setInstances[$serviceName];
unset($this-_setInstances[$serviceName]);
} else {
$rc = new
\ReflectionClass($this-_configuration[$serviceName]['class']);
$ret = $this-_singletonInstances[$serviceName] =
empty($args) ? $rc-newInstance() : $rc-newInstanceArgs($args);
}
}
return $ret;
}

public function __get($serviceName) {
return $this-__call($serviceName, array());
}

public function __set($serviceName, $instance) {
if (!is_object($instance))
throw new Exception('instance must be an object');
$this-_setInstances[$serviceName] = $instance;
}
}
class DependencyInjectorException extends \Exception {

}

$di=DependencyInjector::getInstance();
$di-setConfiguration(array(
'database.connector'=array(
'singleton'=true,
'class'='DatabaseConnector'
),
'database'=array(
'singleton'=true,
'class'='Database'
)
));

class DatabaseConnector{}
class Database{
protected $_connector;
public function __construct(){

$this-setConnector(DependencyInjector::getInstance()-{'database.connector'});
}

public function setConnector($connector){
$this-_connector=$connector;
}
}
class Test{
protected $_database;
public function __construct(){
$this-setDatabase(DependencyInjector::getInstance()-database);
}

public function setDatabase($db){
$this-_database=$db;
}

public function getDatabase(){
return $this-_database;
}
}

$test=new Test();
var_dump($test-getDatabase());

?
---End Message---
---BeginMessage---
Hi

I'm afraid I've fallen a little out of touch with PHP dev, so a stupid
question for you.

I want to write a script that requests a URL and then reads that website
.. I'm interested to map web structures. My web host is saying I'll need
URL file access enabled but 

php-general Digest 31 Oct 2011 21:46:07 -0000 Issue 7547

2011-10-31 Thread php-general-digest-help

php-general Digest 31 Oct 2011 21:46:07 - Issue 7547

Topics (messages 315562 through 315569):

Re: function.session-start in Webmaster Tools
315562 by: Rick Dwyer

Re: Novice question
315563 by: John Allsopp

Re: Array has `trailing comma`, why not the same for function parameter list?
315564 by: Daniel Brown

Novice: PHP array by reference question (by C++ programmer)
315565 by: Manish Gupta
315566 by: Manish Gupta
315567 by: Louis Huppenbauer

Dependency Injection containers
315568 by: robert mena
315569 by: jean-baptiste verrey

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


--
---BeginMessage---
But those pages, when loaded, do not display any PHP errors.  Only  
webmaster tools is showing the function.session-start in a link to  
that page.  When I looked up hte meaning of session-start function, I  
found others who have indicated that white space in front of the  
session tag can cause this... so I eliminated it.  Not sure if that  
will fix as the page has never displayed an error and Google takes  
forever to recrawl the whole site.



 --Rick


On Oct 31, 2011, at 5:44 AM, Stuart Dallas wrote:


On 30 Oct 2011, at 20:30, Rick Dwyer wrote:


Hello all.

Not sure just how much of this is PHP related, but hoping someone  
has come across this before.


I Google's webmaster tools for a site I work on, they list more  
than 100 crawl errors for pages with URL's as follows:


http://mydomain.com/My-Directory/function.session-start

Can anyone explain why webmaster tools is seeing pages with links  
ending in function.session-start?  I read up on the error  
itself... sometimes caused by whitespace before the session_start  
tag... have fixed that.  Any info is appreciated.



You have PHP errors somewhere on your site. The error messages  
contain links that could result in those URLs. Find out what pages  
are linking to those URLs and check them for errors.


-Stuart

--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


---End Message---
---BeginMessage---
 cURL is the best one in my experience, but you have to manage security
 yourself. Meaning: Remember to escape/encode data.

 http://php.net/manual/en/book.curl.php

Thanks everyone, appreciated, I'll investigate ..

Cheers
J

 --
 01723 376477

 Cost-free marketing: http://www.flowmarketing.co.uk/

 Affordable marketing guidance for small businesses:
 http://www.amilliontweaks.co.uk/

 Effective marketing services for SMEs: coming soon at
 http://www.surgemarketing.co.uk

 Professional Internet marketing consultancy:
 http://www.johnallsopp.co.uk


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


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




-- 
01723 376477

Cost-free marketing: http://www.flowmarketing.co.uk/

Affordable marketing guidance for small businesses:
http://www.amilliontweaks.co.uk/

Effective marketing services for SMEs: coming soon at
http://www.surgemarketing.co.uk

Professional Internet marketing consultancy: http://www.johnallsopp.co.uk

---End Message---
---BeginMessage---
On Sun, Oct 30, 2011 at 08:47, Nam Gi VU nam.gi...@gmail.com wrote:
 It is convenient to have a trailing comma when defining an array - so as
 easy to add/remove code to add/remove an entry to the array

 array(
    'key00' = 'value00',
    'key01' = 'value01',
    'key02' = 'value02',
    ...
 )

 I suggest to PHP Development team to make it available in the syntax to
 have a leading comma
 array(
    ...
    , 'key00' = 'value00'
    , 'key01' = 'value01'
    , 'key02' = 'value02'
 )
 in such way, we can thought of the leading commas as the list bulletings.

 And the same things would be lovely to be applied also to function
 parameter list. I don't see why not :)

 What do you thing about my suggestion? Hope to hear from you!

    For feature requests such as this, please discuss it on the
Internals list (CC'd on this email) and suggest it via the bug tracker
at https://bugs.php.net/ (with the bug type as a Feature/Change
Request).

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/
---End Message---
---BeginMessage---
I have a class that takes as input, an array by reference and stores it in a 
member variable. A method in this class later modifies the member variable 
(which contains reference to the array). When I access the local variable 
that was passed by reference to the constructor of this class object, I see 
the local variable hasn't changed at all. I think code will describe what 
words may not have:


?php

class foo
{
   public $_bar;
   public function  

Re: [PHP] function.session-start in Webmaster Tools

2011-10-31 Thread Stuart Dallas
On 30 Oct 2011, at 20:30, Rick Dwyer wrote:

 Hello all.
 
 Not sure just how much of this is PHP related, but hoping someone has come 
 across this before.
 
 I Google's webmaster tools for a site I work on, they list more than 100 
 crawl errors for pages with URL's as follows:
 
 http://mydomain.com/My-Directory/function.session-start
 
 Can anyone explain why webmaster tools is seeing pages with links ending in 
 function.session-start?  I read up on the error itself... sometimes caused 
 by whitespace before the session_start tag... have fixed that.  Any info is 
 appreciated.


You have PHP errors somewhere on your site. The error messages contain links 
that could result in those URLs. Find out what pages are linking to those URLs 
and check them for errors.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] function.session-start in Webmaster Tools

2011-10-31 Thread Rick Dwyer
But those pages, when loaded, do not display any PHP errors.  Only  
webmaster tools is showing the function.session-start in a link to  
that page.  When I looked up hte meaning of session-start function, I  
found others who have indicated that white space in front of the  
session tag can cause this... so I eliminated it.  Not sure if that  
will fix as the page has never displayed an error and Google takes  
forever to recrawl the whole site.



 --Rick


On Oct 31, 2011, at 5:44 AM, Stuart Dallas wrote:


On 30 Oct 2011, at 20:30, Rick Dwyer wrote:


Hello all.

Not sure just how much of this is PHP related, but hoping someone  
has come across this before.


I Google's webmaster tools for a site I work on, they list more  
than 100 crawl errors for pages with URL's as follows:


http://mydomain.com/My-Directory/function.session-start

Can anyone explain why webmaster tools is seeing pages with links  
ending in function.session-start?  I read up on the error  
itself... sometimes caused by whitespace before the session_start  
tag... have fixed that.  Any info is appreciated.



You have PHP errors somewhere on your site. The error messages  
contain links that could result in those URLs. Find out what pages  
are linking to those URLs and check them for errors.


-Stuart

--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/



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



Re: [PHP] Novice question

2011-10-31 Thread John Allsopp
 cURL is the best one in my experience, but you have to manage security
 yourself. Meaning: Remember to escape/encode data.

 http://php.net/manual/en/book.curl.php

Thanks everyone, appreciated, I'll investigate ..

Cheers
J

 --
 01723 376477

 Cost-free marketing: http://www.flowmarketing.co.uk/

 Affordable marketing guidance for small businesses:
 http://www.amilliontweaks.co.uk/

 Effective marketing services for SMEs: coming soon at
 http://www.surgemarketing.co.uk

 Professional Internet marketing consultancy:
 http://www.johnallsopp.co.uk


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


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




-- 
01723 376477

Cost-free marketing: http://www.flowmarketing.co.uk/

Affordable marketing guidance for small businesses:
http://www.amilliontweaks.co.uk/

Effective marketing services for SMEs: coming soon at
http://www.surgemarketing.co.uk

Professional Internet marketing consultancy: http://www.johnallsopp.co.uk


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



Re: [PHP] Array has `trailing comma`, why not the same for function parameter list?

2011-10-31 Thread Daniel Brown
On Sun, Oct 30, 2011 at 08:47, Nam Gi VU nam.gi...@gmail.com wrote:
 It is convenient to have a trailing comma when defining an array - so as
 easy to add/remove code to add/remove an entry to the array

 array(
    'key00' = 'value00',
    'key01' = 'value01',
    'key02' = 'value02',
    ...
 )

 I suggest to PHP Development team to make it available in the syntax to
 have a leading comma
 array(
    ...
    , 'key00' = 'value00'
    , 'key01' = 'value01'
    , 'key02' = 'value02'
 )
 in such way, we can thought of the leading commas as the list bulletings.

 And the same things would be lovely to be applied also to function
 parameter list. I don't see why not :)

 What do you thing about my suggestion? Hope to hear from you!

    For feature requests such as this, please discuss it on the
Internals list (CC'd on this email) and suggest it via the bug tracker
at https://bugs.php.net/ (with the bug type as a Feature/Change
Request).

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



[PHP] Novice: PHP array by reference question (by C++ programmer)

2011-10-31 Thread Manish Gupta
I have a class that takes as input, an array by reference and stores it in a 
member variable. A method in this class later modifies the member variable 
(which contains reference to the array). When I access the local variable 
that was passed by reference to the constructor of this class object, I see 
the local variable hasn't changed at all. I think code will describe what 
words may not have:


?php

class foo
{
   public $_bar;
   public function  __construct( $bar)
   {
   $this-_bar = $bar;
   }

   function do_your_thing()
   {
   $temp = array(
   'One' = 1,
   'Two' = 2
   );

   $this-_bar[] = $temp;

   echo('from Do_your_thing: ');
   print_r($this-_bar);   //  [1]
   }
}

$abc = array();
$var = new foo($abc);
$var-do_your_thing();

echo('from main [local variable]: ');
print_r($abc);   //  [2]

echo('from main: [object member variable] ');
print_r($var-_bar);//  [3]
?

I expected the output from [1], [2] and [3] to be the same. But instead I 
get the following:


from Do_your_thing: Array
(
   [0] = Array
   (
   [One] = 1
   [Two] = 2
   )

)
from main [local variable]: Array
(
)
from main: [object member variable] Array
(
   [0] = Array
   (
   [One] = 1
   [Two] = 2
   )

)

What am I missing? Please help, I'm new to PHP and this is really blocking 
me.


Thanks
M@nish 



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



[PHP] Novice: PHP array by reference question (by C++ programmer)

2011-10-31 Thread Manish Gupta

I have a class that takes as input, an array by reference and stores it in a
member variable. A method in this class later modifies the member variable
(which contains reference to the array). When I access the local variable
that was passed by reference to the constructor of this class object, I see
the local variable hasn't changed at all. I think code will describe what
words may not have:

?php

class foo
{
   public $_bar;
   public function  __construct( $bar)
   {
   $this-_bar = $bar;
   }

   function do_your_thing()
   {
   $temp = array(
   'One' = 1,
   'Two' = 2
   );

   $this-_bar[] = $temp;

   echo('from Do_your_thing: ');
   print_r($this-_bar);   //  [1]
   }
}

$abc = array();
$var = new foo($abc);
$var-do_your_thing();

echo('from main [local variable]: ');
print_r($abc);   //  [2]

echo('from main: [object member variable] ');
print_r($var-_bar);//  [3]
?

I expected the output from [1], [2] and [3] to be the same. But instead I
get the following:

from Do_your_thing: Array
(
   [0] = Array
   (
   [One] = 1
   [Two] = 2
   )

)
from main [local variable]: Array
(
)
from main: [object member variable] Array
(
   [0] = Array
   (
   [One] = 1
   [Two] = 2
   )

)

What am I missing? Please help, I'm new to PHP and this is really blocking
me.

Thanks
M@nish


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



[PHP] Novice: PHP array by reference question (by C++ programmer)

2011-10-31 Thread Louis Huppenbauer
-- Forwarded message --
From: Louis Huppenbauer louis.huppenba...@gmail.com
Date: 2011/10/31
Subject: Re: [PHP] Novice: PHP array by reference question (by C++
programmer)
To: Manish Gupta gman...@gmail.com


You have to assign the value by reference too

public function  __construct( $bar)
  {
  $this-_bar = $bar;
  }


2011/10/31 Manish Gupta gman...@gmail.com

  I have a class that takes as input, an array by reference and stores it
 in a
 member variable. A method in this class later modifies the member variable
 (which contains reference to the array). When I access the local variable
 that was passed by reference to the constructor of this class object, I see
 the local variable hasn't changed at all. I think code will describe what
 words may not have:

 ?php

 class foo
 {
   public $_bar;
   public function  __construct( $bar)
   {
   $this-_bar = $bar;
   }

   function do_your_thing()
   {
   $temp = array(
   'One' = 1,
   'Two' = 2
   );

   $this-_bar[] = $temp;

   echo('from Do_your_thing: ');
   print_r($this-_bar);   //  [1]
   }
 }

 $abc = array();
 $var = new foo($abc);
 $var-do_your_thing();

 echo('from main [local variable]: ');
 print_r($abc);   //  [2]

 echo('from main: [object member variable] ');
 print_r($var-_bar);//  [3]
 ?

 I expected the output from [1], [2] and [3] to be the same. But instead I
 get the following:

 from Do_your_thing: Array
 (
   [0] = Array
   (
   [One] = 1
   [Two] = 2
   )

 )
 from main [local variable]: Array
 (
 )
 from main: [object member variable] Array
 (
   [0] = Array
   (
   [One] = 1
   [Two] = 2
   )

 )

 What am I missing? Please help, I'm new to PHP and this is really blocking
 me.

 Thanks
 M@nish


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




[PHP] Dependency Injection containers

2011-10-31 Thread robert mena
Hi,

I am trying to avoid reinventing the wheel so I am looking for
dependency injection containers that work with PHP 5.2.  So Symphony2
and ZF2 DI are out of question.

I found this 
http://www.potstuck.com/2010/09/09/php-dependency-a-php-dependency-injection-framework/
 but I was wondering if anyone has a opinion about it or alternatives.

regards.

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



Re: [PHP] Dependency Injection containers

2011-10-31 Thread jean-baptiste verrey
Hi,

you could simply write your own, you simply need a class or a function that
given an identifier such as database.connector would return you an
instance of it, and
and maybe handle singletons.
It just a question of taste of how you want it to be.

I have just posted a few days ago my implementation, it might interest you
(I think it should work with php 5.2)

?php
class Dependency {
protected $_singletonInstances = array();
protected $_setInstances = array();
protected $_configuration;

protected static $_instance;

public static function getInstance() {
if (self::$_instance===null) {
self::$_instance = new self();
}
return self::$_instance;
}

public function setConfiguration(array $configuration) {
$this-_configuration = $configuration;
}

public function getConfiguration() {
return $this-_configuration;
}

public function __isset($serviceName) {
return isset($this-_serviceInstances[$serviceName]);
}

public function __call($serviceName, $args) {
// singleton
if (isset($this-_configuration[$serviceName]) 
$this-_configuration[$serviceName]['singleton']) {
if (!isset($this-_singletonInstances[$serviceName])) {
$rc = new
ReflectionClass($this-_configuration[$serviceName]['class']);
$this-_singletonInstances[$serviceName] = empty($args) ?
$rc-newInstance() : $rc-newInstanceArgs($args);
}
$ret = $this-_singletonInstances[$serviceName];
} else {
// normal
if (isset($this-_setInstances[$serviceName])) {
$ret = $this-_setInstances[$serviceName];
unset($this-_setInstances[$serviceName]);
} else {
$rc = new
ReflectionClass($this-_configuration[$serviceName]['class']);
$ret = $this-_singletonInstances[$serviceName] =
empty($args) ? $rc-newInstance() : $rc-newInstanceArgs($args);
}
}
return $ret;
}

public function __get($serviceName) {
return $this-__call($serviceName, array());
}

public function __set($serviceName, $instance) {
if (!is_object($instance))
throw new Exception('instance must be an object');
$this-_setInstances[$serviceName] = $instance;
}
}

$di=Dependency::getInstance();
$di-setConfiguration(array(
'database.connector'=array(
'singleton'=true,
'class'='DatabaseConnector'
),
'database'=array(
'singleton'=true,
'class'='Database'
)
));

class DatabaseConnector{}
class Database{
protected $_connector;
public function __construct(){

$this-setConnector(Dependency::getInstance()-{'database.connector'});
}

public function setConnector($connector){
$this-_connector=$connector;
}
}
class Test{
protected $_database;
public function __construct(){
$this-setDatabase(Dependency::getInstance()-database);
}

public function setDatabase($db){
$this-_database=$db;
}

public function getDatabase(){
return $this-_database;
}
}

$test=new Test();
var_dump($test-getDatabase());


regards,

Jean-Baptiste Verrey



On 31 October 2011 21:32, robert mena robert.m...@gmail.com wrote:

 Hi,

 I am trying to avoid reinventing the wheel so I am looking for
 dependency injection containers that work with PHP 5.2.  So Symphony2
 and ZF2 DI are out of question.

 I found this
 http://www.potstuck.com/2010/09/09/php-dependency-a-php-dependency-injection-framework/
  but I was wondering if anyone has a opinion about it or alternatives.

 regards.

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




Re: [PHP] Exporting large data from mysql to html using php

2011-10-31 Thread Jim Lucas
On 10/24/2011 5:50 PM, Jason Pruim wrote:
 Now that I've managed to list 3 separate programming languages and somewhat 
 tie it back into php here's the question...
 
 I have about 89 million records in mysql... the initial load of the page 
 takes 2 to 3 minutes, I am using pagination, so I have LIMIT's on the SQL 
 query's... But they just aren't going fast enough...
 
 What I would like to do, is pull the data out of MySQL and store it in the 
 HTML files, and then update the HTML files once a day/week/month... I can 
 figure most of it out... BUT... How do I automatically link to the individual 
 pages?
 
 I have the site working when you pull it from MySQL... Just the load time 
 sucks... Any suggestions on where I can pull some more info from? :)
 
 Thanks in advance!
 
 
 Jason Pruim
 li...@pruimphotography.com
 

Jason,

How large a data set are you starting with?  How many records in all.

Will you show us your DB schema?

-- 
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

C - (541) 408-5189
O - (541) 323-9113
H - (541) 323-4219

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



Re: [PHP] Exporting large data from mysql to html using php

2011-10-31 Thread Jason Pruim

Jason Pruim
li...@pruimphotography.com



On Oct 31, 2011, at 7:11 PM, Jim Lucas wrote:

 On 10/24/2011 5:50 PM, Jason Pruim wrote:
 Now that I've managed to list 3 separate programming languages and somewhat 
 tie it back into php here's the question...
 
 I have about 89 million records in mysql... the initial load of the page 
 takes 2 to 3 minutes, I am using pagination, so I have LIMIT's on the SQL 
 query's... But they just aren't going fast enough...
 
 What I would like to do, is pull the data out of MySQL and store it in the 
 HTML files, and then update the HTML files once a day/week/month... I can 
 figure most of it out... BUT... How do I automatically link to the 
 individual pages?
 
 I have the site working when you pull it from MySQL... Just the load time 
 sucks... Any suggestions on where I can pull some more info from? :)
 
 Thanks in advance!
 
 
 Jason Pruim
 li...@pruimphotography.com
 
 
 Jason,
 
 How large a data set are you starting with?  How many records in all.
 
 Will you show us your DB schema?

Hey Jim,

I am working with 89 Million records right now... Going to be expanding to a 
much larger dataset as the site expands.

Here is the main table that I am using:

mysql describe main;
++-+--+-+-++
| Field  | Type| Null | Key | Default | Extra  |
++-+--+-+-++
| areacode   | int(3)  | NO   | MUL | NULL||
| exchange   | int(3)  | NO   | | NULL||
| subscriber | char(4) | NO   | | NULL||
| id | int(11) | NO   | PRI | NULL| auto_increment |
| state  | varchar(20) | YES  | | NULL||
| config | text| YES  | | NULL||
++-+--+-+-++



config is just going to contain varius settings for commenting on records, and 
future expansion. State will actually be the state spelled out. 

Thanks for taking a looking!




Re: [PHP] Exporting large data from mysql to html using php

2011-10-31 Thread Ashley Sheridan
On Mon, 2011-10-31 at 19:29 -0400, Jason Pruim wrote:

 Jason Pruim
 li...@pruimphotography.com
 
 
 
 On Oct 31, 2011, at 7:11 PM, Jim Lucas wrote:
 
  On 10/24/2011 5:50 PM, Jason Pruim wrote:
  Now that I've managed to list 3 separate programming languages and 
  somewhat tie it back into php here's the question...
  
  I have about 89 million records in mysql... the initial load of the page 
  takes 2 to 3 minutes, I am using pagination, so I have LIMIT's on the SQL 
  query's... But they just aren't going fast enough...
  
  What I would like to do, is pull the data out of MySQL and store it in the 
  HTML files, and then update the HTML files once a day/week/month... I can 
  figure most of it out... BUT... How do I automatically link to the 
  individual pages?
  
  I have the site working when you pull it from MySQL... Just the load time 
  sucks... Any suggestions on where I can pull some more info from? :)
  
  Thanks in advance!
  
  
  Jason Pruim
  li...@pruimphotography.com
  
  
  Jason,
  
  How large a data set are you starting with?  How many records in all.
  
  Will you show us your DB schema?
 
 Hey Jim,
 
 I am working with 89 Million records right now... Going to be expanding to a 
 much larger dataset as the site expands.
 
 Here is the main table that I am using:
 
 mysql describe main;
 ++-+--+-+-++
 | Field  | Type| Null | Key | Default | Extra  |
 ++-+--+-+-++
 | areacode   | int(3)  | NO   | MUL | NULL||
 | exchange   | int(3)  | NO   | | NULL||
 | subscriber | char(4) | NO   | | NULL||
 | id | int(11) | NO   | PRI | NULL| auto_increment |
 | state  | varchar(20) | YES  | | NULL||
 | config | text| YES  | | NULL||
 ++-+--+-+-++
 
 
 
 config is just going to contain varius settings for commenting on records, 
 and future expansion. State will actually be the state spelled out. 
 
 Thanks for taking a looking!
 
 


I'd put the spelling of the state in another table and just include the
reference to it in this table, it will save a lot on storage and it's
easy to do a join to get it. That way, it's also much faster to look up
entries by state, as a numerical index is quicker that a string index.

On the subject of indexes, what other ones do you have apart from the
primary key there?

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