Re: [PHP] database hell

2012-07-16 Thread Ressy
On 15/07/2012 17:07, Nick Edwards wrote: > On 7/12/12, Ashley Sheridan wrote: > >> "ma...@behnke.biz [5]" wrote: >> >>> Nick Edwards hat am 12. Juli 2012 um 14:00 geschrieben: >>> On 7/12/12, Gibbs wrote: > mysql_query("DELETE from userprefs where clientr='$User'", >>>

Re: [PHP] database hell

2012-07-15 Thread Nick Edwards
On 7/12/12, Ashley Sheridan wrote: > > > "ma...@behnke.biz" wrote: > >> >> >> >>Nick Edwards hat am 12. Juli 2012 um 14:00 >>geschrieben: >> >>> On 7/12/12, Gibbs wrote: >>> >>> > mysql_query("DELETE from userprefs where clientr='$User'", >>$connmy); >> >> >>Sidenote: And don't forget to valida

Re: [PHP] database hell

2012-07-12 Thread Ashley Sheridan
"ma...@behnke.biz" wrote: > > > >Nick Edwards hat am 12. Juli 2012 um 14:00 >geschrieben: > >> On 7/12/12, Gibbs wrote: >> >> > mysql_query("DELETE from userprefs where clientr='$User'", >$connmy); > > >Sidenote: And don't forget to validate user input and make use of mysql >escape >and prepa

Re: [PHP] database hell

2012-07-12 Thread ma...@behnke.biz
Nick Edwards hat am 12. Juli 2012 um 14:00 geschrieben: > On 7/12/12, Gibbs wrote: > > > mysql_query("DELETE from userprefs where clientr='$User'", $connmy); Sidenote: And don't forget to validate user input and make use of mysql escape and prepared statements ;) -- PHP General Mailing L

Re: [PHP] database hell

2012-07-12 Thread Nick Edwards
On 7/12/12, Gibbs wrote: >>> $connmy=mysql_connect("host","user","pass", TRUE); >>> >>> http://php.net/manual/en/function.mysql-connect.php >>> >> >> Thanks, will give that a shot >> > I forgot to add your queries will need the new link too. So > > mysql_query("DELETE from userprefs where clientr

Re: [PHP] database hell

2012-07-12 Thread Nick Edwards
On 7/12/12, Adam Nicholls wrote: > > >> -Original Message- >> From: Nick Edwards [mailto:nick.z.edwa...@gmail.com] >> Sent: 12 July 2012 12:30 >> To: php-general@lists.php.net >> Subject: [PHP] database hell >> >> Hi >> >> W

Re: [PHP] database hell

2012-07-12 Thread Gibbs
On 12/07/12 12:38, Nick Edwards wrote: On 7/12/12, Gibbs wrote: On 12/07/12 12:29, Nick Edwards wrote: Hi We have a program that manages users, throughout all database calls created as: $connect = mysql_connect($db_host--other variables); mysql_query("Delete from clients where id=$User"); A

RE: [PHP] database hell

2012-07-12 Thread Adam Nicholls
> -Original Message- > From: Nick Edwards [mailto:nick.z.edwa...@gmail.com] > Sent: 12 July 2012 12:30 > To: php-general@lists.php.net > Subject: [PHP] database hell > > Hi > > We have a program that manages users, throughout all database calls

Re: [PHP] database hell

2012-07-12 Thread Stuart Dallas
On 12 Jul 2012, at 12:29, Nick Edwards wrote: > We have a program that manages users, throughout all database calls > > created as: > $connect = mysql_connect($db_host--other variables); > mysql_query("Delete from clients where id=$User"); > > All this works good, but, we need, in the delete fun

Re: [PHP] database hell

2012-07-12 Thread Nick Edwards
On 7/12/12, Gibbs wrote: > On 12/07/12 12:29, Nick Edwards wrote: >> Hi >> >> We have a program that manages users, throughout all database calls >> >> created as: >> $connect = mysql_connect($db_host--other variables); >> mysql_query("Delete from clients where id=$User"); >> >> All this works goo

Re: [PHP] database hell

2012-07-12 Thread Gibbs
On 12/07/12 12:29, Nick Edwards wrote: Hi We have a program that manages users, throughout all database calls created as: $connect = mysql_connect($db_host--other variables); mysql_query("Delete from clients where id=$User"); All this works good, but, we need, in the delete function to delete

[PHP] database hell

2012-07-12 Thread Nick Edwards
Hi We have a program that manages users, throughout all database calls created as: $connect = mysql_connect($db_host--other variables); mysql_query("Delete from clients where id=$User"); All this works good, but, we need, in the delete function to delete from another database $connmy=mysql_conn

Re: [PHP] PHP & Database Problems -- Code Snippets

2012-05-05 Thread Matijn Woudt
On Thu, May 3, 2012 at 4:20 PM, Ethan Rosenberg wrote: > At 06:47 PM 5/2/2012, Matijn Woudt wrote: >> >> On Wed, May 2, 2012 at 11:43 PM, Ethan Rosenberg >> wrote: > Dear list - > > Sorry for the attachment. Â Here are code snippets >> --- Ethan, I don't want to sound rude, but it appears to me y

Re: [PHP] PHP & Database Problems -- Code Snippets - Any more Ideas?

2012-05-04 Thread Marco Behnke
Am 04.05.2012 16:09, schrieb Ethan Rosenberg: function handle_data() { global $cxn; What does this function? It neither takes any parameters nor returns any value. And it does not write back anything to its global $cxn. So it is quite useless and can be deleted. $query = "select * from I

[PHP] RE: [PHP-DB] [PHP] PHP & Database Problems -- Code Snippets - Any more Ideas?

2012-05-04 Thread Gavin Chalkley
4 May 2012 15:10 To: php-db-lists.php.net; php-general@lists.php.net Subject: [PHP-DB] [PHP] PHP & Database Problems -- Code Snippets - Any more Ideas? I am sending this again to see if more ideas for solution of this problem are available. Ethan === Dear list - Sorry for the attachme

Re: [PHP] PHP & Database Problems -- Code Snippets - Any more Ideas?

2012-05-04 Thread Govinda
Ethan, before you get frustrated or feel abandoned, let me *sincerely* try to help: Here is honestly what I am utterly convinced you need to do to get any where in the medium/long run: Break everything down into very small steps. Making web apps is just building a whole lot of layers/colle

Re: [PHP] PHP & Database Problems -- Code Snippets - Any more Ideas?

2012-05-04 Thread Jim Giner
Nor will posting to multiple lists.(Sorry to the rest of you - didn't realize it until now.) ""Jim Giner"" wrote in message news:c6.f8.38082.efae3...@pb1.pair.com... >I don't think posting the same voluminous code is going to generate any >better responses. > > The suggestion to start over and

Re: [PHP] PHP & Database Problems -- Code Snippets - Any more Ideas?

2012-05-04 Thread Jim Giner
I don't think posting the same voluminous code is going to generate any better responses. The suggestion to start over and make your insert/retrieve queries fool proof before starting to write some logic into your code was a very good one. Why don't you work on that so that any requests for he

[PHP] PHP & Database Problems -- Code Snippets - Any more Ideas?

2012-05-04 Thread Ethan Rosenberg
I am sending this again to see if more ideas for solution of this problem are available. Ethan === Dear list - Sorry for the attachment. Here are code snippets --- GET THE DATA FROM INTAKE3: function handle_data() { global $cxn; $query = "select * from Intake3 w

Re: [PHP] PHP & Database Problems -- Code Snippets

2012-05-03 Thread Ethan Rosenberg
At 06:47 PM 5/2/2012, Matijn Woudt wrote: On Wed, May 2, 2012 at 11:43 PM, Ethan Rosenberg wrote: > Dear list - > > Sorry for the attachment. Â Here are code snippets --- Ethan, I don't want to sound rude, but it appears to me you don't have any understanding of what you're doing. It might

Re: [PHP] PHP & Database Problems

2012-05-02 Thread Jim Lucas
On 5/2/2012 4:28 PM, Duken Marga wrote: But I don't see any attachments in this message. This was in the first email of this thread. I can easily extract data from the database. However, if I try to enter data, it goes into the incorrect record. Following are some screenshots. The program i

Re: [PHP] PHP & Database Problems -- Code Snippets

2012-05-02 Thread Duken Marga
It is a good habbit to write the core code just for inserting/retrieving data from database. It will reduce much of your code complexity. When you see your code is working, you can continue to embed it with your visual front-end or with your filter. On Thu, May 3, 2012 at 4:43 AM, Ethan Rosenberg

Re: [PHP] PHP & Database Problems

2012-05-02 Thread Duken Marga
erg [mailto:eth...@earthlink.net] >> Sent: 02 May 2012 19:54 >> To: php-db-lists.php.net; php-general@lists.php.net >> Subject: [PHP-DB] PHP& Database Problems >> >> have a database >> >> mysql>

Re: [PHP] PHP & Database Problems -- Code Snippets

2012-05-02 Thread Matijn Woudt
On Wed, May 2, 2012 at 11:43 PM, Ethan Rosenberg wrote: > Dear list - > > Sorry for the attachment.  Here are code snippets --- Ethan, I don't want to sound rude, but it appears to me you don't have any understanding of what you're doing. It might help if you understand what the code is doing...

[PHP] Re: [PHP-DB] PHP & Database Problems -- Code Snippets

2012-05-02 Thread Christopher Jones
I noticed the use of SQL concatenation like: $allowed_fields = array ( 'Site' =>$_POST['Site'], 'MedRec' => $_POST['MedRec'], 'Fname' => $_POST['Fname'], 'Lname' => $_POST['Lname'] , 'Phone' => $_POST['Phone'] , 'Sex' => $_POST['Sex'] , 'Height' => $_POST['Height'] ); if(emp

[PHP] PHP & Database Problems -- Code Snippets

2012-05-02 Thread Ethan Rosenberg
Dear list - Sorry for the attachment. Here are code snippets --- GET THE DATA FROM INTAKE3: function handle_data() { global $cxn; $query = "select * from Intake3 where 1"; if(isset($_Request['Sex'])&& trim($_POST['Sex']) != '' ) { if ($_REQUE

Re: [PHP] PHP & Database Problems

2012-05-02 Thread Terry Ally (Gmail)
Dear Ethan, It would be useful to see what code you are using. The syntax is: UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value The data that you are required to enter is for Intake3. I am assuming that the only change is the History and/or Phone that you nee

Re: [PHP] PHP & Database Problems

2012-05-02 Thread Jim Lucas
the mailing list's) Gav -Original Message- From: Ethan Rosenberg [mailto:eth...@earthlink.net] Sent: 02 May 2012 19:54 To: php-db-lists.php.net; php-general@lists.php.net Subject: [PHP-DB] PHP& Database Problems have a database mysql> desc

[PHP] RE: [PHP-DB] PHP & Database Problems

2012-05-02 Thread Gavin Chalkley
bject: [PHP-DB] PHP & Database Problems have a database mysql> describe Intake3; ++-+--+-+-+---+ | Field | Type| Null | Key | Default | Extra | ++-+--+-+-+---+ | Site | varchar(6)

[PHP] PHP & Database Problems

2012-05-02 Thread Ethan Rosenberg
have a database mysql> describe Intake3; ++-+--+-+-+---+ | Field | Type| Null | Key | Default | Extra | ++-+--+-+-+---+ | Site | varchar(6) | NO | PRI | | | | MedRec | int(6) | NO |

Re: [PHP] database design in a survey/poll system

2010-11-17 Thread Tamara Temple
On Nov 17, 2010, at 7:42 AM, 肖晗 wrote: I plan to design a small survey/poll system similar to polldaddy . And I have some confusion in designing the database for the multiple/ single choice questions. Of course, it is possible to use one table to store the question tit

Re: [PHP] database design in a survey/poll system

2010-11-17 Thread Adam Richardson
On Wed, Nov 17, 2010 at 8:42 AM, 肖晗 wrote: > I plan to design a small survey/poll system similar to > polldaddy > . > > And I have some confusion in designing the database for the multiple/single > choice questions. Of course, it is possible to use one table to store the >

[PHP] database design in a survey/poll system

2010-11-17 Thread 肖晗
I plan to design a small survey/poll system similar to polldaddy . And I have some confusion in designing the database for the multiple/single choice questions. Of course, it is possible to use one table to store the question title and another table to store the choice item

Re: [PHP] Database Administration

2010-09-30 Thread Tom Barrett
Thanks for the replies, they have been most enlightening. :)

Re: [PHP] Database Administration

2010-09-24 Thread Bastien Koert
On Fri, Sep 24, 2010 at 3:50 PM, Bob McConnell wrote: > From: tedd > >>At 2:36 PM -0400 9/24/10, Bastien Koert wrote: >>>On Fri, Sep 24, 2010 at 2:26 PM, tedd wrote:  At 2:09 PM -0400 9/24/10, Bastien Koert wrote: > > �...@tedd, > >  He wants not techie users to create new sy

RE: [PHP] Database Administration

2010-09-24 Thread Bob McConnell
From: tedd >At 2:36 PM -0400 9/24/10, Bastien Koert wrote: >>On Fri, Sep 24, 2010 at 2:26 PM, tedd wrote: >>> At 2:09 PM -0400 9/24/10, Bastien Koert wrote: @tedd, He wants not techie users to create new systems for their clients when they sign up. It involves creatin

Re: [PHP] Database Administration

2010-09-24 Thread tedd
At 2:36 PM -0400 9/24/10, Bastien Koert wrote: On Fri, Sep 24, 2010 at 2:26 PM, tedd wrote: At 2:09 PM -0400 9/24/10, Bastien Koert wrote: @tedd, He wants not techie users to create new systems for their clients when they sign up. It involves creating a DB and he's wondering about secur

Re: [PHP] Database Administration

2010-09-24 Thread Bastien Koert
On Fri, Sep 24, 2010 at 2:26 PM, tedd wrote: > At 2:09 PM -0400 9/24/10, Bastien Koert wrote: >> >> @tedd, >> >> He wants not techie users to create new systems for their clients when >> they sign up. It involves creating a DB and he's wondering about >> security for that. The main part of the app

Re: [PHP] Database Administration

2010-09-24 Thread tedd
At 2:09 PM -0400 9/24/10, Bastien Koert wrote: @tedd, He wants not techie users to create new systems for their clients when they sign up. It involves creating a DB and he's wondering about security for that. The main part of the app needs the least priv's to run (select, update, insert [,delet

Re: [PHP] Database Administration

2010-09-24 Thread Bastien Koert
On Fri, Sep 24, 2010 at 2:05 PM, tedd wrote: > At 11:19 AM +0100 9/24/10, Tom Barrett wrote: >> >> On 22 September 2010 21:40, Bastien Koert wrote: >> >>>  Not at all. What I would suggest is that you create a separate mysql >>>  user that is used exclusively by the script to do the create stuff.

Re: [PHP] Database Administration

2010-09-24 Thread tedd
At 11:19 AM +0100 9/24/10, Tom Barrett wrote: On 22 September 2010 21:40, Bastien Koert wrote: Not at all. What I would suggest is that you create a separate mysql user that is used exclusively by the script to do the create stuff. The regular application user account should not have those

Re: [PHP] Database Administration

2010-09-24 Thread Andrew Ballard
On Fri, Sep 24, 2010 at 6:19 AM, Tom Barrett wrote: [snip] > I'm not actually that familiar with DB admin to that extent. I have either > app users with lock+crud on specific databases, or root. As a an aside, > would you know if there is a level of permissions for a user between app and > root th

Re: [PHP] Database Administration

2010-09-24 Thread Tom Barrett
On 22 September 2010 21:40, Bastien Koert wrote: > Not at all. What I would suggest is that you create a separate mysql > user that is used exclusively by the script to do the create stuff. > The regular application user account should not have those privileges > at all. > I'm not actually that

Re: [PHP] Database Administration

2010-09-23 Thread tedd
At 9:35 PM +0100 9/22/10, Tom Barrett wrote: Hmm.. I am familiar with PMA. I would for the purpose of this project consider it too technical for the target user base. The point is to create a GUI layer that would manage these things. For example, the 'add client' screen would ask for four thing

Re: [PHP] Database Administration

2010-09-22 Thread Bastien Koert
On Wed, Sep 22, 2010 at 4:35 PM, Tom Barrett wrote: > Hmm.. > > I am familiar with PMA. I would for the purpose of this project consider it > too technical for the target user base. The point is to create a GUI layer > that would manage these things. > > For example, the 'add client' screen would

Re: [PHP] Database Administration

2010-09-22 Thread Tom Barrett
Hmm.. I am familiar with PMA. I would for the purpose of this project consider it too technical for the target user base. The point is to create a GUI layer that would manage these things. For example, the 'add client' screen would ask for four things; name, description, username and password. Th

Re: [PHP] Database Administration

2010-09-21 Thread tedd
At 10:48 AM +0100 9/21/10, Tom Barrett wrote: Hi I need to build a custom client management app, which will build and manage a database per client. This means that on top of the usual sql crud, it needs to be able to create databases, add/edit/delete database users, create tables. Is there a wa

RE: [PHP] Database Administration

2010-09-21 Thread Jay Blanchard
[snip] I need to build a custom client management app, which will build and manage a database per client. This means that on top of the usual sql crud, it needs to be able to create databases, add/edit/delete database users, create tables. Is there a way for me to do this nicely as PHP solution?

RE: [PHP] Database Administration

2010-09-21 Thread Jangita
inal Message- From: Tom Barrett [mailto:t...@miramedia.co.uk] Sent: 21 September 2010 11:48 AM To: PHP General List Subject: [PHP] Database Administration Hi I need to build a custom client management app, which will build and manage a database per client. This means that on top of the usual

Re: [PHP] Database Administration

2010-09-21 Thread Peter Lind
On 21 September 2010 11:48, Tom Barrett wrote: > Hi > > I need to build a custom client management app, which will build and manage > a database per client. This means that on top of the usual sql crud, it > needs to be able to create databases, add/edit/delete database users, create > tables. > >

[PHP] Database Administration

2010-09-21 Thread Tom Barrett
Hi I need to build a custom client management app, which will build and manage a database per client. This means that on top of the usual sql crud, it needs to be able to create databases, add/edit/delete database users, create tables. Is there a way for me to do this nicely as PHP solution? am I

[PHP] Re: PHP database interface layer

2010-07-22 Thread Shawn McKenzie
On 07/22/2010 08:35 AM, Marc Guay wrote: > Hi everyone, > > I've built a fairly large normalized database schema for a project. > This is fun for me as I like thinking about how everything is > interconnected. Foreign keys are all set up, many-to-many tables are > go, etc, and so on. But now it

Re: [PHP] PHP database interface layer

2010-07-22 Thread Marc Guay
> Let me repeat myself: did you have a look at Doctrine2? Hi Peter, I didn't mean to ignore your suggestion, I just got extremely overwealmed by the Doctrine website and didn't even have a response. I get the impression that, like Zend and others, learning how to install and use that would take l

Re: [PHP] PHP database interface layer

2010-07-22 Thread Peter Lind
On 22 July 2010 21:14, Marc Guay wrote: >> i recommend propel >> http://www.propelorm.org/ > > Holy Moses that thing is a monster.  It requires installing extra > libraries (Phing) in order to create an XML schema reverse-engineered > from my existing database.  The code looks simple enough but th

Re: [PHP] PHP database interface layer

2010-07-22 Thread Nathan Nobbe
On Thu, Jul 22, 2010 at 1:14 PM, Marc Guay wrote: > > i recommend propel > > http://www.propelorm.org/ > > Holy Moses that thing is a monster. It requires installing extra > libraries (Phing) in order to create an XML schema reverse-engineered > from my existing database. The code looks simple

Re: [PHP] PHP database interface layer

2010-07-22 Thread Floyd Resler
On Jul 22, 2010, at 3:14 PM, Marc Guay wrote: >> i recommend propel >> http://www.propelorm.org/ > > Holy Moses that thing is a monster. It requires installing extra > libraries (Phing) in order to create an XML schema reverse-engineered > from my existing database. The code looks simple enoug

Re: [PHP] PHP database interface layer

2010-07-22 Thread Marc Guay
> i recommend propel > http://www.propelorm.org/ Holy Moses that thing is a monster. It requires installing extra libraries (Phing) in order to create an XML schema reverse-engineered from my existing database. The code looks simple enough but that installation is brutal. Any other suggestions?

Re: [PHP] PHP database interface layer

2010-07-22 Thread Marc Guay
> i recommend propel > http://www.propelorm.org/ This looks hopeful. I'd checked it out before but for some reason lumped it in with all of the other half-baked tools that didn't do what I wanted, but even that basic example seems to cover most of what I want. Thanks for the suggestions. Marc

Re: [PHP] PHP database interface layer

2010-07-22 Thread Nathan Nobbe
On Thu, Jul 22, 2010 at 7:35 AM, Marc Guay wrote: > Hi everyone, > > I've built a fairly large normalized database schema for a project. > This is fun for me as I like thinking about how everything is > interconnected. Foreign keys are all set up, many-to-many tables are > go, etc, and so on.

Re: [PHP] PHP database interface layer

2010-07-22 Thread Peter Lind
On 22 July 2010 15:35, Marc Guay wrote: > Hi everyone, > > I've built a fairly large normalized database schema for a project. > This is fun for me as I like thinking about how everything is > interconnected.  Foreign keys are all set up, many-to-many tables are > go, etc, and so on.   But now it'

[PHP] PHP database interface layer

2010-07-22 Thread Marc Guay
Hi everyone, I've built a fairly large normalized database schema for a project. This is fun for me as I like thinking about how everything is interconnected. Foreign keys are all set up, many-to-many tables are go, etc, and so on. But now it's time to create an interface between that database

Re: [PHP] Database vs. Array

2010-03-16 Thread Ryan Sun
Maybe you want to optimize your script first, and I don't think read entire data set into array would save you much time. Don't create new variables when its unnecessary, cache data when its necessary, try memcached, and I think heavy php cli scripts are always likely to resume a lot of resource

Re: [PHP] Database vs. Array

2010-03-16 Thread Bastien Koert
What I usually do is to pull a limited set of records ( like 10 or 50 ) and the do the operations on them, update a column in that table to mark them completed and use JavaScript to reload the page and pull the next set out where that flag field is null. No memory issue, no need to large timeouts

[PHP] Database vs. Array

2010-03-16 Thread Richard S. Crawford
I have a script that connects to an external database to process about 4,000 records. Each record needs to be operated on pretty heavily, and the script overall takes about half an hour to execute. We've hit a wall where the script's memory usage exceeds the amount allocated to PHP. I've increased

[PHP] database credentials with ini_set() question?

2010-03-12 Thread dsiembab01
I know that phpinfo() will show the pass and username as plain text, but other than that what are the security reasons for not using ini_set() for database credentials? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Database design

2010-02-24 Thread Paul M Foster
On Thu, Feb 25, 2010 at 03:37:38PM +1000, Angus Mann wrote: > Hi all. I know this is not strictly a PHP question but the code will be > written in PHP, and I figure the folks here will be well versed in the > questions I raise. Please feel free to contact me off the list if appropriate. > > I n

[PHP] Database design

2010-02-24 Thread Angus Mann
Hi all. I know this is not strictly a PHP question but the code will be written in PHP, and I figure the folks here will be well versed in the questions I raise. Please feel free to contact me off the list if appropriate. I need some assistance with database design for a project I'm coding in PH

Re: [PHP] database abstraction layer

2010-02-03 Thread Lester Caine
Ashley Sheridan wrote: On Tue, 2010-02-02 at 23:19 +0100, Rene Veerman wrote: function getMax($table, $field) If I saw this sort of code I'd be appalled! It's possibly the worst way to get the auto increment value. You won't notice it testing the site out on your own, but all hell will break

Re: [PHP] database abstraction layer

2010-02-02 Thread Paul M Foster
On Wed, Feb 03, 2010 at 06:39:29AM +0100, Rene Veerman wrote: > On Wed, Feb 3, 2010 at 5:49 AM, Jochem Maas wrote: > > you can bet you ass that every other DB out there that's worth it's salt > > has atomic id incrementor functionality exposed in some way or other. > > > > @Rene: all that talk of

Re: [PHP] database abstraction layer

2010-02-02 Thread Rene Veerman
On Wed, Feb 3, 2010 at 5:49 AM, Jochem Maas wrote: > you can bet you ass that every other DB out there that's worth it's salt > has atomic id incrementor functionality exposed in some way or other. > > @Rene: all that talk of maxId functions and random retries etc, etc, is > complete pooh. > don'

Re: [PHP] database abstraction layer

2010-02-02 Thread Jochem Maas
Op 2/3/10 12:19 AM, Ashley Sheridan schreef: > On Wed, 2010-02-03 at 00:21 +0100, Rene Veerman wrote: > >> the auto_increment sytnax is not uniform across servers, is it? >> >> On Wed, Feb 3, 2010 at 12:11 AM, Ashley Sheridan >> wrote: >> >>> I saw it happen on a site that was getting only about

Re: [PHP] database abstraction layer

2010-02-02 Thread Phpster
Lol, damn iPod corrections. The app designers is what was meant. Bastien Sent from my iPod On Feb 2, 2010, at 8:41 PM, Robert Cummings wrote: Phpster wrote: Yep, love those race conditions. We have them all over the app cuz the app ciders don't know shit! Mmmm... apple cider... to cu

Re: [PHP] database abstraction layer

2010-02-02 Thread Paul M Foster
On Tue, Feb 02, 2010 at 11:19:29PM +0100, Rene Veerman wrote: > oh, on using adodb.sf.net and 0-overhead for jumping between mysql and > postgresql; > > keep all your queries to as simple & early-standard sql as possible. > the auto_increment incompatibilities can be circumvented with a > relativ

Re: [PHP] database abstraction layer

2010-02-02 Thread Michael A. Peters
Robert Cummings wrote: *snip* Einstein I believe said something along the lines of "A smart person solves a problem. A wise person avoids it in the first place" Might not have been Einstein, but anyway ... Do you mean the following quote? The difference between a smart person and a wise

Re: [PHP] database abstraction layer

2010-02-02 Thread Robert Cummings
Michael A. Peters wrote: Robert Cummings wrote: Rene Veerman wrote: eh thats "randomize the timing of the retry attempt".. On Wed, Feb 3, 2010 at 12:17 AM, Rene Veerman wrote: and after the sleep(rand(1,3)) it might need a short loop like this; $rnd = rand(1,9); $a=0; for ($i=0; $i<$rn

Re: [PHP] database abstraction layer

2010-02-02 Thread Michael A. Peters
Robert Cummings wrote: Rene Veerman wrote: eh thats "randomize the timing of the retry attempt".. On Wed, Feb 3, 2010 at 12:17 AM, Rene Veerman wrote: and after the sleep(rand(1,3)) it might need a short loop like this; $rnd = rand(1,9); $a=0; for ($i=0; $i<$rnd; $i++) { $a++ } to furt

Re: [PHP] database abstraction layer

2010-02-02 Thread Robert Cummings
Rene Veerman wrote: On Wed, Feb 3, 2010 at 12:18 AM, Ashley Sheridan wrote: The problem is where 2 people choose the same instant to perform an action on your site that inserts a record into your db. The db engine inserts them one after the other, and then responds about the max(id) to your PH

Re: [PHP] database abstraction layer

2010-02-02 Thread Robert Cummings
Phpster wrote: Yep, love those race conditions. We have them all over the app cuz the app ciders don't know shit! Mmmm... apple cider... to cure what ails you or at least get you drunk enough to not care about the horrible race conditions >:) Cheers, Rob. -- http://www.interjinn.com Applica

Re: [PHP] database abstraction layer

2010-02-02 Thread Robert Cummings
Rene Veerman wrote: On Wed, Feb 3, 2010 at 12:35 AM, Ashley Sheridan wrote: It's the reason transactions exist, to prevent things happening like this. When you have two actions where one is dependent on the other, unless you have a way to tie them together so that they can't be broken, you run

Re: [PHP] database abstraction layer

2010-02-02 Thread Robert Cummings
Rene Veerman wrote: On Wed, Feb 3, 2010 at 12:18 AM, Ashley Sheridan wrote: The problem is where 2 people choose the same instant to perform an action on your site that inserts a record into your db. The db engine inserts them one after the other, and then responds about the max(id) to your PH

Re: [PHP] database abstraction layer

2010-02-02 Thread Robert Cummings
Rene Veerman wrote: eh thats "randomize the timing of the retry attempt".. On Wed, Feb 3, 2010 at 12:17 AM, Rene Veerman wrote: and after the sleep(rand(1,3)) it might need a short loop like this; $rnd = rand(1,9); $a=0; for ($i=0; $i<$rnd; $i++) { $a++ } to further randomize the retry

Re: [PHP] database abstraction layer

2010-02-02 Thread Robert Cummings
Rene Veerman wrote: i haven't had the pleasure yet of writing for sites that generate so many hits/sec that they'd update the max value of any table at exactly the same time. i usually ask for the max value about 2 milliseconds before doing the insert. And if the insert fails, i can auto-retry v

Re: [PHP] database abstraction layer

2010-02-02 Thread Phpster
Good lord that is exacty the same logic applied in our app. It only takes about 100 users to create the issue. Bastien Sent from my iPod On Feb 2, 2010, at 6:05 PM, Rene Veerman wrote: i haven't had the pleasure yet of writing for sites that generate so many hits/sec that they'd update t

Re: [PHP] database abstraction layer

2010-02-02 Thread Phpster
Yep, love those race conditions. We have them all over the app cuz the app ciders don't know shit! Bastien Sent from my iPod On Feb 2, 2010, at 5:46 PM, Ashley Sheridan wrote: On Tue, 2010-02-02 at 23:19 +0100, Rene Veerman wrote: function getMax($table, $field) If I saw this sort

Re: [PHP] database abstraction layer

2010-02-02 Thread Rene Veerman
On Wed, Feb 3, 2010 at 12:35 AM, Ashley Sheridan wrote: > It's the reason transactions exist, to prevent things happening like this. > When you have two actions where one is dependent on the other, unless you > have a way to tie them together so that they can't be broken, you run the > risk of col

Re: [PHP] database abstraction layer

2010-02-02 Thread Ashley Sheridan
On Wed, 2010-02-03 at 00:31 +0100, Rene Veerman wrote: > On Wed, Feb 3, 2010 at 12:18 AM, Ashley Sheridan > wrote: > > > The problem is where 2 people choose the same instant to perform an > > action on your site that inserts a record into your db. The db engine > > inserts them one after the ot

Re: [PHP] database abstraction layer

2010-02-02 Thread Rene Veerman
On Wed, Feb 3, 2010 at 12:18 AM, Ashley Sheridan wrote: > The problem is where 2 people choose the same instant to perform an > action on your site that inserts a record into your db. The db engine > inserts them one after the other, and then responds about the max(id) to > your PHP script. Then,

Re: [PHP] database abstraction layer

2010-02-02 Thread Ashley Sheridan
On Wed, 2010-02-03 at 00:21 +0100, Rene Veerman wrote: > the auto_increment sytnax is not uniform across servers, is it? > > On Wed, Feb 3, 2010 at 12:11 AM, Ashley Sheridan > wrote: > > > I saw it happen on a site that was getting only about 3000 hits a day. It > > just takes the right combina

Re: [PHP] database abstraction layer

2010-02-02 Thread Ashley Sheridan
On Wed, 2010-02-03 at 00:17 +0100, Rene Veerman wrote: > and after the sleep(rand(1,3)) it might need a short loop like this; > $rnd = rand(1,9); $a=0; > for ($i=0; $i<$rnd; $i++) { $a++ } > > to further randomize the retry attempt.. > > > On Wed, Feb 3, 2010 at 12:05 AM, Rene Veerman wrot

Re: [PHP] database abstraction layer

2010-02-02 Thread Rene Veerman
the auto_increment sytnax is not uniform across servers, is it? On Wed, Feb 3, 2010 at 12:11 AM, Ashley Sheridan wrote: > I saw it happen on a site that was getting only about 3000 hits a day. It > just takes the right combination of circumstances and it all goes pear > shaped. You really should

Re: [PHP] database abstraction layer

2010-02-02 Thread Rene Veerman
eh thats "randomize the timing of the retry attempt".. On Wed, Feb 3, 2010 at 12:17 AM, Rene Veerman wrote: > and after the sleep(rand(1,3)) it might need a short loop like this; > $rnd = rand(1,9); $a=0; > for ($i=0; $i<$rnd; $i++) { $a++ } > > to further randomize the retry attempt.. > >

Re: [PHP] database abstraction layer

2010-02-02 Thread Rene Veerman
and after the sleep(rand(1,3)) it might need a short loop like this; $rnd = rand(1,9); $a=0; for ($i=0; $i<$rnd; $i++) { $a++ } to further randomize the retry attempt.. On Wed, Feb 3, 2010 at 12:05 AM, Rene Veerman wrote: > i haven't had the pleasure yet of writing for sites that generate

Re: [PHP] database abstraction layer

2010-02-02 Thread Ashley Sheridan
On Wed, 2010-02-03 at 00:05 +0100, Rene Veerman wrote: > i haven't had the pleasure yet of writing for sites that generate so many > hits/sec that > they'd update the max value of any table at exactly the same time. > > i usually ask for the max value about 2 milliseconds before doing the > inser

Re: [PHP] database abstraction layer

2010-02-02 Thread Rene Veerman
i haven't had the pleasure yet of writing for sites that generate so many hits/sec that they'd update the max value of any table at exactly the same time. i usually ask for the max value about 2 milliseconds before doing the insert. And if the insert fails, i can auto-retry via a wrapper function

Re: [PHP] database abstraction layer

2010-02-02 Thread Ashley Sheridan
On Tue, 2010-02-02 at 23:19 +0100, Rene Veerman wrote: > function getMax($table, $field) If I saw this sort of code I'd be appalled! It's possibly the worst way to get the auto increment value. You won't notice it testing the site out on your own, but all hell will break loose when you start get

Re: [PHP] database abstraction layer

2010-02-02 Thread Rene Veerman
oh, on using adodb.sf.net and 0-overhead for jumping between mysql and postgresql; keep all your queries to as simple & early-standard sql as possible. the auto_increment incompatibilities can be circumvented with a relatively simple function getMax($table, $field) { in adodb, you'd loop through

Re: [PHP] database abstraction layer

2010-02-02 Thread Paul M Foster
On Tue, Feb 02, 2010 at 01:15:22PM -0800, Daevid Vincent wrote: > > -Original Message- > > From: Lars Nielsen [mailto:l...@mit-web.dk] > > Sent: Tuesday, February 02, 2010 12:24 PM > > To: php-general@lists.php.net > > Subject: [PHP] database abstraction laye

RE: [PHP] database abstraction layer

2010-02-02 Thread Daevid Vincent
> -Original Message- > From: Lars Nielsen [mailto:l...@mit-web.dk] > Sent: Tuesday, February 02, 2010 12:24 PM > To: php-general@lists.php.net > Subject: [PHP] database abstraction layer > > Hi List > > I am trying to make a Database Abstraction Layer so

Re: [PHP] database abstraction layer

2010-02-02 Thread Paul M Foster
On Tue, Feb 02, 2010 at 09:23:47PM +0100, Lars Nielsen wrote: > Hi List > > I am trying to make a Database Abstraction Layer so I can which the DB > of my application between MySQL and Postgresql. I have been looking at > the way phpBB does it, and it seems that it is only then php-functions > wh

Re: [PHP] database abstraction layer

2010-02-02 Thread Rene Veerman
i'm a fan of adodb.sf.net, which i've used with both postgresql and mysql. On Tue, Feb 2, 2010 at 9:23 PM, Lars Nielsen wrote: > Hi List > > I am trying to make a Database Abstraction Layer so I can which the DB > of my application between MySQL and Postgresql. I have been looking at > the way ph

  1   2   3   4   5   >