Re: [PHP-DB] combining the results of mysql query and finding the unique tuples in php

2011-01-07 Thread Toby Hart Dyke

On 1/7/2011 12:10 AM, Fahim M wrote:

Hi
I have a certain number of mysql tables(relation), say 50, some of them
having 5 fields and some with 6 fields. a particular search item may be
found in multiple tables with multiple rows. I am using a loop to find all
those.
My problem is I want to first combine all those results and then find all
the unique entries. (the query results may overlap).


What is the best way to do it?

If you're looking for unique results, do  a UNION query for all the 
tables. You'll need to add a dummy field for the 5-field tables, and 
make sure the field names are the same (use oldfieldname AS 
newfieldname to make sure everything ends up the correct result 
column). UNION queries automatically remove duplicates.


  Toby

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



Re: [PHP-DB] combining the results of mysql query and finding the unique tuples in php

2011-01-07 Thread Bastien Koert
On Fri, Jan 7, 2011 at 9:46 AM, Toby Hart Dyke t...@hartdyke.com wrote:
 On 1/7/2011 12:10 AM, Fahim M wrote:

 Hi
 I have a certain number of mysql tables(relation), say 50, some of them
 having 5 fields and some with 6 fields. a particular search item may be
 found in multiple tables with multiple rows. I am using a loop to find all
 those.
 My problem is I want to first combine all those results and then find all
 the unique entries. (the query results may overlap).


 What is the best way to do it?

 If you're looking for unique results, do  a UNION query for all the tables.
 You'll need to add a dummy field for the 5-field tables, and make sure the
 field names are the same (use oldfieldname AS newfieldname to make sure
 everything ends up the correct result column). UNION queries automatically
 remove duplicates.

  Toby

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



Though from the sounds of it, there is a problem with the table design
if you have multiple results in multiple tables

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP-DB] Connecting PHP to MySQL on Windows

2011-01-07 Thread Gavin Chalkley
Mike,

A plain HOST file should have the commented part at the top, and only 1
reference to localhost unless you are creating Virtual hosts.

I would suggest removing the ::1 line

BR

Gavin

On Fri, Jan 7, 2011 at 4:18 AM, michael manning
michaelgmann...@gmail.comwrote:

 Hi,

 I swapped out 'localhost for '127.0.0.1' in the url but this had no
 effect.

 I had a look at my hosts file at c:\windows\system32\drivers\etc and this
 contained:

 # Copyright (c) 1993-2006 Microsoft Corp.
 #
 # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
 #
 # This file contains the mappings of IP addresses to host names. Each
 # entry should be kept on an individual line. The IP address should
 # be placed in the first column followed by the corresponding host name.
 # The IP address and the host name should be separated by at least one
 # space.
 #
 # Additionally, comments (such as these) may be inserted on individual
 # lines or following the machine name denoted by a '#' symbol.
 #
 # For example:
 #
 #  102.54.94.97 rhino.acme.com  # source server
 #   38.25.63.10 x.acme.com  # x client host

 127.0.0.1   localhost
 ::1 localhost

 and so this seems fine as well.

 cheers

 Mike

 On Fri, Jan 7, 2011 at 1:25 PM, Daniel Brown danbr...@php.net wrote:

  On Thu, Jan 6, 2011 at 21:12, michael manning michaelgmann...@gmail.com
 
  wrote:
   Hi Daniel,
   When testing with the CLI, netstat shows:
  [snip!]
 
 What happens when you swap out 'localhost' for '127.0.0.1' in the
  connection routine?  If that works, check to make sure your hosts file
  properly designates 127.0.0.1 as 'localhost' (by editing
  c:\windows\system32\drivers\etc\hosts I believe been a while since
  I've done it on Windows).
 
  --
  /Daniel P. Brown
  Network Infrastructure Manager
  Documentation, Webmaster Teams
  http://www.php.net/
 




-- 
Best regards,

Gavin C


Re: [PHP-DB] Connecting PHP to MySQL on Windows

2011-01-07 Thread Daniel Brown
On Fri, Jan 7, 2011 at 15:06, Gavin Chalkley gavin.chalk...@gmail.com wrote:
 Mike,

 A plain HOST file should have the commented part at the top, and only 1
 reference to localhost unless you are creating Virtual hosts.

 I would suggest removing the ::1 line

As long as he never plans to use IPv6 on there, that would be fine.

-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

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



[PHP-DB] Can't find sqlite_open

2011-01-07 Thread Brian A. Davis

Hello,
I have a script that is calling sqlite_open, however, sqlite_open can't be 
found on my systems. I'm running RHEL5 and I get the following relevant 
output from php -i:


PDO support = enabled
PDO drivers = odbc, sqlite

pdo_sqlite

PDO Driver for SQLite 3.x = enabled
PECL Module version = 1.0.1 $Id: pdo_sqlite.c,v 1.10.2.6 2006/01/01 
12:50:12 sniper Exp $

SQLite Library = 3.3.6

From searching around, it seems like there is a PDO version, which looks to 
be enabled here, and a older version, which would provide sqlite_open. Is 
that correct?


Thanks! 



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