Re: [PHP-DB] Storing multiple items in one MySQL field?

2012-01-11 Thread Karl DeSaulniers
Ok, thanks. On Jan 11, 2012, at 11:53 AM, Peter Lind wrote: *snip* How does set() know the difference between say the first row (1) + the fifth row (5) and the second row (2) + fouth row (4) in the bit set? The sum of both are the same. I am sure I am congfusing something. Ummm ... if

Re: [PHP-DB] Storing multiple items in one MySQL field?

2012-01-11 Thread Karl DeSaulniers
Yeah, I was being somewhat facetious about the colors of a shirt. :) I agree on the items and attributes drill-down before implementation though. There will be more than T-Shirts. Watches, book-covers, etc, etc. So I need to find a general logic to cover the items and attributes of each

Re: [PHP-DB] Storing multiple items in one MySQL field?

2012-01-11 Thread B. Aerts
Karl, I'm somewhat limited to reading posts, so I might have missed something, but can you explain why you wanted to avoid the 3rd table solution ? Because depending on that question, I can offer two other solutions, but they have their own limitations. Solution 1: the 2,5nd table. you

Re: [PHP-DB] Storing multiple items in one MySQL field?

2012-01-10 Thread B. Aerts
On 08/01/12 23:35, Karl DeSaulniers wrote: On Jan 8, 2012, at 10:36 AM, Bastien wrote: On 2012-01-08, at 7:27 AM, Niel Archer n...@chance.now wrote: -- Niel Archer niel.archer (at) blueyonder.co.uk Hello phpers and sqlheads, If you have a moment, I have a question. INTRO: I am trying

Re: [PHP-DB] Receiving Error- Error: user account already exists..

2012-01-10 Thread Niel Archer
I keep receiving the following error..( Error: user account already exists.. ) although I don't have any data in my table. Any help would be appreciated. The code follows: ?php session_start(); include ('dbc.php'); if (isset($_POST['Submit'])

Re: [PHP-DB] Storing multiple items in one MySQL field?

2012-01-10 Thread Karl DeSaulniers
On Jan 10, 2012, at 9:30 AM, B. Aerts wrote: On 08/01/12 23:35, Karl DeSaulniers wrote: On Jan 8, 2012, at 10:36 AM, Bastien wrote: On 2012-01-08, at 7:27 AM, Niel Archer n...@chance.now wrote: -- Niel Archer niel.archer (at) blueyonder.co.uk Hello phpers and sqlheads, If you have a

Re: [PHP-DB] Storing multiple items in one MySQL field?

2012-01-10 Thread Karl DeSaulniers
On Jan 10, 2012, at 10:49 PM, Karl DeSaulniers wrote: On Jan 10, 2012, at 9:30 AM, B. Aerts wrote: On 08/01/12 23:35, Karl DeSaulniers wrote: On Jan 8, 2012, at 10:36 AM, Bastien wrote: On 2012-01-08, at 7:27 AM, Niel Archer n...@chance.now wrote: -- Niel Archer niel.archer (at)

Re: [PHP-DB] Storing multiple items in one MySQL field?

2012-01-10 Thread Peter Lind
On Jan 11, 2012 7:13 AM, Karl DeSaulniers k...@designdrumm.com wrote: On Jan 10, 2012, at 10:49 PM, Karl DeSaulniers wrote: On Jan 10, 2012, at 9:30 AM, B. Aerts wrote: On 08/01/12 23:35, Karl DeSaulniers wrote: On Jan 8, 2012, at 10:36 AM, Bastien wrote: On 2012-01-08, at 7:27 AM,

Re: [PHP-DB] Storing multiple items in one MySQL field?

2012-01-08 Thread Bastien
On 2012-01-08, at 7:27 AM, Niel Archer n...@chance.now wrote: -- Niel Archer niel.archer (at) blueyonder.co.uk Hello phpers and sqlheads, If you have a moment, I have a question. INTRO: I am trying to set up categories for a web site. Each item can belong to more than one category.

Re: [PHP-DB] Storing multiple items in one MySQL field?

2012-01-08 Thread Karl DeSaulniers
On Jan 8, 2012, at 10:36 AM, Bastien wrote: On 2012-01-08, at 7:27 AM, Niel Archer n...@chance.now wrote: -- Niel Archer niel.archer (at) blueyonder.co.uk Hello phpers and sqlheads, If you have a moment, I have a question. INTRO: I am trying to set up categories for a web site. Each

Re: [PHP-DB] isError ADODB

2012-01-05 Thread David McGlone
On Mon, 2012-01-02 at 20:34 -0600, Karl DeSaulniers wrote: I am not ADO savvy, but the error message you got is the same as what I get in MySQL. On this line, try.. If($this-isError($this-db)) Hoping that fixes it for you. Best, Thanks Karl. I finally got to try this and it wasn't the

Re: [PHP-DB] isError ADODB

2012-01-05 Thread Lester Caine
David McGlone wrote: I am not ADO savvy, but the error message you got is the same as what I get in MySQL. On this line, try.. If($this-isError($this-db)) if( $this-db-isError() ) BUT if( !$this-db ) { not connected } is the more normal first check Hoping that fixes it for you.

Re: [PHP-DB] isError ADODB

2012-01-02 Thread Karl DeSaulniers
I am not ADO savvy, but the error message you got is the same as what I get in MySQL. On this line, try.. If($this-isError($this-db)) Hoping that fixes it for you. Best, Karl On Jan 2, 2012, at 8:29 PM, David McGlone wrote: If(isError($this-db)) Karl DeSaulniers Design Drumm

Re: [PHP-DB] Abstraction library

2011-12-31 Thread David McGlone
On Fri, 2011-12-30 at 17:36 +, Lester Caine wrote: David McGlone wrote: On Fri, 2011-12-30 at 11:23 -0500, David McGlone wrote: On Fri, 2011-12-30 at 12:27 +, Lester Caine wrote: David McGlone wrote: Hi everyone I got a quick question. I'm wondering if anyone is

Re: [PHP-DB] Abstraction library

2011-12-30 Thread Lester Caine
David McGlone wrote: Hi everyone I got a quick question. I'm wondering if anyone is using a DB abstraction layer such as PEAR DB. I've used PEAR DB in the past and knew it's been on it's way to extinction, but never looked into alternatives or any other way to replace it. Now this has come back

Re: [PHP-DB] Abstraction library

2011-12-30 Thread David McGlone
On Fri, 2011-12-30 at 12:27 +, Lester Caine wrote: David McGlone wrote: Hi everyone I got a quick question. I'm wondering if anyone is using a DB abstraction layer such as PEAR DB. I've used PEAR DB in the past and knew it's been on it's way to extinction, but never looked into

Re: [PHP-DB] Abstraction library

2011-12-30 Thread David McGlone
On Fri, 2011-12-30 at 11:23 -0500, David McGlone wrote: On Fri, 2011-12-30 at 12:27 +, Lester Caine wrote: David McGlone wrote: Hi everyone I got a quick question. I'm wondering if anyone is using a DB abstraction layer such as PEAR DB. I've used PEAR DB in the past and knew it's

Re: [PHP-DB] Abstraction library

2011-12-30 Thread Lester Caine
David McGlone wrote: On Fri, 2011-12-30 at 11:23 -0500, David McGlone wrote: On Fri, 2011-12-30 at 12:27 +, Lester Caine wrote: David McGlone wrote: Hi everyone I got a quick question. I'm wondering if anyone is using a DB abstraction layer such as PEAR DB. I've used

Re: [PHP-DB] Tables and foreign keys

2011-12-26 Thread Karl DeSaulniers
On Dec 26, 2011, at 1:57 AM, Amit Tandon wrote: Dear Karl Foreign key is a good option (provided you use InnoDB database) to automate the deletion/updation of cart details when you remove cart. Besides 1:1 cardinality is good or bad can only be decided on the semantics of your tables.

Re: [PHP-DB] Tables and foreign keys

2011-12-26 Thread Amit Tandon
regds amit The difference between fiction and reality? Fiction has to make sense. On Mon, Dec 26, 2011 at 1:55 PM, Karl DeSaulniers k...@designdrumm.comwrote: On Dec 26, 2011, at 1:57 AM, Amit Tandon wrote: Dear Karl Foreign key is a good option (provided you use InnoDB

Re: [PHP-DB] Tables and foreign keys

2011-12-26 Thread Karl DeSaulniers
On Dec 26, 2011, at 3:05 AM, Amit Tandon wrote: regds amit The difference between fiction and reality? Fiction has to make sense. On Mon, Dec 26, 2011 at 1:55 PM, Karl DeSaulniers k...@designdrumm.com wrote: On Dec 26, 2011, at 1:57 AM, Amit Tandon wrote: Dear Karl

Re: [PHP-DB] Tables and foreign keys

2011-12-26 Thread Amit Tandon
Dear KarlRefer Wiki entryhttp://en.wikipedia.org/wiki/Entity-relationship_model. The last diagram shows one to many relationship in many ways. That may help you in clearing your doubts about the comma which is a way of representing the relationship Quoted from MS Access example One-To-Many

Re: [PHP-DB] Tables and foreign keys

2011-12-26 Thread Karl DeSaulniers
Thank you! On Dec 26, 2011, at 4:12 AM, Amit Tandon wrote: Dear Karl Refer Wiki entry. The last diagram shows one to many relationship in many ways. That may help you in clearing your doubts about the comma which is a way of representing the relationship Quoted from MS Access example

Re: [PHP-DB] Tables and foreign keys

2011-12-25 Thread Amit Tandon
Dear Karl Foreign key is a good option (provided you use InnoDB database) to automate the deletion/updation of cart details when you remove cart. Besides 1:1 cardinality is good or bad can only be decided on the semantics of your tables. As a an aside, if it is 1:1 cardinality, then you can

Re: [PHP-DB] Set Mssql Application name in connection string

2011-12-13 Thread Matijn Woudt
On Tue, Dec 13, 2011 at 1:33 PM, Dan Rowe d...@dracosplace.com wrote: We needed to be able to set the application name in a mssql connection string, but php doesn't current toy support it. This can be very helpful while debugging/profiling php-mssql from the SQL server side of things.

Re: [PHP-DB] Set Mssql Application name in connection string

2011-12-13 Thread Dan Rowe
Hey Matijn, Thanks for the tip. We did send it there the day we submitted it, so its good to know we were on the right track. Unfortunately it didn't gain any traction or any status updates on the bug tracker. Figured I would send to this list in case it was more applicable to the user base and

Re: [PHP-DB] Set Mssql Application name in connection string

2011-12-13 Thread Matijn Woudt
On Tue, Dec 13, 2011 at 10:58 PM, Dan Rowe d...@dracosplace.com wrote: Hey Matijn, Thanks for the tip. We did send it there the day we submitted it, so its good to know we were on the right track. Unfortunately it didn't gain any traction or any status updates on the bug tracker. Figured I

Re: [PHP-DB] sqlite

2011-11-30 Thread Tamara Temple
David McGlone da...@dmcentral.net wrote: On Tue, 2011-11-29 at 16:31 -0600, Tamara Temple wrote: David McGlone da...@dmcentral.net wrote: places.sqlite is mozilla's bookmarks db and I was trying to read this db, but so far I've been unsuccessful. sqlite ver: 2.8.17 PHP version:

Re: [PHP-DB] sqlite

2011-11-29 Thread Tamara Temple
David McGlone da...@dmcentral.net wrote: places.sqlite is mozilla's bookmarks db and I was trying to read this db, but so far I've been unsuccessful. sqlite ver: 2.8.17 PHP version: PHP 5.3.3-1ubuntu9.6 with Suhosin-Patch php5-sqlite: 5.3.3-1ubuntu9.6 Okay, first off, mozilla uses sqlite3,

Re: [PHP-DB] Problem with mysql and php

2011-11-29 Thread Tamara Temple
Jason Pruim li...@pruimphotography.com wrote: Given the following 2 queries: SELECT DISTINCT areacode FROM main WHERE state = '{$query_exploded[0]}'; SELECT DISTINCT areacode FROM main; The second displays ALOT faster Like by minutes... the first one is what I really want

Re: [PHP-DB] Problem with mysql and php

2011-11-29 Thread Dan Rowe
Try running this : http://mysqltuner.pl/mysqltuner.pl If the server has been up for over 24hrs it gives a lot of good insight and things to try tuning wise as a starting point. It'll uncover a lot of common configuration issues or MySQL server level bottlenecks. -Dan (apologizes for the top

Re: [PHP-DB] Problem with mysql and php

2011-11-29 Thread Jim Giner
Didn't the OP begin this very same subject a month ago? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] Problem with mysql and php

2011-11-29 Thread Amos Jean-Baptiste
From: joker_mos...@hotmail.com To: phps...@gmail.com Date: Tue, 29 Nov 2011 23:07:13 -0500 CC: phildob...@gmail.com; php-db@lists.php.net Subject: Re: [PHP-DB] Problem with mysql and php Le 2011-11-28 à 22:38, Bastien Koert phps...@gmail.com a écrit : On Mon, Nov 28, 2011 at 9

Re: [PHP-DB] sqlite

2011-11-29 Thread David McGlone
On Tue, 2011-11-29 at 16:31 -0600, Tamara Temple wrote: David McGlone da...@dmcentral.net wrote: places.sqlite is mozilla's bookmarks db and I was trying to read this db, but so far I've been unsuccessful. sqlite ver: 2.8.17 PHP version: PHP 5.3.3-1ubuntu9.6 with Suhosin-Patch

Re: [PHP-DB] Problem with mysql and php

2011-11-29 Thread Jason Pruim
Jim, Similar yes... But this was specifically about replacing distinct with something since it was taking WAY to long... But it did evolve into a very similar conversation :) Jason Pruim pru...@gmail.com On Nov 29, 2011, at 6:25 PM, Jim Giner wrote: Didn't the OP begin this very same

Re: [PHP-DB] Problem with mysql and php

2011-11-28 Thread Phil Dobbin
On 29/11/11 01:38, Jason Pruim li...@pruimphotography.com wrote: Given the following 2 queries: SELECT DISTINCT areacode FROM main WHERE state = '{$query_exploded[0]}'; SELECT DISTINCT areacode FROM main; The second displays ALOT faster Like by minutes... the first one is what I

Re: [PHP-DB] Problem with mysql and php

2011-11-28 Thread Jason Pruim
Jason Pruim pru...@gmail.com On Nov 28, 2011, at 8:58 PM, Phil Dobbin wrote: On 29/11/11 01:38, Jason Pruim li...@pruimphotography.com wrote: Given the following 2 queries: SELECT DISTINCT areacode FROM main WHERE state = '{$query_exploded[0]}'; SELECT DISTINCT areacode FROM main;

Re: [PHP-DB] Problem with mysql and php

2011-11-28 Thread Phil Dobbin
On 29/11/11 02:08, Jason Pruim pru...@gmail.com wrote: PostgreSQL? ;-)... In all seriousness... Would it help or change it in anyway? :) I am free to use what I want (I believe) on this project... It's well worth looking into. Postgres can handle far bigger db's much quicker than MySQL

Re: [PHP-DB] Problem with mysql and php

2011-11-28 Thread Bastien Koert
On Mon, Nov 28, 2011 at 9:19 PM, Phil Dobbin phildob...@gmail.com wrote: On 29/11/11 02:08, Jason Pruim pru...@gmail.com wrote: PostgreSQL? ;-)... In all seriousness... Would it help or change it in anyway? :) I am free to use what I want (I believe) on this project... It's well worth

Re: [PHP-DB] Problem with mysql and php

2011-11-28 Thread Amos Jean-Baptiste
Le 2011-11-28 à 22:38, Bastien Koert phps...@gmail.com a écrit : On Mon, Nov 28, 2011 at 9:19 PM, Phil Dobbin phildob...@gmail.com wrote: On 29/11/11 02:08, Jason Pruim pru...@gmail.com wrote: PostgreSQL? ;-)... In all seriousness... Would it help or change it in anyway? :) I am free

Re: [PHP-DB] Efficiency of DDD programing

2011-11-20 Thread Karl DeSaulniers
foreach ($articles as $author = $article) { echo(author.$i. =.$author.brarticle=.$article); } I think. I could be corrected. Not to mention, did you mean to spell your function like this? getAutor? Or did you mean getAuthor? HTH, Best, Karl Sent from losPhone On Nov 20, 2011, at 8:24 AM,

Re: [PHP-DB] Efficiency of DDD programing

2011-11-20 Thread Tamara Temple
Fanda d...@sidak.net wrote: how to solve this problem: If I write a repository for each entity, article and autor for example, article is composed of autor and some other things, then I want to select some articles: $articles = $articleRepo-findLast(10); foreach ($articles as $article)

Re: [PHP-DB] Prepared Statements

2011-11-12 Thread tamouse mailing lists
On Fri, Nov 11, 2011 at 10:41 AM, Ron Piggott ron.pigg...@actsministries.org wrote: ?php $dsh = 'mysql:host=localhost;dbname='.$database; $dbh = new PDO($dsh, $username, $password); #query for the authorization code $query = SELECT `authorization_code` FROM

Re: [PHP-DB] Need help with updating existing mysql records with something else

2011-11-12 Thread tamouse mailing lists
2011/11/11 Amit Tandon att...@gmail.com: U can update the record with following === $result = mysql_query(UPDATE  tax set mwool40_ totqty = $res, $connection) or die(error updating database); Won't this update every row in the table? I think you'd want: $result =

Re: [PHP-DB] Prepared Statements

2011-11-11 Thread Matijn Woudt
On Fri, Nov 11, 2011 at 5:41 PM, Ron Piggott ron.pigg...@actsministries.org wrote: I have two questions about Prepared Statements from the code below: #1: The purpose of the first $query is to determine if the authorization code supplied is both accurate and also live - When the

Re: [PHP-DB] Need help with updating existing mysql records with something else

2011-11-10 Thread Amit Tandon
Dear Guru U can update the record with following === $result = mysql_query(UPDATE tax set mwool40_ totqty = $res, $connection) or die(error updating database); if (mysql_affected_rows($connection) != 1 (/* no of rows that should be updated */) { die(Update problem) ; } The only issue

Re: [PHP-DB] Exporting mySQL to Excel

2011-11-09 Thread Richard Quadling
On 8 November 2011 18:31, Ron Piggott ron.pigg...@actsministries.org wrote: What is the preferred method used to export mySQL to Excel within the context of PHP?  I have looked on Google and found a wide variety of options.  Ron Ron Piggott If the mysql server is set to allow remote access,

Re: [PHP-DB] Exporting mySQL to Excel

2011-11-09 Thread Ron Piggott
To: Ron Piggott Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Exporting mySQL to Excel The best option I've found is to write to a file that is then sent to the browser for download. Are there others? Yes but that's the one I've had the best experience with. It seems to work reliably regardless

Re: [PHP-DB] Exporting mySQL to Excel

2011-11-09 Thread Jim Giner
The problem you are describing is where the fields are not enclosed in quotes. Are you specifying to enclose alpha type fields in quotes, and leaving number-only fields without? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] Exporting mySQL to Excel

2011-11-09 Thread Matijn Woudt
On Thu, Nov 10, 2011 at 12:32 AM, Ron Piggott ron.pigg...@actsministries.org wrote: I am wondering how phpmyadmin makes Excel files on the fly --- Is it a class? They used PHPExcel in the past, but they had to remove because of license issues. Don't know what they're currently using, but if

Re: [PHP-DB] Exporting mySQL to Excel

2011-11-09 Thread Richard Quadling
On 9 November 2011 23:52, Matijn Woudt tijn...@gmail.com wrote: On Thu, Nov 10, 2011 at 12:32 AM, Ron Piggott ron.pigg...@actsministries.org wrote: I am wondering how phpmyadmin makes Excel files on the fly --- Is it a class? They used PHPExcel in the past, but they had to remove because

Re: [PHP-DB] Exporting mySQL to Excel

2011-11-08 Thread Bastien Koert
On Tue, Nov 8, 2011 at 1:33 PM, Bastien Koert phps...@gmail.com wrote: On Tue, Nov 8, 2011 at 1:31 PM, Ron Piggott ron.pigg...@actsministries.org wrote: What is the preferred method used to export mySQL to Excel within the context of PHP?  I have looked on Google and found a wide variety of

Re: [PHP-DB] Exporting mySQL to Excel

2011-11-08 Thread Ron Piggott
Trying to setup so within the administration screen the users may download the database. Ron Piggott www.TheVerseOfTheDay.info -Original Message- From: Bastien Koert Sent: Tuesday, November 08, 2011 1:33 PM To: Ron Piggott Cc: php-db@lists.php.net Subject: Re: [PHP-DB

Re: [PHP-DB] Exporting mySQL to Excel

2011-11-08 Thread Jimi Thompson
The best option I've found is to write to a file that is then sent to the browser for download. Are there others? Yes but that's the one I've had the best experience with. It seems to work reliably regardless of browser or version of Office or any thing else. HTH! On Tue, 2011-11-08 at

Re: [PHP-DB] Exporting mySQL to Excel

2011-11-08 Thread Karl DeSaulniers
CSV is probably the least bloated. IMHO. But I guess it depends on what your trying to get as an end result. Best, Karl On Nov 8, 2011, at 3:59 PM, Jimi Thompson wrote: The best option I've found is to write to a file that is then sent to the browser for download. Are there others? Yes but

Re: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-28 Thread tamouse mailing lists
On Thu, Oct 27, 2011 at 10:04 PM, p...@umpquanet.com wrote: Something more fundamental is going on. Here is simpler code which still reproduces the problem. I get: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 20 bytes) in xx3.php on line 26

Re: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-27 Thread tamouse mailing lists
On Thu, Oct 27, 2011 at 6:59 PM, p...@umpquanet.com wrote: Running PHP 5.3.5 on FreeBSD 8.2 connecting to a MySQL 5.1.55 server. Why does this code (below) run out of memory?  It queries test_table for all rows, all fields and sorts them by the numeric 'contract' field.  It then iterates

RE: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-27 Thread Toby Hart Dyke
-Original Message- From: p...@umpquanet.com [mailto:p...@umpquanet.com] Sent: Thursday, October 27, 2011 8:00 PM To: php-db@lists.php.net Subject: [PHP-DB] Simple MySQL sample code runs out of memory Running PHP 5.3.5 on FreeBSD 8.2 connecting to a MySQL 5.1.55 server. snip

Re: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-27 Thread Karl DeSaulniers
That and maybe look into mysql_free_result() or mysql_freeresult() Best, Karl Sent from losPhone On Oct 27, 2011, at 9:08 PM, Toby Hart Dyke t...@hartdyke.com wrote: -Original Message- From: p...@umpquanet.com [mailto:p...@umpquanet.com] Sent: Thursday, October 27, 2011 8:00 PM

Re: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-27 Thread php
On Thu, Oct 27, 2011 at 09:17:21PM -0500, tamouse mailing lists wrote: That said, I think there must be a way to do this in SQL. Absolutely, there's a way to do this in SQL; select contract, sum(1) from test_table group by contract But as I said, simply counting is not the intent of the

Re: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-27 Thread tamouse mailing lists
On Thu, Oct 27, 2011 at 9:36 PM, p...@umpquanet.com wrote: On Thu, Oct 27, 2011 at 09:17:21PM -0500, tamouse mailing lists wrote: That said, I think there must be a way to do this in SQL. Absolutely, there's a way to do this in SQL; select contract, sum(1) from test_table group by contract

Re: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-27 Thread php
On Thu, Oct 27, 2011 at 09:50:14PM -0500, tamouse mailing lists wrote: Still, an inner and outer loop don't really seem necessary here, as you're spinning through one set of data, there doesn't seem a need to run through it that way. A more traditional method is to do something like:

Re: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-27 Thread Karl DeSaulniers
Maybe this.. HTH, ?php ... $result = mysql_query( $qry, $db_conn ) or die( mysql_error() . \n ); $num_rows = mysql_numrows($result); if(!$result || ($num_rows = 0)){ echo Error displaying info; } else if($num_rows 0){ for($i=0; $i$num_rows; $i++){ $c =

Re: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-27 Thread php
On Thu, Oct 27, 2011 at 10:43:48PM -0500, Karl DeSaulniers wrote: Maybe this.. HTH, ?php ... $result = mysql_query( $qry, $db_conn ) or die( mysql_error() . \n ); $num_rows = mysql_numrows($result); if(!$result || ($num_rows = 0)){ echo Error displaying info; } else

Re: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-27 Thread Karl DeSaulniers
Hmmm.. Try this.. for($i=0; $i$num_rows; $i++){ $c = mysql_result($result,$i,contract); echo sprintf( |%13d |%7d |\n, $c, $i ); mysql_free_result($c); //Free the memory with this. } or this.. for($i=0; $i$num_rows; $i++){ $c = mysql_result($result,$i,contract);

Re: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-27 Thread Karl DeSaulniers
Here is a link for researching. http://php.net/manual/en/function.mysql-fetch-assoc.php HTH, Best, Karl On Oct 28, 2011, at 12:35 AM, Karl DeSaulniers wrote: Also, I don't know how your displaying this info, but if you have a good number of entries, you may want to look into pagination.

Re: [PHP-DB] Simple MySQL sample code runs out of memory

2011-10-27 Thread Karl DeSaulniers
Also, I don't know how your displaying this info, but if you have a good number of entries, you may want to look into pagination. Then your only grabbing a certain number of sets at a time not the whole database. Best, Karl On Oct 28, 2011, at 12:29 AM, Karl DeSaulniers wrote: Hmmm.. Try

RE: [PHP-DB] SELECT

2011-10-21 Thread Ford, Mike
-Original Message- From: tamouse mailing lists [mailto:tamouse.li...@gmail.com] Sent: 20 October 2011 21:37 On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote: -Original Message- From: Ron Piggott [mailto:ron.pigg...@actsministries.org] Sent: 17

RE: [PHP-DB] PHP + SQLite - Issues with update

2011-10-21 Thread N . A . Morgan
Try using the query: $db-query(update SERVER set Token = '$intoken' where IPAddress ='192.168.1.100'); You are trying to update all rows with $intoken, where the column Token is unique. Regards, Neil Morgan -Original Message- From: Prashant Prabhudesai [mailto:pprab...@cisco.com]

Re: [PHP-DB] SELECT

2011-10-21 Thread tamouse mailing lists
On Fri, Oct 21, 2011 at 2:09 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote: -Original Message- From: tamouse mailing lists [mailto:tamouse.li...@gmail.com] Sent: 20 October 2011 21:37 On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote: -Original Message-

RE: [PHP-DB] PHP + SQLite - Issues with update

2011-10-21 Thread Prashant Prabhudesai (pprabhud)
Message- From: n.a.mor...@brighton.ac.uk [mailto:n.a.mor...@brighton.ac.uk] Sent: Friday, October 21, 2011 2:33 AM To: Prashant Prabhudesai (pprabhud); php-db@lists.php.net Subject: RE: [PHP-DB] PHP + SQLite - Issues with update Try using the query: $db-query(update SERVER set Token

Re: [PHP-DB] Re: SELECT

2011-10-20 Thread tamouse mailing lists
On Mon, Oct 17, 2011 at 12:58 PM, Jim Giner jim.gi...@albanyhandball.com wrote: I would do it this way: Where  $sel_d = (the day # you want)  $sel_m = (the month # you want) The where clause would be: Where  (start_month = $sel_m and start_day = $sel_d) and     (end_month = $sel_m and

Re: [PHP-DB] SELECT

2011-10-20 Thread tamouse mailing lists
On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote: -Original Message- From: Ron Piggott [mailto:ron.pigg...@actsministries.org] Sent: 17 October 2011 18:38 I need help creating a mySQL query that will select the correct introduction message for a website I am

Re: [PHP-DB] SELECT

2011-10-20 Thread tamouse mailing lists
On Thu, Oct 20, 2011 at 3:36 PM, tamouse mailing lists tamouse.li...@gmail.com wrote: On Tue, Oct 18, 2011 at 5:36 AM, Ford, Mike m.f...@leedsmet.ac.uk wrote: -Original Message- From: Ron Piggott [mailto:ron.pigg...@actsministries.org] Sent: 17 October 2011 18:38 I need help creating

RE: [PHP-DB] SELECT

2011-10-18 Thread Ford, Mike
-Original Message- From: Ron Piggott [mailto:ron.pigg...@actsministries.org] Sent: 17 October 2011 18:38 I need help creating a mySQL query that will select the correct introduction message for a website I am making. The way I have designed the table I can’t wrap my mind around

Re: [PHP-DB] SELECT

2011-10-18 Thread Jim Giner
Ron - Mike here is correct. I gave you a start, but it had a problem with it. Hope I didn't have you running around too much. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP-DB] Re: SELECT

2011-10-17 Thread Toby Hart Dyke
Though the operators are = and =, not = and =. Toby -Original Message- From: Jim Giner [mailto:jim.gi...@albanyhandball.com] Sent: Monday, October 17, 2011 1:58 PM To: php-db@lists.php.net Subject: [PHP-DB] Re: SELECT I would do it this way: Where $sel_d = (the day # you want)

Re: [PHP-DB] SELECT

2011-10-17 Thread Amit Tandon
Dear Ron If only day is required u could add another day condition in the where clause e.g. month(current_date) between and day(current_date) between. i think u require something more than this. So could u pls explain your requirement in a little more detail say what would be the output of the

Re: [PHP-DB] SELECT syntax

2011-10-13 Thread Karl DeSaulniers
Or something like this? SELECT * FROM `Bible_trivia` WHERE answer=`answer`; Then match the results to trivia_answer_1 in php to see if correct. if($trivia_answer_1 == $results) { ... do this } or a switch switch ($results) { case $trivia_answer_1: ... do this

Re: [PHP-DB] SELECT syntax

2011-10-13 Thread Karl DeSaulniers
Heh, Thanks Karthik. Not my post.. :) But your solution looks dead on.. Here you go Ron. Try this one. Best, Karl On Oct 13, 2011, at 2:42 AM, Karthik S wrote: Try this, select CASE answer when 1 then trivia_answer_1 when 2 then trivia_answer_2 when 3 then

Re: [PHP-DB] Odd MySQL Problem...

2011-10-13 Thread Karl DeSaulniers
Its looking for an integer not a string for the number of characters. I think.. Eg : number_pad($n, 4); On Oct 13, 2011, at 9:53 PM, Jason Pruim wrote: number_pad($n, 4); Best, Karl DeSaulniers Design Drumm http://designdrumm.com

RE: [PHP-DB] SELECT syntax

2011-10-12 Thread Toby Hart Dyke
Not terribly elegant, but this should work: SELECT `trivia_answer_1` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=1 UNION SELECT `trivia_answer_2` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=2 UNION SELECT `trivia_answer_3` AS `trivia_answer` FROM `Bible_trivia` WHERE

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Jack van Zanen
Hi In Oracle (and maybe others) you can use select case when answer=1 then trivia_answer_1 when answer=2 then trivia_answer_2 when answer=3 then trivia_answer_3 when answer=4 then trivia_answer_4 else null end answer from bible_trivia_table OR You can select all of them and process in PHP,

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Amit Tandon
select casehttp://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html works in mysql also regds amit The difference between fiction and reality? Fiction has to make sense. On Thu, Oct 13, 2011 at 3:26 AM, Jack van Zanen j...@vanzanen.com wrote: Hi In Oracle (and maybe

Re: [PHP-DB] SELECT syntax

2011-10-12 Thread Amit Tandon
another examplehttp://mysql-tips.blogspot.com/2005/04/mysql-select-case-example.html regds amit The difference between fiction and reality? Fiction has to make sense. On Thu, Oct 13, 2011 at 9:34 AM, Amit Tandon att...@gmail.com wrote: select

Re: [PHP-DB] Working with large datasets

2011-10-11 Thread Jim Giner
Exactly. That was my first guess - that his commandline request is first having to download 8M records which can take a long time. The OP's fear of overhead from apache... is not only unfounded, but would most definitely improve his response by simply running the query on the server and avoid

Re: [PHP-DB] Working with large datasets

2011-10-11 Thread user080701
-- From: Jack van Zanen j...@vanzanen.com Sent: Tuesday, October 11, 2011 12:09 PM To: Jason Pruim li...@pruimphotography.com Cc: Thompson, Jimi ji...@mail.cox.smu.edu; Bastien phps...@gmail.com; php-db@lists.php.net Subject: Re: [PHP-DB

RE: [PHP-DB] Working with large datasets

2011-10-10 Thread Toby Hart Dyke
It sounds as though you don't have an index on the right field. 8 million records should be no problem if you have the right indexes applied, and you're not trying to do anything too complicated. Toby -Original Message- From: Jason Pruim [mailto:li...@pruimphotography.com] Sent:

Re: [PHP-DB] Working with large datasets

2011-10-10 Thread Jim Giner
Toby Hart Dyke t...@hartdyke.com wrote in message news:00da01cc8768$ca9e9200$5fdbb600$@hartdyke.com... It sounds as though you don't have an index on the right field. 8 million records should be no problem if you have the right indexes applied, and you're not trying to do anything too

Re: [PHP-DB] Working with large datasets

2011-10-10 Thread Jason Pruim
Jason Pruim pru...@gmail.com On Oct 10, 2011, at 2:20 PM, Jim Giner wrote: Toby Hart Dyke t...@hartdyke.com wrote in message news:00da01cc8768$ca9e9200$5fdbb600$@hartdyke.com... It sounds as though you don't have an index on the right field. 8 million records should be no problem if

Re: [PHP-DB] Working with large datasets

2011-10-10 Thread Jim Giner
I don't do command line stuff so I may not be right in my thinking. If you are running a php query from a client, does the query get executed on the database server, or does all the data have to come down to you to be queried? -- PHP Database Mailing List (http://www.php.net/) To

Re: [PHP-DB] Working with large datasets

2011-10-10 Thread Jason Pruim
Jason Pruim pru...@gmail.com On Oct 10, 2011, at 2:42 PM, Jim Giner wrote: I don't do command line stuff so I may not be right in my thinking. If you are running a php query from a client, does the query get executed on the database server, or does all the data have to come down to you

Re: [PHP-DB] Working with large datasets

2011-10-10 Thread Jim Giner
When you say machine, do you mean the client that you're sitting at, or the machine that hosts the data? As for doing it thru a web server, the amount of time Apache, et al, would consume is miniscule. The web interface would not be involved in the reading of the data or the processing, just

RE: [PHP-DB] Working with large datasets

2011-10-10 Thread Toby Hart Dyke
with an index, it has to do a full table scan to retrieve the results. Toby -Original Message- From: Jason Pruim [mailto:pru...@gmail.com] Sent: Monday, October 10, 2011 2:37 PM To: Jim Giner Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Working with large datasets RIght now though I only

Re: [PHP-DB] Working with large datasets

2011-10-10 Thread Bastien
On 2011-10-10, at 11:30 AM, Jason Pruim li...@pruimphotography.com wrote: Hey everyone, I am working with a database that has close to 8 million records in it and it will be growing. I have a state field in the data, and I am attempting to test some query's on it, all but 2 records

RE: [PHP-DB] Working with large datasets

2011-10-10 Thread Thompson, Jimi
: [PHP-DB] Working with large datasets On 2011-10-10, at 11:30 AM, Jason Pruim li...@pruimphotography.com wrote: Hey everyone, I am working with a database that has close to 8 million records in it and it will be growing. I have a state field in the data, and I am attempting to test some

Re: [PHP-DB] Working with large datasets

2011-10-10 Thread Karl DeSaulniers
PM To: Jason Pruim Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Working with large datasets On 2011-10-10, at 11:30 AM, Jason Pruim li...@pruimphotography.com wrote: Hey everyone, I am working with a database that has close to 8 million records in it and it will be growing. I have

Re: [PHP-DB] Working with large datasets

2011-10-10 Thread Jason Pruim
Jason Pruim li...@pruimphotography.com On Oct 10, 2011, at 5:27 PM, Thompson, Jimi wrote: I really think that you should try running it from the command line and see what the issues are. Get both Apache and php out of the way. I've seen some PHP scripts use up all the file handles (OS

Re: [PHP-DB] Working with large datasets

2011-10-10 Thread Jack van Zanen
Hi You need to index the right fields. even on a laptop a select from 8 million rows with two rows returned should take a few seconds max only. The first time you run the query the data has to come from disk, second time you run same query you'd expect that data to sit in cache and be very

Re: [PHP-DB] Prepared Statements With Multiple Databases

2011-09-30 Thread Bastien
On 2011-09-30, at 8:26 PM, Ron Piggott ron.pigg...@actsministries.org wrote: I need my Prepared Statement database connection to be able to connect with two different databases (which use the same username / password). They are assigned variables $database1 and $database2 What I

<    3   4   5   6   7   8   9   10   11   12   >