php-general Digest 19 Jul 2010 07:45:52 -0000 Issue 6853

2010-07-19 Thread php-general-digest-help

php-general Digest 19 Jul 2010 07:45:52 - Issue 6853

Topics (messages 306972 through 306983):

Re: Getting only attribute and not its values when doing LDAP calls to 2003 AD 
server
306972 by: Nathan Nobbe

handing over data between two PHP connections
306973 by: tobias.mueller13.web.de
306974 by: Ashley Sheridan
306975 by: Floyd Resler

functions and global variables
306976 by: David Mehler
306977 by: Paul M Foster

MySQL Query Puzzle
306978 by: Peter
306980 by: Paul M Foster
306981 by: Shafiq Rehman

help using phpadmin
306979 by: Isaac Lee
306982 by: Carlos Sura

How to set socket_read time out
306983 by: Gary .

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---
On Sun, Jul 18, 2010 at 1:01 PM, Unix Nair tarik...@gmail.com wrote:

 Hi
 I followed the examples mentioned in ldap functions pages at
 www.php.net
 http://www.google.com/url?sa=Dq=www.php.netusg=AFQjCNHoc0Ba_1Imkk_33DysfxCk38dNag
 .

 But I am getting only the attribute names and not the values stored in
 attributes array. Can some one give me some tips to fix my issue.
 Here is my configuration.


give the adLdap class a shot; if it works you can reverse engineer how they
accomplished it.

http://adldap.sourceforge.net/

-nathan
---End Message---
---BeginMessage---
Hello everybody

For a science project I am working on a mechanism that hands over data from a 
smartphone to a web-browser (=Internet PC). Both connect to a PHP server. The 
PHP server has to receive the data (=some kind of an URL) on the smartphone end 
and deliver it to the browser end. 

Up to now there have been two (working) implementations. One using the 
filesystem the other one using a MySQL Database. The data coming up from the 
smartphone is stored in a file/table and some seconds later sent down to the 
browser. 


My question: is it possible to implement this mechanisms just with PHP methods? 
I can't think of such a method but need to be sure. 


Tank you in advance. 

Have a good evening,
Tobias
___
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
---End Message---
---BeginMessage---
On Sun, 2010-07-18 at 21:27 +0200, tobias.muelle...@web.de wrote:

 Hello everybody
 
 For a science project I am working on a mechanism that hands over data from a 
 smartphone to a web-browser (=Internet PC). Both connect to a PHP server. The 
 PHP server has to receive the data (=some kind of an URL) on the smartphone 
 end and deliver it to the browser end. 
 
 Up to now there have been two (working) implementations. One using the 
 filesystem the other one using a MySQL Database. The data coming up from the 
 smartphone is stored in a file/table and some seconds later sent down to the 
 browser. 
 
 
 My question: is it possible to implement this mechanisms just with PHP 
 methods? I can't think of such a method but need to be sure. 
 
 
 Tank you in advance. 
 
 Have a good evening,
 Tobias
 ___
 Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
 Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
 


I suppose you could do it with some sort of socket connection, but it
would surely be more work than is worth the trouble. I've not worked
with sockets before, so don't know how you'd go about it. If I were to
do this, I'd just have all communications from the phone stored on the
server somehow (database, file, etc) and then the browser can use some
refresh mechanism (http refresh or ajax update) to query for new
messages. Messages can be tagged as read once they've been sent to the
browser as well. In this way, you can retain a history of communications
and only show the browser new information sent from the phone.

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


---End Message---
---BeginMessage---


On Jul 18, 2010, at 3:27 PM, tobias.muelle...@web.de wrote:


Hello everybody

For a science project I am working on a mechanism that hands over  
data from a smartphone to a web-browser (=Internet PC). Both connect  
to a PHP server. The PHP server has to receive the data (=some kind  
of an URL) on the smartphone end and deliver it to the browser end.


Up to now there have been two (working) implementations. One using  
the filesystem the other one using a MySQL Database. The data coming  
up from the smartphone is stored in a file/table and some seconds  
later sent down to the browser.



My question: is it possible to implement this mechanisms just with  
PHP 

[PHP] How to set socket_read time out

2010-07-19 Thread Gary .
How can I get calls to scoket_read to timeout if the server stops
responding? It's not clear exactly what's happening, but occasionally
the server simply stops sending data and my php code (client) then sits
there waiting endlessly. I know about set_time_limit but I don't want to
abandon the entire script, just the reading of data from the server (I
can at least give a meaningful error message then, for example).

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



Re: [PHP] functions and global variables

2010-07-19 Thread Shreyas Agasthya
My two cents on this one.

Modify the $name within the function and print it.

Modify the$name outside the function (means the non-global-declared $name)
and print it. You will know the difference.

--Shreyas

On Mon, Jul 19, 2010 at 7:41 AM, Paul M Foster pa...@quillandmouse.comwrote:

 On Sun, Jul 18, 2010 at 06:37:30PM -0400, David Mehler wrote:

  Hello,
  I've got a file with a variable declared in it. For purposes of this
 post:
 
  $name = $_POST['name'];
 
  Now a little later in the same file I have a custom function call that
  outputs some information. In that information is an echo statement
  outputting $name:
 
  echo $name;
 
  I'm wondering do I have to have $name declared as a global variable
  within that function? For example:
 
  function customFunction() {
  global $name
  }
 
  I've tried it both ways and both ways it works, with and without the
  global statement. I was under the impression that to be useful in a
  function variables outside were not accessible.
  Thanks.
  Dave.

 Variables declared outside a function are visible outside the function.
 Variables declared inside a function are visible only within that
 function. To use a global variable inside a function, you must declare
 it global, as:

 global $globalvar;

 Paul

 --
 Paul M. Foster

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




-- 
Regards,
Shreyas Agasthya


[PHP] Re: How to set socket_read time out

2010-07-19 Thread Gary .
On Mon, Jul 19, 2010 at 9:45 AM, Gary wrote:
 How can I get calls to scoket_read to timeout if the server stops
 responding?

Sorry. Found it:
socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, array('sec' = 1,
'usec' = 0));

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



Re: [PHP] functions and global variables

2010-07-19 Thread Simcha Younger




On Mon, 19 Jul 2010 13:37:12 +0530
Shreyas Agasthya shreya...@gmail.com wrote:

 My two cents on this one.
 
 Modify the $name within the function and print it.
 
 Modify the$name outside the function (means the non-global-declared $name)
 and print it. You will know the difference.
 
 --Shreyas
 
 On Mon, Jul 19, 2010 at 7:41 AM, Paul M Foster pa...@quillandmouse.comwrote:
 
  On Sun, Jul 18, 2010 at 06:37:30PM -0400, David Mehler wrote:
 
   Hello,
   I've got a file with a variable declared in it. For purposes of this
  post:
  
   $name = $_POST['name'];

  
   I'm wondering do I have to have $name declared as a global variable
   within that function? For example:
  
   function customFunction() {
   global $name
   }
  
   I've tried it both ways and both ways it works, with and without the
   global statement. I was under the impression that to be useful in a
   function variables outside were not accessible.
   Thanks.
   Dave.



It sounds like 'register globals' is turned on in your php.ini, and therefore 
$name will be visible everywhere, since it is taken from $_POST['name'].

-- 
Simcha Younger sim...@syounger.com

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



[PHP] function exists in command line but not in browser

2010-07-19 Thread Shelley
Hi all,

The problem is imagettfbbox().
jpgraph uses it to create truetype font images.

I have a phpinfo() script.

The command line output:

php i.php | grep Free
FreeType Support = enabled
FreeType Linkage = with freetype
FreeType Version = 2.2.1

But when the script is loaded in the browser, the output has no such
FreeType Support!
So imagettfbbox() does not exist.

Somebody could offer some suggestions??

Thank you veery much.

-- 
With best regards,
Shelley Shyan
http://phparch.cn


Re: [PHP] function exists in command line but not in browser

2010-07-19 Thread Nilesh Govindarajan
On Mon, Jul 19, 2010 at 2:22 PM, Shelley myphpl...@gmail.com wrote:
 Hi all,

 The problem is imagettfbbox().
 jpgraph uses it to create truetype font images.

 I have a phpinfo() script.

 The command line output:

 php i.php | grep Free
 FreeType Support = enabled
 FreeType Linkage = with freetype
 FreeType Version = 2.2.1

 But when the script is loaded in the browser, the output has no such
 FreeType Support!
 So imagettfbbox() does not exist.

 Somebody could offer some suggestions??

 Thank you veery much.

 --
 With best regards,
 Shelley Shyan
 http://phparch.cn


Your set up is using two different INI files for command line and web.
In the phpinfo(), see Parsed Configuration File (something similar),
its at the top of the page, some four-five lines down.

-- 
Regards,
Nilesh Govindarajan
Facebook: http://www.facebook.com/nilesh.gr
Twitter: http://twitter.com/nileshgr
Website: http://www.itech7.com

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



[PHP] enabling domdocument

2010-07-19 Thread Ashley Sheridan
Hi all,

I'm having a bit of a problem here with getting DomDocument on PHP. I've
got a Fedora 11 system and have used the package manager to install PHP
and its various modules, at no point have I compiled PHP myself (which
has never worked when I've tried it, ever, but that's another issue)

I've made sure the xml module was installed through packagekit, but i
find no listing for any php-dom type module. I checked the line that PHP
was configured and built with as shown in a phpinfo() call, and
--disable-dom is showing, however, I believe that's actually a red
herring, as a virtual machine running CentOS also has -disable-dom
showing as a config option, and yet DOM is also clearly listed as
working further down the phpinfo() page.

Is there some sort of issue with Fedora and DOM, as I read online that
it wasn't included in the default repos. What can I do to enable
domdocument that doesn't involve compiling PHP manually (like I said,
every time I try it there's a failure because of some missing symbols or
other, but this could again be a Fedora issue)

Is there maybe an RPM somewhere that anyone knows about and has used
before, or is it simply that I need to copy or make a symlink to a .so
library?

Full specs are as follows:
Fedora 11
Apache 2.2.15
PHP 5.2.13


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




Re: [PHP] enabling domdocument

2010-07-19 Thread Ashley Sheridan
On Mon, 2010-07-19 at 12:09 +0100, Ashley Sheridan wrote:

 Hi all,
 
 I'm having a bit of a problem here with getting DomDocument on PHP. I've
 got a Fedora 11 system and have used the package manager to install PHP
 and its various modules, at no point have I compiled PHP myself (which
 has never worked when I've tried it, ever, but that's another issue)
 
 I've made sure the xml module was installed through packagekit, but i
 find no listing for any php-dom type module. I checked the line that PHP
 was configured and built with as shown in a phpinfo() call, and
 --disable-dom is showing, however, I believe that's actually a red
 herring, as a virtual machine running CentOS also has -disable-dom
 showing as a config option, and yet DOM is also clearly listed as
 working further down the phpinfo() page.
 
 Is there some sort of issue with Fedora and DOM, as I read online that
 it wasn't included in the default repos. What can I do to enable
 domdocument that doesn't involve compiling PHP manually (like I said,
 every time I try it there's a failure because of some missing symbols or
 other, but this could again be a Fedora issue)
 
 Is there maybe an RPM somewhere that anyone knows about and has used
 before, or is it simply that I need to copy or make a symlink to a .so
 library?
 
 Full specs are as follows:
 Fedora 11
 Apache 2.2.15
 PHP 5.2.13
 
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 


OK, I seem to have answered my own question!

It seems that even though PHP had the XML module enabled, I still needed
to run 'yum update php-xml' in order for it to load in the DOM module.
It's now working fine, and for those of you interested, the ./configure
line in phpinfo() still says --disable-dom!

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




Re: [PHP] handing over data between two PHP connections

2010-07-19 Thread Tobias Mueller
Am Sunday 18 July 2010 23:10:58 schrieb Floyd Resler:
 On Jul 18, 2010, at 3:27 PM, tobias.muelle...@web.de wrote:
  Hello everybody
 
  For a science project I am working on a mechanism that hands over
  data from a smartphone to a web-browser (=Internet PC). Both connect
  to a PHP server. The PHP server has to receive the data (=some kind
  of an URL) on the smartphone end and deliver it to the browser end.
 
  Up to now there have been two (working) implementations. One using
  the filesystem the other one using a MySQL Database. The data coming
  up from the smartphone is stored in a file/table and some seconds
  later sent down to the browser.
 
 
  My question: is it possible to implement this mechanisms just with
  PHP methods? I can't think of such a method but need to be sure.
 
 
  Tank you in advance.
 
  Have a good evening,
  Tobias
  ___
  Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
  Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

 What I would do is have the smartphone send some unique identifier
 along with its data.  For the browser I would have the page refresh at
 certain time interval, calling a PHP script to see if any data is
 available for the smartphone's ID.  If you did want the page to keep
 reloading, you could use AJAX.

 Take care,
 Floyd



Thanks and hello again

In the current implementation the browser connects to the server using Ajax 
(XmlHttpRequest=XHR). Personally I prefer sockets too, but sockets don't work 
with XHR. This will be an option when Websockets or something of that kind 
becomes widely available. But this part is not what I wish to talk about 
today (sorry). 

Today I want to find out how to design the internal data handling. Within the 
PHP server. Please just think there is already some mechanism that does the 
data transfer between smartphone, server and browser. The browser polls the 
server (by XHR) to ask for data. The smartphone will do an (asynchronous GET) 
request to deliver a data packet to the server. 

On server side there is one PHP instance that receives the data of the 
smartphone. And there is another instance that may send the data down to the 
browser as soon as the data becomes available. It has session variables, a 
database connection and all of that typical stuff. 

The (working) method looks like this: the received data packet gets written 
into the database (by the smartphone PHP instance). And some seconds later 
the data is read again (by the browser PHP instance). 

My question is: can this be done without a database? Can one PHP instance 
(thread, process, ...) hand over data to another PHP instance? 


(Actually there is an Apache Server that executes PHP scripts. Typical LAMP 
configuration.)


Greetings
Tobias



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



Re: [PHP] MySQL Query Puzzle

2010-07-19 Thread shiplu
Use distinct.

SELECT DISTINCT COLUMN1, COLUMN2 FROM ... ...


Shiplu Mokadd.im
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

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



Re: [PHP] handing over data between two PHP connections

2010-07-19 Thread Ashley Sheridan
On Mon, 2010-07-19 at 13:21 +0200, Tobias Mueller wrote:

 Am Sunday 18 July 2010 23:10:58 schrieb Floyd Resler:
  On Jul 18, 2010, at 3:27 PM, tobias.muelle...@web.de wrote:
   Hello everybody
  
   For a science project I am working on a mechanism that hands over
   data from a smartphone to a web-browser (=Internet PC). Both connect
   to a PHP server. The PHP server has to receive the data (=some kind
   of an URL) on the smartphone end and deliver it to the browser end.
  
   Up to now there have been two (working) implementations. One using
   the filesystem the other one using a MySQL Database. The data coming
   up from the smartphone is stored in a file/table and some seconds
   later sent down to the browser.
  
  
   My question: is it possible to implement this mechanisms just with
   PHP methods? I can't think of such a method but need to be sure.
  
  
   Tank you in advance.
  
   Have a good evening,
   Tobias
   ___
   Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!
   Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
  What I would do is have the smartphone send some unique identifier
  along with its data.  For the browser I would have the page refresh at
  certain time interval, calling a PHP script to see if any data is
  available for the smartphone's ID.  If you did want the page to keep
  reloading, you could use AJAX.
 
  Take care,
  Floyd
 
 
 
 Thanks and hello again
 
 In the current implementation the browser connects to the server using Ajax 
 (XmlHttpRequest=XHR). Personally I prefer sockets too, but sockets don't work 
 with XHR. This will be an option when Websockets or something of that kind 
 becomes widely available. But this part is not what I wish to talk about 
 today (sorry). 
 
 Today I want to find out how to design the internal data handling. Within the 
 PHP server. Please just think there is already some mechanism that does the 
 data transfer between smartphone, server and browser. The browser polls the 
 server (by XHR) to ask for data. The smartphone will do an (asynchronous GET) 
 request to deliver a data packet to the server. 
 
 On server side there is one PHP instance that receives the data of the 
 smartphone. And there is another instance that may send the data down to the 
 browser as soon as the data becomes available. It has session variables, a 
 database connection and all of that typical stuff. 
 
 The (working) method looks like this: the received data packet gets written 
 into the database (by the smartphone PHP instance). And some seconds later 
 the data is read again (by the browser PHP instance). 
 
 My question is: can this be done without a database? Can one PHP instance 
 (thread, process, ...) hand over data to another PHP instance? 
 
 
 (Actually there is an Apache Server that executes PHP scripts. Typical LAMP 
 configuration.)
 
 
 Greetings
 Tobias
 
 
 


The short answer is not really. You see, with PHP, the script stops
executing once it's finished sending a response back the the user agent,
be this a browser, smart phone, or other. Also, one instance of PHP is
pretty much unaware of any other instance, which is partly for security,
partly for flexibility and partly just because that's the way it is :p

Having said that, you could run a PHP script as a daemon perhaps, and
listen for the browser and the smart phone with the same script. The
beauty of a daemon is that it's always running, rather than a PHP script
which runs under Apache. However, to run as a Daemon, I believe you will
have to use sockets for transferring data. Doing it this way would allow
you to hold information in memory without having to write it out to the
DB or a file though.

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




Re: [PHP] Convert excel time to date time

2010-07-19 Thread Richard Quadling
On 17 July 2010 12:47, Mohd Shakir bin Zakaria mohdsha...@gmail.com wrote:
 Hi,

 I've been trying to convert this excel date to the date time format,
 but only managed to get it up to the seconds;

 The following code;

 #
 $data=39604.62164;
 date(Y-m-d,mktime(0,0,0,1,$data-1,1900));
 #

 will give this output
 2008-06-05

 changing it to

 
 date(H-i-s,mktime(0,0,0,1,$data-1,1900));
 

 will only give
 00-00-00

 The output I'm looking for is like this one;
 2008-06-05 14:55:09

 Any idea?


?php
function xls2tstamp($date) {
  return ((($date  25568) ? $date : 25569) * 86400) - ((70 * 365 +
19) * 86400);
}

echo date('r', xls2tstamp(39604.62164));
?

outputs ...

Thu, 05 Jun 2008 15:55:09 +0100

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



Re: [PHP] function exists in command line but not in browser

2010-07-19 Thread Richard Quadling
On 19 July 2010 10:04, Nilesh Govindarajan li...@itech7.com wrote:
 On Mon, Jul 19, 2010 at 2:22 PM, Shelley myphpl...@gmail.com wrote:
 Hi all,

 The problem is imagettfbbox().
 jpgraph uses it to create truetype font images.

 I have a phpinfo() script.

 The command line output:

 php i.php | grep Free
 FreeType Support = enabled
 FreeType Linkage = with freetype
 FreeType Version = 2.2.1

 But when the script is loaded in the browser, the output has no such
 FreeType Support!
 So imagettfbbox() does not exist.

 Somebody could offer some suggestions??

 Thank you veery much.

 --
 With best regards,
 Shelley Shyan
 http://phparch.cn


 Your set up is using two different INI files for command line and web.
 In the phpinfo(), see Parsed Configuration File (something similar),
 its at the top of the page, some four-five lines down.


http://docs.php.net/manual/en/configuration.file.php

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



Re: [PHP] MySQL Query Puzzle

2010-07-19 Thread Peter

Hi Shiplu,

Thanks for reply.

Distinct function hide the duplicate records while we selecting the 
record through the Query


i want to remove the duplicate entries in my table

i need a  Delete Query instead of Select Query





shiplu wrote:

Use distinct.

SELECT DISTINCT COLUMN1, COLUMN2 FROM ... ...


Shiplu Mokadd.im
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

  


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



[PHP] Re: handing over data between two PHP connections

2010-07-19 Thread Ian
On 19/07/2010 12:21, Tobias Mueller wrote:
snip

 My question is: can this be done without a database? Can one PHP instance 
 (thread, process, ...) hand over data to another PHP instance? 
 
 
 (Actually there is an Apache Server that executes PHP scripts. Typical LAMP 
 configuration.)

Hi,

You will have to store the data somewhere that both php processes can
read.  You are currently using a database but you could also use:

The File System
Shared Memory Functions [http://php.net/manual/en/ref.shmop.php]
Memcache [http://php.net/manual/en/book.memcache.php]

I'm sure there are other ways as well but it depends on how portable you
want the system to be.

Regards

Ian
-- 




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



Re: [PHP] MySQL Query Puzzle

2010-07-19 Thread Richard Quadling
On 19 July 2010 05:44, Peter pet...@egrabber.com wrote:
 Hi All,

 I have a  table which contain's some duplicate rows. I just want to delete
 the duplicate records alone
 not original records.

 Assume my table as look as below

 column1 column2
 1
        a
 1
        a
 2
        b
 3
        c
 3
        c



 i want the above table need  to be as below, After executing the mysql
 query.

 column1
        column2
 1
        a
 2
        b
 3
        c




 Thanks in advance..

 Regards
 Peter


If your table had a db generated sequential unique identifier (an
identity / autoinc), then something along these lines may be what you
are looking for ...

-- Delete everything except the UniqueIDs we want to keep.
DELETE FROM
Table
WHERE
UniqueID NOT IN
(
-- Just get the UniqueIDs we want to keep.
SELECT
UniqueID
FROM
(
-- Get the earlist UniqueID for each Col1, Col2, 
pairing.
SELECT
Col1,
Col2,
MIN(UniqueID) AS UniqueID
FROM
Table
GROUP BY
Col1,
Col2
)
)

UNTESTED

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



Re: [PHP] MySQL Query Puzzle

2010-07-19 Thread Richard Quadling
On 19 July 2010 15:01, Richard Quadling rquadl...@gmail.com wrote:
 On 19 July 2010 05:44, Peter pet...@egrabber.com wrote:
 Hi All,

 I have a  table which contain's some duplicate rows. I just want to delete
 the duplicate records alone
 not original records.

 Assume my table as look as below

 column1 column2
 1
        a
 1
        a
 2
        b
 3
        c
 3
        c



 i want the above table need  to be as below, After executing the mysql
 query.

 column1
        column2
 1
        a
 2
        b
 3
        c




 Thanks in advance..

Slightly more concise ...

-- Delete everything except the UniqueIDs we want to keep.
DELETE FROM
Table
WHERE
UniqueID NOT IN
(
-- Get the earliest UniqueIDs for each Col1, Col2 pairing.
SELECT
MIN(UniqueID)
FROM
Table
GROUP BY
Col1,
Col2
)

http://www.devx.com/tips/Tip/14665




DELETE
Table
FROM
Table T1,
Table T2
WHERE
T1.Col1 = T2.Col1
AND
T1.Col2 = T2.Col2
AND
T1.UniqueID  T2.UniqueID

http://www.cryer.co.uk/brian/sql/sql_delete_duplicates.htm



etc.

Many different ways.

http://www.orafaq.com/faq/how_does_one_eliminate_duplicates_rows_from_a_table
Method 3 should be the fastest.

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



[PHP] access violation

2010-07-19 Thread SteveW
I have various database / php apps running on a hosted windows machine.

All apps run ok.

We have installed a windows 2003 server machine and the apps run fine. 
However if 2 users hit the Search button at the same time we get a PHP 
access violation and I have to restart IIS.

This is not happening on the hosted service.


Where do I start to trace this error please?


Cheers


SteveW 



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



Re: [PHP] MySQL Query Puzzle

2010-07-19 Thread Shreyas Agasthya
How about this :

CREATE TEMPORARY TABLE bad_temp1 (id INT,name VARCHAR(20));
INSERT INTO bad_temp1 (id,name) SELECT DISTINCT id,name FROM SAMPLE;

Regards,
Shreyas

On Mon, Jul 19, 2010 at 7:31 PM, Richard Quadling rquadl...@gmail.comwrote:

 On 19 July 2010 05:44, Peter pet...@egrabber.com wrote:
  Hi All,
 
  I have a  table which contain's some duplicate rows. I just want to
 delete
  the duplicate records alone
  not original records.
 
  Assume my table as look as below
 
  column1 column2
  1
 a
  1
 a
  2
 b
  3
 c
  3
 c
 
 
 
  i want the above table need  to be as below, After executing the mysql
  query.
 
  column1
 column2
  1
 a
  2
 b
  3
 c
 
 
 
 
  Thanks in advance..
 
  Regards
  Peter
 

 If your table had a db generated sequential unique identifier (an
 identity / autoinc), then something along these lines may be what you
 are looking for ...

 -- Delete everything except the UniqueIDs we want to keep.
 DELETE FROM
Table
 WHERE
UniqueID NOT IN
(
-- Just get the UniqueIDs we want to keep.
SELECT
UniqueID
FROM
(
-- Get the earlist UniqueID for each Col1, Col2,
 pairing.
SELECT
Col1,
Col2,
MIN(UniqueID) AS UniqueID
FROM
Table
GROUP BY
Col1,
Col2
)
)

 UNTESTED

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




-- 
Regards,
Shreyas Agasthya


Re: [PHP] enabling domdocument

2010-07-19 Thread Michael Shadle
Makes sense. Core would be more stripped down if it has modules available as 
separate packages.

On Jul 19, 2010, at 4:19 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote:

 On Mon, 2010-07-19 at 12:09 +0100, Ashley Sheridan wrote:
 
 Hi all,
 
 I'm having a bit of a problem here with getting DomDocument on PHP. I've
 got a Fedora 11 system and have used the package manager to install PHP
 and its various modules, at no point have I compiled PHP myself (which
 has never worked when I've tried it, ever, but that's another issue)
 
 I've made sure the xml module was installed through packagekit, but i
 find no listing for any php-dom type module. I checked the line that PHP
 was configured and built with as shown in a phpinfo() call, and
 --disable-dom is showing, however, I believe that's actually a red
 herring, as a virtual machine running CentOS also has -disable-dom
 showing as a config option, and yet DOM is also clearly listed as
 working further down the phpinfo() page.
 
 Is there some sort of issue with Fedora and DOM, as I read online that
 it wasn't included in the default repos. What can I do to enable
 domdocument that doesn't involve compiling PHP manually (like I said,
 every time I try it there's a failure because of some missing symbols or
 other, but this could again be a Fedora issue)
 
 Is there maybe an RPM somewhere that anyone knows about and has used
 before, or is it simply that I need to copy or make a symlink to a .so
 library?
 
 Full specs are as follows:
 Fedora 11
 Apache 2.2.15
 PHP 5.2.13
 
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 
 
 
 OK, I seem to have answered my own question!
 
 It seems that even though PHP had the XML module enabled, I still needed
 to run 'yum update php-xml' in order for it to load in the DOM module.
 It's now working fine, and for those of you interested, the ./configure
 line in phpinfo() still says --disable-dom!
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 

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



Re: [PHP] access violation

2010-07-19 Thread Andrew Ballard
On Mon, Jul 19, 2010 at 9:54 AM, SteveW stevewa...@btinternet.com wrote:
 I have various database / php apps running on a hosted windows machine.

 All apps run ok.

 We have installed a windows 2003 server machine and the apps run fine.
 However if 2 users hit the Search button at the same time we get a PHP
 access violation and I have to restart IIS.

 This is not happening on the hosted service.


 Where do I start to trace this error please?


 Cheers


 SteveW


We had frequent access violations using Windows/IIS/SQL Server, but
there was no observable pattern and we never were able to trace it to
a specific cause. It did seem to be related to traffic/load, but it
wasn't as specific as simply having two simultaneous requests. Often
the error messages would begin to appear intermittently, but
eventually the server would freeze to the point that any request
parsed by PHP would throw an access violation.

We changed things around based on advice we found on the web and have
found the following to be pretty stable:

PHP: fast-cgi instead of the ISAPI (even though the manual was still
recommending ISAPI)
Database library: Microsoft SQL Server driver for PHP
Cache: WinCache

Since we settled on these items, things have been pretty stable.

Andrew

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



[PHP] Dynamic menu

2010-07-19 Thread jordan

Hello All,

I am new in this group and first whant to say hello to all.
Need me menu who have different link if user is login or logout, 
something like dynamic menu. Somebody can tall me how can i use and 
create this menu.


Thansk

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



Re: [PHP] Dynamic menu

2010-07-19 Thread Dan Joseph
On Sat, Jul 17, 2010 at 5:17 PM, jordan jovanovj...@gmail.com wrote:

 I am new in this group and first whant to say hello to all.
 Need me menu who have different link if user is login or logout, something
 like dynamic menu. Somebody can tall me how can i use and create this 
 menu.http://www.php.net/unsub.php


Well, your basic logic is:

if ( they have a session )
{
   //output the menu
}
else
{
  //output the other menu
}

-- 
-Dan Joseph

http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.
Promo Code NEWTHINGS for 10% off initial order -- Reseller Plans also
available!

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry


Re: [PHP] Recent Influx of Unrelated Discussions

2010-07-19 Thread Shreyas Agasthya
I completely agree with Dan's voice. I hear the tone.  I am sure most of us
here would spend a lot of time here to help each other out. Why not spend
time on genuine PHP issues?

Outside the scope of the discussion :

Also, once they implement and get things working, I would like to request
all the members to let us know the code or even the pseudo-code to let us
know how they made it work. We can collect those snippets and also ask
not repeated questions.

Regards,
Shreyas

On Sat, Jul 17, 2010 at 7:43 AM, Jason Pruim li...@pruimphotography.comwrote:


 On Jul 16, 2010, at 10:47 AM, Paul M Foster wrote:

  On Fri, Jul 16, 2010 at 11:59:49AM +0200, Arno Kuhl wrote:

  And Daniel, your own
 gentle prods to keep things on track I think sets some of the
 professional
 tone of the list.


 This is very true. I've administered various lists for almost ten years,
 and I know for a fact that the list administrator plays a tremendous
 role in the tone of a list.



 So... By replying to this thread... Are we helping the problem or making it
 worse by adding to the off topic posts? :P

 Happy Friday yall! :)


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




-- 
Regards,
Shreyas Agasthya


RE: [PHP] Recent Influx of Unrelated Discussions

2010-07-19 Thread Jay Blanchard
[snip]
Also, once they implement and get things working, I would like to
request
all the members to let us know the code or even the pseudo-code to let
us
know how they made it work. We can collect those snippets and also ask
not repeated questions.
[/snip]

You cannot stop the repeated questions, it's just not possible with the
influx of new PHP'ers each and every day. We used to send out an
occasional here is how you do it e-mail list to the group full of sage
advice, but that list became so large that and those that were doing it
(myself included) forgot and quit sending it out. 

Maybe I should start writing again...

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



[PHP] I need me a Good Book for PHP

2010-07-19 Thread Joce Jovanov
Hello,

I work only 6 mouth with PHP, and now star to like more and more. Do you
someone know samo good books (tutorials) for PHP and MySQL.
 Thanks

Best Regard
Jovanov Jordan


Re: [PHP] I need me a Good Book for PHP

2010-07-19 Thread Shreyas Agasthya
Joce,

6 mouth? I assume it's months. :)
You can choose Head First with PHP and MySQL. Very good and I am currently
learning form it; I am no veteran with the language but it's AWESOME.

Also, good to know (for the PHP-veterans) will be :

1. Why are you learning PHP?
2. How do you plan to put your learning to usage?
3. Any specific things that you want to achieve from PHP?

Regards,
Shreyas

On Mon, Jul 19, 2010 at 9:24 PM, Joce Jovanov jovanovj...@gmail.com wrote:

 Hello,

 I work only 6 mouth with PHP, and now star to like more and more. Do you
 someone know samo good books (tutorials) for PHP and MySQL.
  Thanks

 Best Regard
 Jovanov Jordan




-- 
Regards,
Shreyas Agasthya


Re: [PHP] help using phpadmin

2010-07-19 Thread Isaac Lee
thanks carlos,

but where would i enter that command?

and i tried editing the php.ini file but that didn't accomplish anything.

isaac

On Mon, Jul 19, 2010 at 1:29 AM, Carlos Sura carlos_s...@hotmail.com wrote:
 Hello Isaac Lee.

 Are you running on Linux or Windows?

 You might try:
 mysql SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(’yourpassword’);

 Then restart your service -if needed-

 If not... Try to edit config.inc.php file.

 Regards,

 Carlos Sura

 -Original Message-
 From: Isaac Lee [mailto:rhinecant...@gmail.com]
 Sent: domingo, 18 de julio de 2010 10:34 p.m.
 Cc: php-general@lists.php.net
 Subject: [PHP] help using phpadmin

 this is the second time that i have made an account and set the
 password. then when i try to reaccess phpadmin, it shows this message:

 Error

 MySQL said:

 #1045 - Access denied for user 'root'@'localhost' (using password: NO)


 What am supposed to do so that my regain access to phpadmin?  edit the
 php.ini file?

 isaac

 --
 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



Re: [PHP] help using phpadmin

2010-07-19 Thread Isaac Lee
im using windows.

On Mon, Jul 19, 2010 at 12:23 PM, Isaac Lee rhinecant...@gmail.com wrote:
 thanks carlos,

 but where would i enter that command?

 and i tried editing the php.ini file but that didn't accomplish anything.

 isaac

 On Mon, Jul 19, 2010 at 1:29 AM, Carlos Sura carlos_s...@hotmail.com wrote:
 Hello Isaac Lee.

 Are you running on Linux or Windows?

 You might try:
 mysql SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(’yourpassword’);

 Then restart your service -if needed-

 If not... Try to edit config.inc.php file.

 Regards,

 Carlos Sura

 -Original Message-
 From: Isaac Lee [mailto:rhinecant...@gmail.com]
 Sent: domingo, 18 de julio de 2010 10:34 p.m.
 Cc: php-general@lists.php.net
 Subject: [PHP] help using phpadmin

 this is the second time that i have made an account and set the
 password. then when i try to reaccess phpadmin, it shows this message:

 Error

 MySQL said:

 #1045 - Access denied for user 'root'@'localhost' (using password: NO)


 What am supposed to do so that my regain access to phpadmin?  edit the
 php.ini file?

 isaac

 --
 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



Re: [PHP] I need me a Good Book for PHP

2010-07-19 Thread rehmanms
I think php manual is one of the best thing to learn php

--
Shafiq
http://shafiq.pk
--Original Message--
From: Joce Jovanov
To: php-general@lists.php.net
Subject: [PHP] I need me a Good Book for PHP
Sent: Jul 19, 2010 8:54 PM

Hello,

I work only 6 mouth with PHP, and now star to like more and more. Do you
someone know samo good books (tutorials) for PHP and MySQL.
 Thanks

Best Regard
Jovanov Jordan



*** This Message Has Been Sent Using BlackBerry Internet Service from Mobilink 
***

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



[PHP] Copy documents for another site.

2010-07-19 Thread Jordan Jovanov

Hello

I create one site like document menage system and nide to take some date 
information from another site. The problem is a don't have access to 
date base. The site from who I need to take infomations use .htdacces 
but I have user and password for enter to site and i look the 
information. I write one php scripte but is not work.

Do you somebody know how can I copy inflammations
from this site to mine (from this site to my database)

Thanks a lot and this is a php scirpte

?php
$url = 'url site';
$username='user';
$password='pass';
$context = stream_context_create(array(
'http' = array(
'header'  = Authorization: Basic  . 
base64_encode($username:$password)

)
));
$data = file_get_contents($url, false, $context);


echo $data;
echo file_get_contents(http://$username:$passw...@site/meetings/;);




?

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



[PHP] MySQL select matching

2010-07-19 Thread Ashley M. Kirchner


I may be going at this completely wrong but at the moment I'm 
stuck.  I have a DB from a client and need to do several searches on 
it.  This one sentence is important because it's their DB, not mine.  So 
I can't modify the way the DB was created in the first place, I can only 
work with what I have.  And, whatever the solution to this might be, it 
does NOT have to be strictly MySQL, it can also be a PHP solution (which 
is why I'm sending it there as well.)  So, having said that, consider 
the following table:


+---+-+-+---+
| 1 | 123 | 0.0 | C |
| 1 | 234 | 0.1 | D |
| 1 | 345 | 0.0 | D |
| 1 | 456 | 0.1 | C |
| 1 | 567 | 0.1 | G |
| 2 | 123 | 0.0 | C |
| 2 | 234 | 0.1 | D |
| 2 | 345 | 0.0 | D |
| 3 | 234 | 0.1 | D |
| 3 | 345 | 0.0 | D |
| 3 | 123 | 0.0 | C |
| 3 | 456 | 0.1 | C |
| 3 | 567 | 0.1 | G |
| 4 | 123 | 0.0 | C |
| 4 | 234 | 0.1 | D |
| 4 | 345 | 0.0 | D |
+---+-+-+---+

mysql select * from table where id='1';
+---+-+-+---+
| 1 | 123 | 0.0 | C |
| 1 | 234 | 0.1 | D |
| 1 | 345 | 0.0 | D |
| 1 | 456 | 0.1 | C |
| 1 | 567 | 0.1 | G |
+---+-+-+---+

Now, I have to find other IDs that match the above result.  In the 
table, that would be ID '3' (and in the entire DB, there may be 
others as well - I need to find all those IDs.)  But, notice how ID 0003 
isn't in the same order as ID 1, but the data is still the same.


So how do I efficiently search through the DB to find other IDs 
that matches the one I need?  I can't imagine doing a for loop selecting 
each ID and comparing their result to the one I'm starting with.  If the 
DB contains thousands upon thousands of rows, that might take a very 
long time.


Open to suggestions.

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



[PHP] Re: MySQL select matching

2010-07-19 Thread Michael Dykman
Not quite sure what the question is.

from:
 mysql select * from table where id='1';
 +---+-+-+---+
 | 1 | 123 | 0.0 | C |
 | 1 | 234 | 0.1 | D |
 | 1 | 345 | 0.0 | D |
 | 1 | 456 | 0.1 | C |
 | 1 | 567 | 0.1 | G |
 +---+-+-+---+

How do we deduce that you would want ID '3' ?

This conversation would be easier if we gave names to those columns..

 - michael dykman


On Mon, Jul 19, 2010 at 12:36 PM, Ashley M. Kirchner ash...@pcraft.com wrote:

    I may be going at this completely wrong but at the moment I'm stuck.  I
 have a DB from a client and need to do several searches on it.  This one
 sentence is important because it's their DB, not mine.  So I can't modify
 the way the DB was created in the first place, I can only work with what I
 have.  And, whatever the solution to this might be, it does NOT have to be
 strictly MySQL, it can also be a PHP solution (which is why I'm sending it
 there as well.)  So, having said that, consider the following table:

 +---+-+-+---+
 | 1 | 123 | 0.0 | C |
 | 1 | 234 | 0.1 | D |
 | 1 | 345 | 0.0 | D |
 | 1 | 456 | 0.1 | C |
 | 1 | 567 | 0.1 | G |
 | 2 | 123 | 0.0 | C |
 | 2 | 234 | 0.1 | D |
 | 2 | 345 | 0.0 | D |
 | 3 | 234 | 0.1 | D |
 | 3 | 345 | 0.0 | D |
 | 3 | 123 | 0.0 | C |
 | 3 | 456 | 0.1 | C |
 | 3 | 567 | 0.1 | G |
 | 4 | 123 | 0.0 | C |
 | 4 | 234 | 0.1 | D |
 | 4 | 345 | 0.0 | D |
 +---+-+-+---+

 mysql select * from table where id='1';
 +---+-+-+---+
 | 1 | 123 | 0.0 | C |
 | 1 | 234 | 0.1 | D |
 | 1 | 345 | 0.0 | D |
 | 1 | 456 | 0.1 | C |
 | 1 | 567 | 0.1 | G |
 +---+-+-+---+

    Now, I have to find other IDs that match the above result.  In the table,
 that would be ID '3' (and in the entire DB, there may be others as well
 - I need to find all those IDs.)  But, notice how ID 0003 isn't in the same
 order as ID 1, but the data is still the same.

    So how do I efficiently search through the DB to find other IDs that
 matches the one I need?  I can't imagine doing a for loop selecting each ID
 and comparing their result to the one I'm starting with.  If the DB contains
 thousands upon thousands of rows, that might take a very long time.

    Open to suggestions.

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:    http://lists.mysql.com/mysql?unsub=mdyk...@gmail..com





-- 
 - michael dykman
 - mdyk...@gmail.com

 May the Source be with you.

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



[PHP] Re: [MySQL] Re: MySQL select matching

2010-07-19 Thread Ashley M. Kirchner

On 7/19/2010 10:48 AM, Michael Dykman wrote:

Not quite sure what the question is.

from:
   

mysql  select * from table where id='1';
+---+-+-+---+
| 1 | 123 | 0.0 | C |
| 1 | 234 | 0.1 | D |
| 1 | 345 | 0.0 | D |
| 1 | 456 | 0.1 | C |
| 1 | 567 | 0.1 | G |
+---+-+-+---+
 

How do we deduce that you would want ID '3' ?

This conversation would be easier if we gave names to those columns..
   


I didn't think it mattered, but the ID that I'm starting with (in 
this case '1') is the user id currently searching the DB.  Basically 
I take the user id and collect the initial data set I need to compare 
against.


As for names on the columns, ok:

+---+-+-+---+
|   uid | set | dec | l |
+---+-+-+---+
| 1 | 123 | 0.0 | C |
| 1 | 234 | 0.1 | D |
| 1 | 345 | 0.0 | D |
| 1 | 456 | 0.1 | C |
| 1 | 567 | 0.1 | G |
+---+-+-+---+




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



RE: [PHP] help using phpadmin

2010-07-19 Thread Carlos Sura

Hello Isaac Lee,

I don't remember well, but I think this is the way to do it in Windows.
You can try this:

Start -- Run  cmd   // Write it and press enter key.
It will show you a MS-DOS window,
Write there: mysql

now:
mysql cd c:\location\mysql\bin

Then you might try:
mysqladmin -u root password new_password

Now type:
mysql -u root -p

Write your new password now :)

If none of this work...
Please show me your ini* file.

If you can't show me your ini* file please reffer to: 
http://search.mysql.com/search?q=Resetting_permissions.htmllr=lang_en


Regards,
Carlos Sura.






 Date: Mon, 19 Jul 2010 12:24:26 -0400
 From: rhinecant...@gmail.com
 To: carlos_s...@hotmail.com
 CC: php-general@lists.php.net
 Subject: Re: [PHP] help using phpadmin
 
 im using windows.
 
 On Mon, Jul 19, 2010 at 12:23 PM, Isaac Lee rhinecant...@gmail.com wrote:
  thanks carlos,
 
  but where would i enter that command?
 
  and i tried editing the php.ini file but that didn't accomplish anything.
 
  isaac
 
  On Mon, Jul 19, 2010 at 1:29 AM, Carlos Sura carlos_s...@hotmail.com 
  wrote:
  Hello Isaac Lee.
 
  Are you running on Linux or Windows?
 
  You might try:
  mysql SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(’yourpassword’);
 
  Then restart your service -if needed-
 
  If not... Try to edit config.inc.php file.
 
  Regards,
 
  Carlos Sura
 
  -Original Message-
  From: Isaac Lee [mailto:rhinecant...@gmail.com]
  Sent: domingo, 18 de julio de 2010 10:34 p.m.
  Cc: php-general@lists.php.net
  Subject: [PHP] help using phpadmin
 
  this is the second time that i have made an account and set the
  password. then when i try to reaccess phpadmin, it shows this message:
 
  Error
 
  MySQL said:
 
  #1045 - Access denied for user 'root'@'localhost' (using password: NO)
 
 
  What am supposed to do so that my regain access to phpadmin?  edit the
  php.ini file?
 
  isaac
 
  --
  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
 
  
_
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
http://clk.atdmt.com/UKM/go/195013117/direct/01/

Re: [PHP] access violation

2010-07-19 Thread SteveW
I switched to PHP 5.3.2 and to fastcgi and that seems to have cured the 
problem.


Thanks for the reply 



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



Re: [PHP] MySQL Query Puzzle

2010-07-19 Thread Shreyas Agasthya
Just to add more perspective :

You will have a table with DISTINCT values.

Drop the initial table (better take a back-up); copy from the temporary
table which will have only DISTINCT values.

Regards,
Shreyas

On Mon, Jul 19, 2010 at 7:58 PM, Shreyas Agasthya shreya...@gmail.comwrote:

 How about this :

 CREATE TEMPORARY TABLE bad_temp1 (id INT,name VARCHAR(20));
 INSERT INTO bad_temp1 (id,name) SELECT DISTINCT id,name FROM SAMPLE;

 Regards,
 Shreyas

 On Mon, Jul 19, 2010 at 7:31 PM, Richard Quadling rquadl...@gmail.comwrote:

 On 19 July 2010 05:44, Peter pet...@egrabber.com wrote:
  Hi All,
 
  I have a  table which contain's some duplicate rows. I just want to
 delete
  the duplicate records alone
  not original records.
 
  Assume my table as look as below
 
  column1 column2
  1
 a
  1
 a
  2
 b
  3
 c
  3
 c
 
 
 
  i want the above table need  to be as below, After executing the mysql
  query.
 
  column1
 column2
  1
 a
  2
 b
  3
 c
 
 
 
 
  Thanks in advance..
 
  Regards
  Peter
 

 If your table had a db generated sequential unique identifier (an
 identity / autoinc), then something along these lines may be what you
 are looking for ...

 -- Delete everything except the UniqueIDs we want to keep.
 DELETE FROM
Table
 WHERE
UniqueID NOT IN
(
-- Just get the UniqueIDs we want to keep.
SELECT
UniqueID
FROM
(
-- Get the earlist UniqueID for each Col1, Col2,
 pairing.
SELECT
Col1,
Col2,
MIN(UniqueID) AS UniqueID
FROM
Table
GROUP BY
Col1,
Col2
)
)

 UNTESTED

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




 --
 Regards,
 Shreyas Agasthya




-- 
Regards,
Shreyas Agasthya


Re: [PHP] Determining the similarity between a user supplied short piece of text (between 5 and 15 characters) and a list of similar length text items.

2010-07-19 Thread tedd

At 12:39 PM +0100 7/19/10, Richard Quadling wrote:


I'm using MS SQL, not mySQL.

Found a extended stored procedure with a UDF.

Testing it looks excellent.

Searching for a match on 30,000 vehicles next to no additional time -
a few seconds in total, compared to the over 3 minutes to search using
SQL code.


That seems a bit slow.

For example, currently I'm searching over 4,000 records (which 
contains 4,000 paragraphs taken from the text of the King James 
version of the Bible) for matching words, such as %created% and the 
times are typically around 0.009 seconds.


As such, searching ten times that amount should be in the range of 
tenths of a second and not seconds -- so taking a few seconds to 
search 30,000 records seems excessive to me.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Determining the similarity between a user supplied short piece of text (between 5 and 15 characters) and a list of similar length text items.

2010-07-19 Thread Andrew Ballard
On Mon, Jul 19, 2010 at 2:46 PM, tedd tedd.sperl...@gmail.com wrote:
 At 12:39 PM +0100 7/19/10, Richard Quadling wrote:

 I'm using MS SQL, not mySQL.

 Found a extended stored procedure with a UDF.

 Testing it looks excellent.

 Searching for a match on 30,000 vehicles next to no additional time -
 a few seconds in total, compared to the over 3 minutes to search using
 SQL code.

 That seems a bit slow.

 For example, currently I'm searching over 4,000 records (which contains
 4,000 paragraphs taken from the text of the King James version of the Bible)
 for matching words, such as %created% and the times are typically around
 0.009 seconds.

 As such, searching ten times that amount should be in the range of tenths of
 a second and not seconds -- so taking a few seconds to search 30,000 records
 seems excessive to me.

 Cheers,

 tedd

I would be surprised if a Levenshtein or similar_text comparison in a
database were NOT slower than even a wildcard search because of the
calculations that have to be performed on each row in the column being
compared. That, and the fact that user-defined functions in SQL Server
often have a performance penalty of their own.

Just for kicks, you could try loading the values in that column into
an array in PHP and then time iterating the array to calculate the
Levenshtein distances for each value to see how it compares.

Andrew

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



Re: [PHP] enabling domdocument

2010-07-19 Thread Michael A. Peters

Ashley Sheridan wrote:




OK, I seem to have answered my own question!

It seems that even though PHP had the XML module enabled, I still needed
to run 'yum update php-xml' in order for it to load in the DOM module.
It's now working fine, and for those of you interested, the ./configure
line in phpinfo() still says --disable-dom!


Yes.
I'm quite familiar with the rpm build process for php.

The initial build of php is without support for any of the modules. Then 
the modules are built. So the configure command for the core php apache 
DSO has just about everything disabled.


A nasty side effect of doing it this way - if you ever need to rebuild 
the src.rpm, either do it in a chroot build environment (such as mock) 
or be sure to remove all the old php packages - because what can happen 
is the new php is built but when it then goes to build the modules, it 
links them against installed php instead of the php it just built.


They may have fixed that in the Makefile, I don't know, but the net 
result can be a set of rpms that are broken.


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



Re: [PHP] MySQL Query Puzzle

2010-07-19 Thread Jim Lucas

Peter wrote:

Hi All,

I have a  table which contain's some duplicate rows. I just want to 
delete the duplicate records alone

not original records.

Assume my table as look as below

column1 column2
1
a
1
a
2
b
3
c
3
c



i want the above table need  to be as below, After executing the mysql 
query.


column1
column2
1
a
2
b
3
c




Thanks in advance..

Regards
Peter



Use the SQL command alter with the ignore flag.

ALTER IGNORE TABLE `your_table` ADD UNIQUE ( `column1` , `column2` )

I tested this on my test DB and it worked fine.  It erased all the 
duplicates and left one instance of the multiple entry values.


This will add a permanent unique restraint to the table.  So, you will 
never have dupps again.


Jim Lucas

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