[PHP] Ok then, here is a test

2012-10-13 Thread Jim Lucas

On 10/12/2012 11:42 AM, Daniel Brown wrote:

 Well, as the adage goes, you'll catch more flies with honey than
 with vinegar.  And considering this is the very first message I've
 ever seen from you, it sounds like either (a) you didn't follow the
 proper protocol, or (b) there's something in the process we need to
 review.  If you think the issue lies on our end, you can submit a bug
 at https://bugs.php.net/ and detail the steps to reproduce the issue.
 If it is indeed something we need to correct, believe me, we will.  We
 don't deliberately attempt to mislead or frustrate people, despite how
 it might have seemed.

Well, with that said, here is a test.

I have found, in the past, that when I enable all the SPAM filtering 
that I want, that 76.75.200.58/pb1.pair.com/lists.php.net mail server 
gets blocked by my mail server.  It has been a while so I don't remember 
what the reason was it got blocked, but I have enabled all the filtering 
again, and this is my test email with the full set of filtering enabled.


Lets see if the server still gets blocked.  I will post the logs if and 
when it gets blocked.


--
Jim Lucas

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



Re: [PHP] Ok then, here is a test

2012-10-13 Thread Jim Lucas

On 10/13/2012 10:42 PM, Jim Lucas wrote:

On 10/12/2012 11:42 AM, Daniel Brown wrote:

  Well, as the adage goes, you'll catch more flies with honey than
  with vinegar.  And considering this is the very first message I've
  ever seen from you, it sounds like either (a) you didn't follow the
  proper protocol, or (b) there's something in the process we need to
  review.  If you think the issue lies on our end, you can submit a bug
  at https://bugs.php.net/ and detail the steps to reproduce the issue.
  If it is indeed something we need to correct, believe me, we will.  We
  don't deliberately attempt to mislead or frustrate people, despite how
  it might have seemed.

Well, with that said, here is a test.

I have found, in the past, that when I enable all the SPAM filtering
that I want, that 76.75.200.58/pb1.pair.com/lists.php.net mail server
gets blocked by my mail server.  It has been a while so I don't remember
what the reason was it got blocked, but I have enabled all the filtering
again, and this is my test email with the full set of filtering enabled.

Lets see if the server still gets blocked.  I will post the logs if and
when it gets blocked.

--
Jim Lucas




Well, I got it.  Seems the problem has gone away.

Never mind then.

--
Jim Lucas

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



[PHP] Re: [BULK] Re: [PHP] OK to have many files in one folder?

2007-06-18 Thread clive


I have no clue how big the files are, but you might want to store them
in a database. That can speed up things, but don't ask me how much ;)

Tijnema

no dude, while database are convenient, files systems are faster, I mean 
thats what they were designed for, serving files.


For lots of files I would store them in directories and sub directories.

-
--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


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



[PHP] Re: [BULK] Re: [PHP] OK to have many files in one folder?

2007-06-18 Thread Colin Guthrie
clive wrote:

 I have no clue how big the files are, but you might want to store them
 in a database. That can speed up things, but don't ask me how much ;)

 Tijnema

 no dude, while database are convenient, files systems are faster, I mean
 thats what they were designed for, serving files.
 
 For lots of files I would store them in directories and sub directories.

Yeah amen!

I generally use a two character hex hash in  my main folder to give 255
sub folders each containing files.

In my case the hash is calculated from some known info - e.g. a database
ID and then stored in a meta data table.

Col

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



Re: [PHP] Re: [BULK] Re: [PHP] OK to have many files in one folder?

2007-06-18 Thread Daniel Brown

On 6/18/07, Colin Guthrie [EMAIL PROTECTED] wrote:

clive wrote:

 I have no clue how big the files are, but you might want to store them
 in a database. That can speed up things, but don't ask me how much ;)

 Tijnema

 no dude, while database are convenient, files systems are faster, I mean
 thats what they were designed for, serving files.

 For lots of files I would store them in directories and sub directories.

Yeah amen!

I generally use a two character hex hash in  my main folder to give 255
sub folders each containing files.

In my case the hash is calculated from some known info - e.g. a database
ID and then stored in a meta data table.

Col

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




   Tij,

   Referring to one of my earlier posts in this thread, as a
refresher, database information is stored in files.  So to store files
in a database means the following has to take place:

   1.) Data is uploaded to the server.
   2.) Data is processed by the database server.
   3.) Data is compressed and encrypted.
   4.) Data is written to disk.
   (4b. - optional) Data file is checked for integrity and
correctness of write.

   Then, to serve the content, a similar reverse occurs:

   1.) Request is sent to the server via a script.
   2.) The script interfaces with the database to locate the
desired data row.
   3.) Once located, the data is pulled in raw form from the database file.
   4.) The data is then decompressed and decrypted.
   5.) The data is streamed back to the script.
   6.) The script decides how to handle it, based upon hard-coded options.

   For a filesystem, it's simpler.  Uploading:

   1.) Data is uploaded.
   2.) Data is written to disk.

   Serving:

   1.) Request is sent via script, FTP, socket connection, or
local request.
   2.) File is served through via the method requested.

   So there are several pros and cons for each, but just to list
three of each with regard to database storage:

   Pros:
   Can be stored centralized and portable, without needing to archive.
   Automatically encrypted and compressed upon storage.
   Easier and faster to search.
   Cons:
   Slower storage and retrieval
   Much greater risk of corruption
   Not always cross-compatible across platforms, versions,
installations, etc.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Re: [BULK] Re: [PHP] OK to have many files in one folder?

2007-06-18 Thread Tijnema

On 6/18/07, Daniel Brown [EMAIL PROTECTED] wrote:

On 6/18/07, Colin Guthrie [EMAIL PROTECTED] wrote:
 clive wrote:
 
  I have no clue how big the files are, but you might want to store them
  in a database. That can speed up things, but don't ask me how much ;)
 
  Tijnema
 
  no dude, while database are convenient, files systems are faster, I mean
  thats what they were designed for, serving files.
 
  For lots of files I would store them in directories and sub directories.

 Yeah amen!

 I generally use a two character hex hash in  my main folder to give 255
 sub folders each containing files.

 In my case the hash is calculated from some known info - e.g. a database
 ID and then stored in a meta data table.

 Col

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



   Tij,

   Referring to one of my earlier posts in this thread, as a
refresher, database information is stored in files.  So to store files
in a database means the following has to take place:

   1.) Data is uploaded to the server.
   2.) Data is processed by the database server.
   3.) Data is compressed and encrypted.
   4.) Data is written to disk.
   (4b. - optional) Data file is checked for integrity and
correctness of write.

   Then, to serve the content, a similar reverse occurs:

   1.) Request is sent to the server via a script.
   2.) The script interfaces with the database to locate the
desired data row.
   3.) Once located, the data is pulled in raw form from the database file.
   4.) The data is then decompressed and decrypted.
   5.) The data is streamed back to the script.
   6.) The script decides how to handle it, based upon hard-coded options.

   For a filesystem, it's simpler.  Uploading:

   1.) Data is uploaded.
   2.) Data is written to disk.

   Serving:

   1.) Request is sent via script, FTP, socket connection, or
local request.
   2.) File is served through via the method requested.

   So there are several pros and cons for each, but just to list
three of each with regard to database storage:

   Pros:
   Can be stored centralized and portable, without needing to archive.
   Automatically encrypted and compressed upon storage.
   Easier and faster to search.
   Cons:
   Slower storage and retrieval
   Much greater risk of corruption
   Not always cross-compatible across platforms, versions,
installations, etc.

--
Daniel P. Brown


How sure are you about all this?
Benchmarks?

What about search time for the harddrives etc? It needs to scan the
inode table to find the file, etc.., then it needs to locate that file
on the harddrive, while the second file might be on the other side of
the disk

Storing all files in one single filesystem means you have only 1 inode
:) All data is stored at same place (atleast, it should be)

Tijnema

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



Re: [PHP] Re: [BULK] Re: [PHP] OK to have many files in one folder?

2007-06-18 Thread Daniel Brown

On 6/18/07, Tijnema [EMAIL PROTECTED] wrote:

On 6/18/07, Daniel Brown [EMAIL PROTECTED] wrote:
 On 6/18/07, Colin Guthrie [EMAIL PROTECTED] wrote:
  clive wrote:
  
   I have no clue how big the files are, but you might want to store them
   in a database. That can speed up things, but don't ask me how much ;)
  
   Tijnema
  
   no dude, while database are convenient, files systems are faster, I mean
   thats what they were designed for, serving files.
  
   For lots of files I would store them in directories and sub directories.
 
  Yeah amen!
 
  I generally use a two character hex hash in  my main folder to give 255
  sub folders each containing files.
 
  In my case the hash is calculated from some known info - e.g. a database
  ID and then stored in a meta data table.
 
  Col
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

Tij,

Referring to one of my earlier posts in this thread, as a
 refresher, database information is stored in files.  So to store files
 in a database means the following has to take place:

1.) Data is uploaded to the server.
2.) Data is processed by the database server.
3.) Data is compressed and encrypted.
4.) Data is written to disk.
(4b. - optional) Data file is checked for integrity and
 correctness of write.

Then, to serve the content, a similar reverse occurs:

1.) Request is sent to the server via a script.
2.) The script interfaces with the database to locate the
 desired data row.
3.) Once located, the data is pulled in raw form from the database 
file.
4.) The data is then decompressed and decrypted.
5.) The data is streamed back to the script.
6.) The script decides how to handle it, based upon hard-coded options.

For a filesystem, it's simpler.  Uploading:

1.) Data is uploaded.
2.) Data is written to disk.

Serving:

1.) Request is sent via script, FTP, socket connection, or
 local request.
2.) File is served through via the method requested.

So there are several pros and cons for each, but just to list
 three of each with regard to database storage:

Pros:
Can be stored centralized and portable, without needing to archive.
Automatically encrypted and compressed upon storage.
Easier and faster to search.
Cons:
Slower storage and retrieval
Much greater risk of corruption
Not always cross-compatible across platforms, versions,
 installations, etc.

 --
 Daniel P. Brown

How sure are you about all this?
Benchmarks?

What about search time for the harddrives etc? It needs to scan the
inode table to find the file, etc.., then it needs to locate that file
on the harddrive, while the second file might be on the other side of
the disk

Storing all files in one single filesystem means you have only 1 inode
:) All data is stored at same place (atleast, it should be)

Tijnema



   Do I have benchmarks?  No.  Do I have the time to do them now?  No.

   Do I feel confident enough that if you were to run those benchmark
tests that it would prove me right?  Damn straight.  ;-P

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Re: [BULK] Re: [PHP] OK to have many files in one folder?

2007-06-18 Thread Tijnema

On 6/18/07, Daniel Brown [EMAIL PROTECTED] wrote:

On 6/18/07, Tijnema [EMAIL PROTECTED] wrote:
 On 6/18/07, Daniel Brown [EMAIL PROTECTED] wrote:
  On 6/18/07, Colin Guthrie [EMAIL PROTECTED] wrote:
   clive wrote:
   
I have no clue how big the files are, but you might want to store them
in a database. That can speed up things, but don't ask me how much ;)
   
Tijnema
   
no dude, while database are convenient, files systems are faster, I mean
thats what they were designed for, serving files.
   
For lots of files I would store them in directories and sub directories.
  
   Yeah amen!
  
   I generally use a two character hex hash in  my main folder to give 255
   sub folders each containing files.
  
   In my case the hash is calculated from some known info - e.g. a database
   ID and then stored in a meta data table.
  
   Col
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 Tij,
 
 Referring to one of my earlier posts in this thread, as a
  refresher, database information is stored in files.  So to store files
  in a database means the following has to take place:
 
 1.) Data is uploaded to the server.
 2.) Data is processed by the database server.
 3.) Data is compressed and encrypted.
 4.) Data is written to disk.
 (4b. - optional) Data file is checked for integrity and
  correctness of write.
 
 Then, to serve the content, a similar reverse occurs:
 
 1.) Request is sent to the server via a script.
 2.) The script interfaces with the database to locate the
  desired data row.
 3.) Once located, the data is pulled in raw form from the database 
file.
 4.) The data is then decompressed and decrypted.
 5.) The data is streamed back to the script.
 6.) The script decides how to handle it, based upon hard-coded 
options.
 
 For a filesystem, it's simpler.  Uploading:
 
 1.) Data is uploaded.
 2.) Data is written to disk.
 
 Serving:
 
 1.) Request is sent via script, FTP, socket connection, or
  local request.
 2.) File is served through via the method requested.
 
 So there are several pros and cons for each, but just to list
  three of each with regard to database storage:
 
 Pros:
 Can be stored centralized and portable, without needing to archive.
 Automatically encrypted and compressed upon storage.
 Easier and faster to search.
 Cons:
 Slower storage and retrieval
 Much greater risk of corruption
 Not always cross-compatible across platforms, versions,
  installations, etc.
 
  --
  Daniel P. Brown

 How sure are you about all this?
 Benchmarks?

 What about search time for the harddrives etc? It needs to scan the
 inode table to find the file, etc.., then it needs to locate that file
 on the harddrive, while the second file might be on the other side of
 the disk

 Storing all files in one single filesystem means you have only 1 inode
 :) All data is stored at same place (atleast, it should be)

 Tijnema


   Do I have benchmarks?  No.  Do I have the time to do them now?  No.

   Do I feel confident enough that if you were to run those benchmark
tests that it would prove me right?  Damn straight.  ;-P

--
Daniel P. Brown


I think I have some time to write a simple script in a few hours, I'd
like to see what the performance difference is :)

Tijnema

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



Re: [PHP] Re: [BULK] Re: [PHP] OK to have many files in one folder?

2007-06-18 Thread Daniel Brown

On 6/18/07, Tijnema [EMAIL PROTECTED] wrote:

On 6/18/07, Daniel Brown [EMAIL PROTECTED] wrote:
 On 6/18/07, Tijnema [EMAIL PROTECTED] wrote:
  On 6/18/07, Daniel Brown [EMAIL PROTECTED] wrote:
   On 6/18/07, Colin Guthrie [EMAIL PROTECTED] wrote:
clive wrote:

 I have no clue how big the files are, but you might want to store 
them
 in a database. That can speed up things, but don't ask me how much ;)

 Tijnema

 no dude, while database are convenient, files systems are faster, I 
mean
 thats what they were designed for, serving files.

 For lots of files I would store them in directories and sub 
directories.
   
Yeah amen!
   
I generally use a two character hex hash in  my main folder to give 255
sub folders each containing files.
   
In my case the hash is calculated from some known info - e.g. a database
ID and then stored in a meta data table.
   
Col
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
   
  
  Tij,
  
  Referring to one of my earlier posts in this thread, as a
   refresher, database information is stored in files.  So to store files
   in a database means the following has to take place:
  
  1.) Data is uploaded to the server.
  2.) Data is processed by the database server.
  3.) Data is compressed and encrypted.
  4.) Data is written to disk.
  (4b. - optional) Data file is checked for integrity and
   correctness of write.
  
  Then, to serve the content, a similar reverse occurs:
  
  1.) Request is sent to the server via a script.
  2.) The script interfaces with the database to locate the
   desired data row.
  3.) Once located, the data is pulled in raw form from the database 
file.
  4.) The data is then decompressed and decrypted.
  5.) The data is streamed back to the script.
  6.) The script decides how to handle it, based upon hard-coded 
options.
  
  For a filesystem, it's simpler.  Uploading:
  
  1.) Data is uploaded.
  2.) Data is written to disk.
  
  Serving:
  
  1.) Request is sent via script, FTP, socket connection, or
   local request.
  2.) File is served through via the method requested.
  
  So there are several pros and cons for each, but just to list
   three of each with regard to database storage:
  
  Pros:
  Can be stored centralized and portable, without needing to archive.
  Automatically encrypted and compressed upon storage.
  Easier and faster to search.
  Cons:
  Slower storage and retrieval
  Much greater risk of corruption
  Not always cross-compatible across platforms, versions,
   installations, etc.
  
   --
   Daniel P. Brown
 
  How sure are you about all this?
  Benchmarks?
 
  What about search time for the harddrives etc? It needs to scan the
  inode table to find the file, etc.., then it needs to locate that file
  on the harddrive, while the second file might be on the other side of
  the disk
 
  Storing all files in one single filesystem means you have only 1 inode
  :) All data is stored at same place (atleast, it should be)
 
  Tijnema
 

Do I have benchmarks?  No.  Do I have the time to do them now?  No.

Do I feel confident enough that if you were to run those benchmark
 tests that it would prove me right?  Damn straight.  ;-P

 --
 Daniel P. Brown

I think I have some time to write a simple script in a few hours, I'd
like to see what the performance difference is :)

Tijnema



   Well, keep in mind that I don't expect that you'd see much
difference at all with a single file, but try doing multiple files of
ASCII and binary, various sizes, and also several simultaneous
connections.

   Two other things I forgot to mention with database storage are a
pro and con, respectively - caching and accessibility.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] Re: [BULK] Re: [PHP] OK to have many files in one folder?

2007-06-18 Thread Robert Cummings
On Mon, 2007-06-18 at 11:25 -0400, Daniel Brown wrote:
 On 6/18/07, Tijnema [EMAIL PROTECTED] wrote:
  On 6/18/07, Daniel Brown [EMAIL PROTECTED] wrote:
Referring to one of my earlier posts in this thread, as a
 refresher, database information is stored in files.  So to store files
 in a database means the following has to take place:

1.) Data is uploaded to the server.
2.) Data is processed by the database server.
3.) Data is compressed and encrypted.
4.) Data is written to disk.
(4b. - optional) Data file is checked for integrity and
 correctness of write.

Then, to serve the content, a similar reverse occurs:

1.) Request is sent to the server via a script.
2.) The script interfaces with the database to locate the
 desired data row.
3.) Once located, the data is pulled in raw form from the 
 database file.
4.) The data is then decompressed and decrypted.
5.) The data is streamed back to the script.
6.) The script decides how to handle it, based upon hard-coded 
 options.

For a filesystem, it's simpler.  Uploading:

1.) Data is uploaded.
2.) Data is written to disk.

This isn't quite correct. There are numerous databases that allow you to
assign a raw partition and they manage the filesystem themselves thus
the intermediate OS dependence is eliminated. As such, the database
probably wins in this situation since you also get rapid searching on
any meta data fields and since you probably have to issue a query
anyways (for either approach), this approach is superior since you no
longer need to interact with the filesystem at all. The only negative is
that writing to the database will be less efficient due to escaping of
the data. But reading will be much faster. And in practice, I'd wager,
it's rare that images are created more often than read.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Re: [BULK] Re: [PHP] OK to have many files in one folder?

2007-06-18 Thread Jim Lucas

Daniel Brown wrote:

On 6/18/07, Tijnema [EMAIL PROTECTED] wrote:

On 6/18/07, Daniel Brown [EMAIL PROTECTED] wrote:
 On 6/18/07, Tijnema [EMAIL PROTECTED] wrote:
  On 6/18/07, Daniel Brown [EMAIL PROTECTED] wrote:
   On 6/18/07, Colin Guthrie [EMAIL PROTECTED] wrote:
clive wrote:

 I have no clue how big the files are, but you might want to 
store them
 in a database. That can speed up things, but don't ask me 
how much ;)


 Tijnema

 no dude, while database are convenient, files systems are 
faster, I mean

 thats what they were designed for, serving files.

 For lots of files I would store them in directories and sub 
directories.

   
Yeah amen!
   
I generally use a two character hex hash in  my main folder to 
give 255

sub folders each containing files.
   
In my case the hash is calculated from some known info - e.g. 
a database

ID and then stored in a meta data table.
   
Col
   
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
   
   
  
  Tij,
  
  Referring to one of my earlier posts in this thread, as a
   refresher, database information is stored in files.  So to store 
files

   in a database means the following has to take place:
  
  1.) Data is uploaded to the server.
  2.) Data is processed by the database server.
  3.) Data is compressed and encrypted.
  4.) Data is written to disk.
  (4b. - optional) Data file is checked for integrity and
   correctness of write.
  
  Then, to serve the content, a similar reverse occurs:
  
  1.) Request is sent to the server via a script.
  2.) The script interfaces with the database to locate the
   desired data row.
  3.) Once located, the data is pulled in raw form from the 
database file.

  4.) The data is then decompressed and decrypted.
  5.) The data is streamed back to the script.
  6.) The script decides how to handle it, based upon 
hard-coded options.

  
  For a filesystem, it's simpler.  Uploading:
  
  1.) Data is uploaded.
  2.) Data is written to disk.
  
  Serving:
  
  1.) Request is sent via script, FTP, socket connection, or
   local request.
  2.) File is served through via the method requested.
  
  So there are several pros and cons for each, but just to list
   three of each with regard to database storage:
  
  Pros:
  Can be stored centralized and portable, without needing 
to archive.

  Automatically encrypted and compressed upon storage.
  Easier and faster to search.
  Cons:
  Slower storage and retrieval
  Much greater risk of corruption
  Not always cross-compatible across platforms, versions,
   installations, etc.
  
   --
   Daniel P. Brown
 
  How sure are you about all this?
  Benchmarks?
 
  What about search time for the harddrives etc? It needs to scan the
  inode table to find the file, etc.., then it needs to locate that 
file

  on the harddrive, while the second file might be on the other side of
  the disk
 
  Storing all files in one single filesystem means you have only 1 
inode

  :) All data is stored at same place (atleast, it should be)
 
  Tijnema
 

Do I have benchmarks?  No.  Do I have the time to do them now?  No.

Do I feel confident enough that if you were to run those benchmark
 tests that it would prove me right?  Damn straight.  ;-P

 --
 Daniel P. Brown

I think I have some time to write a simple script in a few hours, I'd
like to see what the performance difference is :)

Tijnema



   Well, keep in mind that I don't expect that you'd see much
difference at all with a single file, but try doing multiple files of
ASCII and binary, various sizes, and also several simultaneous
connections.

   Two other things I forgot to mention with database storage are a
pro and con, respectively - caching and accessibility.



and the fact that a lot of hosting environments have a DB on a different 
machine.

This would make for a much worse performance then the local filesystem.

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Re: [BULK] Re: [PHP] OK to have many files in one folder?

2007-06-18 Thread Robert Cummings
On Mon, 2007-06-18 at 08:41 -0700, Jim Lucas wrote:
 Daniel Brown wrote:
  On 6/18/07, Tijnema [EMAIL PROTECTED] wrote:
  On 6/18/07, Daniel Brown [EMAIL PROTECTED] wrote:
   On 6/18/07, Tijnema [EMAIL PROTECTED] wrote:
On 6/18/07, Daniel Brown [EMAIL PROTECTED] wrote:
 On 6/18/07, Colin Guthrie [EMAIL PROTECTED] wrote:
  clive wrote:
  
   I have no clue how big the files are, but you might want to 
  store them
   in a database. That can speed up things, but don't ask me 
  how much ;)
  
   Tijnema
  
   no dude, while database are convenient, files systems are 
  faster, I mean
   thats what they were designed for, serving files.
  
   For lots of files I would store them in directories and sub 
  directories.
 
  Yeah amen!
 
  I generally use a two character hex hash in  my main folder to 
  give 255
  sub folders each containing files.
 
  In my case the hash is calculated from some known info - e.g. 
  a database
  ID and then stored in a meta data table.
 
  Col
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

Tij,

Referring to one of my earlier posts in this thread, as a
 refresher, database information is stored in files.  So to store 
  files
 in a database means the following has to take place:

1.) Data is uploaded to the server.
2.) Data is processed by the database server.
3.) Data is compressed and encrypted.
4.) Data is written to disk.
(4b. - optional) Data file is checked for integrity and
 correctness of write.

Then, to serve the content, a similar reverse occurs:

1.) Request is sent to the server via a script.
2.) The script interfaces with the database to locate the
 desired data row.
3.) Once located, the data is pulled in raw form from the 
  database file.
4.) The data is then decompressed and decrypted.
5.) The data is streamed back to the script.
6.) The script decides how to handle it, based upon 
  hard-coded options.

For a filesystem, it's simpler.  Uploading:

1.) Data is uploaded.
2.) Data is written to disk.

Serving:

1.) Request is sent via script, FTP, socket connection, or
 local request.
2.) File is served through via the method requested.

So there are several pros and cons for each, but just to list
 three of each with regard to database storage:

Pros:
Can be stored centralized and portable, without needing 
  to archive.
Automatically encrypted and compressed upon storage.
Easier and faster to search.
Cons:
Slower storage and retrieval
Much greater risk of corruption
Not always cross-compatible across platforms, versions,
 installations, etc.

 --
 Daniel P. Brown
   
How sure are you about all this?
Benchmarks?
   
What about search time for the harddrives etc? It needs to scan the
inode table to find the file, etc.., then it needs to locate that 
  file
on the harddrive, while the second file might be on the other side of
the disk
   
Storing all files in one single filesystem means you have only 1 
  inode
:) All data is stored at same place (atleast, it should be)
   
Tijnema
   
  
  Do I have benchmarks?  No.  Do I have the time to do them now?  No.
  
  Do I feel confident enough that if you were to run those benchmark
   tests that it would prove me right?  Damn straight.  ;-P
  
   --
   Daniel P. Brown
 
  I think I have some time to write a simple script in a few hours, I'd
  like to see what the performance difference is :)
 
  Tijnema
 
  
 Well, keep in mind that I don't expect that you'd see much
  difference at all with a single file, but try doing multiple files of
  ASCII and binary, various sizes, and also several simultaneous
  connections.
  
 Two other things I forgot to mention with database storage are a
  pro and con, respectively - caching and accessibility.
  
 
 and the fact that a lot of hosting environments have a DB on a different 
 machine.
 
 This would make for a much worse performance then the local filesystem.

Maybe on the occasional hit. I use a technique where a 404 request of a
specially formulated filename causes the file to be retrieved from the
remote centralized database server. If found the 404 is changed to a 200
response and the file is served. Subsequent requests directly access the
file from the webserver without PHP. Obviously this is a caching
technique, but it eliminates much of the overhead of the database while
still providing a centralized repository for all the images. And 

Re: [PHP] OK to have many files in one folder?

2007-06-17 Thread Brian Dunning
For everyone who advised me to beware the inode, allow me to  
forward what the Rackspace admins told me. This is Greek to me, and  
I'm hoping one of you can translate. All I understood was where he  
said I appear to have more than enough. Yes?


---snip---

All of your slices on the disk are ext3. As this is the only file  
system that the Red Hat kernel provides support for.


[EMAIL PROTECTED] ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/hda5 ext3 227G 93G 123G 43% /
/dev/hda1 ext3 99M 12M 83M 12% /boot
none tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/hda2 ext3 2.0G 36M 1.9G 2% /tmp

As far as I am able to recall, there are only 2 limitations that you  
must be concerned with. There might be others, but these are the only  
ones I am aware of, which also appears to be true from the research I  
have done.


1. The number if i-nodes. You appear to have more than enough.

[EMAIL PROTECTED] ~]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/hda5 30130176 3729871 26400305 13% /
/dev/hda1 26104 46 26058 1% /boot
none 220613 1 220612 1% /dev/shm
/dev/hda2 262144 18 262126 1% /tmp

2. The subdirectory limitation for the ext3 file system. You can only  
have 32000 subdirectories with in any directory.


---/snip---

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



Re: [PHP] OK to have many files in one folder?

2007-06-17 Thread Tijnema

On 6/17/07, Brian Dunning [EMAIL PROTECTED] wrote:

For everyone who advised me to beware the inode, allow me to
forward what the Rackspace admins told me. This is Greek to me, and
I'm hoping one of you can translate. All I understood was where he
said I appear to have more than enough. Yes?

---snip---

All of your slices on the disk are ext3. As this is the only file
system that the Red Hat kernel provides support for.

[EMAIL PROTECTED] ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/hda5 ext3 227G 93G 123G 43% /
/dev/hda1 ext3 99M 12M 83M 12% /boot
none tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/hda2 ext3 2.0G 36M 1.9G 2% /tmp

As far as I am able to recall, there are only 2 limitations that you
must be concerned with. There might be others, but these are the only
ones I am aware of, which also appears to be true from the research I
have done.

1. The number if i-nodes. You appear to have more than enough.

[EMAIL PROTECTED] ~]# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/hda5 30130176 3729871 26400305 13% /
/dev/hda1 26104 46 26058 1% /boot
none 220613 1 220612 1% /dev/shm
/dev/hda2 262144 18 262126 1% /tmp

2. The subdirectory limitation for the ext3 file system. You can only
have 32000 subdirectories with in any directory.


Enough Inodes, and 32000 subdirectory's is quiet a lot, and definitly
not a problem if you place all files in one directory ;)
But, speed is a different story, so you might want to test how it
works when you store the files in a database, it might be faster...

Tijnema

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



[PHP] OK to have many files in one folder?

2007-06-15 Thread Brian Dunning
Server is running Linux, and PHP is constantly creating and modifying  
images in a directory. Apache is constantly serving these same  
images. There are about 250,000 of them in the same directory. Seems  
to be running OK, no problematic CPU load, but I'm wondering if  
anyone knows whether I'm living dangerously having that many docs in  
one directory with that much activity. It is an extremely busy server.


Sorry is this seems like more of a linux sysad question than a PHP  
question. Thanks...  :)


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



RE: [PHP] OK to have many files in one folder?

2007-06-15 Thread Jay Blanchard
[snip]
Server is running Linux, and PHP is constantly creating and modifying  
images in a directory. Apache is constantly serving these same  
images. There are about 250,000 of them in the same directory. Seems  
to be running OK, no problematic CPU load, but I'm wondering if  
anyone knows whether I'm living dangerously having that many docs in  
one directory with that much activity. It is an extremely busy server.

Sorry is this seems like more of a linux sysad question than a PHP  
question. Thanks...  :)
[/snip]

Two words. Beware the inode. 

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



Re: [PHP] OK to have many files in one folder?

2007-06-15 Thread Daniel Brown

6/15/07, Jay Blanchard [EMAIL PROTECTED] wrote:

[snip]
Server is running Linux, and PHP is constantly creating and modifying
images in a directory. Apache is constantly serving these same
images. There are about 250,000 of them in the same directory. Seems
to be running OK, no problematic CPU load, but I'm wondering if
anyone knows whether I'm living dangerously having that many docs in
one directory with that much activity. It is an extremely busy server.

Sorry is this seems like more of a linux sysad question than a PHP
question. Thanks...  :)
[/snip]

Two words. Beware the inode.

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




   If that directory is all on one single partition, God help you if
there's any corruption.  Check into RAID 0+1/RAID 5 disk striping if
you've got that many images.  And remember, the fact that they're all
in one directory doesn't matter at all to the system, as directories,
folders, et cetera, are just representations for human readability and
organization.  In fact, those files reside on several sectors
throughout the drive, and each file itself is probably fragmented many
times.

   Just for fun, though, if you want to crash your server, you could always do:
   `while [ 1 = 1 ]; do ls -l;done`

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] OK to have many files in one folder?

2007-06-15 Thread Crayon Shin Chan
On Saturday 16 June 2007 02:51, Daniel Brown wrote:

 And remember, the fact that they're all
 in one directory doesn't matter at all to the system, as directories,
 folders, et cetera, are just representations for human readability and
 organization.  In fact, those files reside on several sectors
 throughout the drive, and each file itself is probably fragmented many
 times.

Actually it does matter depending on the filesystem you use. If you're 
using ext2/ext3 then having several thousand files in a directory 
seriously slows things down.

-- 
Crayon

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



Re: [PHP] OK to have many files in one folder?

2007-06-15 Thread Brian Dunning
Thanks for the replies but I'm not sure I know what to do with them.  
Is the problem with the number of files, or is the problem with the  
activity? Can you dumb down your answers at all for me?  :)



On Jun 15, 2007, at 11:51 AM, Daniel Brown wrote:


6/15/07, Jay Blanchard [EMAIL PROTECTED] wrote:

[snip]
Server is running Linux, and PHP is constantly creating and modifying
images in a directory. Apache is constantly serving these same
images. There are about 250,000 of them in the same directory. Seems
to be running OK, no problematic CPU load, but I'm wondering if
anyone knows whether I'm living dangerously having that many docs in
one directory with that much activity. It is an extremely busy  
server.


Sorry is this seems like more of a linux sysad question than a PHP
question. Thanks...  :)
[/snip]

Two words. Beware the inode.

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




   If that directory is all on one single partition, God help you if
there's any corruption.  Check into RAID 0+1/RAID 5 disk striping if
you've got that many images.  And remember, the fact that they're all
in one directory doesn't matter at all to the system, as directories,
folders, et cetera, are just representations for human readability and
organization.  In fact, those files reside on several sectors
throughout the drive, and each file itself is probably fragmented many
times.

   Just for fun, though, if you want to crash your server, you  
could always do:

   `while [ 1 = 1 ]; do ls -l;done`

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
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] OK to have many files in one folder?

2007-06-15 Thread Daniel Brown

On 6/15/07, Crayon Shin Chan [EMAIL PROTECTED] wrote:

On Saturday 16 June 2007 02:51, Daniel Brown wrote:

 And remember, the fact that they're all
 in one directory doesn't matter at all to the system, as directories,
 folders, et cetera, are just representations for human readability and
 organization.  In fact, those files reside on several sectors
 throughout the drive, and each file itself is probably fragmented many
 times.

Actually it does matter depending on the filesystem you use. If you're
using ext2/ext3 then having several thousand files in a directory
seriously slows things down.

--
Crayon

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




   Once again, this doesn't matter so much for per-directory (though
listing will take longer, as I think I mentioned) as it does the
filesystem mount.  The ext2/ext3 filesystems were made for these
reasons, especially with journaling like ReiserFS, XFS, et cetera
(which is a completely different bag of nuts).

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] OK to have many files in one folder?

2007-06-15 Thread Brian Dunning
I can easily break it up into 100 subdirectories, 2500 files in each,  
would that be good insurance against problems?


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



RE: [PHP] OK to have many files in one folder?

2007-06-15 Thread Jay Blanchard
[snip]
I can easily break it up into 100 subdirectories, 2500 files in each,  
would that be good insurance against problems?
[/snip]

As someone mentioned, directories are just a human convenience. Each
file will have an inode and is identified by an inode number in the file
system where it resides. Inodes store information on files such as user
and group ownership, access mode (read, write, execute permissions) and
type of file. There is a fixed number of inodes, which indicates the
maximum number of files each filesystem can hold. Hence, beware the
inode.

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



Re: [PHP] OK to have many files in one folder?

2007-06-15 Thread Tijnema

On 6/15/07, Brian Dunning [EMAIL PROTECTED] wrote:

I can easily break it up into 100 subdirectories, 2500 files in each,
would that be good insurance against problems?



I have no clue how big the files are, but you might want to store them
in a database. That can speed up things, but don't ask me how much ;)

Tijnema

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



Re: [PHP] OK to have many files in one folder?

2007-06-15 Thread Daniel Brown

On 6/15/07, Brian Dunning [EMAIL PROTECTED] wrote:

Thanks for the replies but I'm not sure I know what to do with them.
Is the problem with the number of files, or is the problem with the
activity? Can you dumb down your answers at all for me?  :)


On Jun 15, 2007, at 11:51 AM, Daniel Brown wrote:

 6/15/07, Jay Blanchard [EMAIL PROTECTED] wrote:
 [snip]
 Server is running Linux, and PHP is constantly creating and modifying
 images in a directory. Apache is constantly serving these same
 images. There are about 250,000 of them in the same directory. Seems
 to be running OK, no problematic CPU load, but I'm wondering if
 anyone knows whether I'm living dangerously having that many docs in
 one directory with that much activity. It is an extremely busy
 server.

 Sorry is this seems like more of a linux sysad question than a PHP
 question. Thanks...  :)
 [/snip]

 Two words. Beware the inode.

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



If that directory is all on one single partition, God help you if
 there's any corruption.  Check into RAID 0+1/RAID 5 disk striping if
 you've got that many images.  And remember, the fact that they're all
 in one directory doesn't matter at all to the system, as directories,
 folders, et cetera, are just representations for human readability and
 organization.  In fact, those files reside on several sectors
 throughout the drive, and each file itself is probably fragmented many
 times.

Just for fun, though, if you want to crash your server, you
 could always do:
`while [ 1 = 1 ]; do ls -l;done`

 --
 Daniel P. Brown
 [office] (570-) 587-7080 Ext. 272
 [mobile] (570-) 766-8107

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




   Brian,

   I stand behind my suggestion, though I also suggest you take
whatever everyone else says into consideration just as much as me.  I
have well over a decade of experience, but I'll be the first to admit
that sometimes a teenage computer geek is more correct than I am.

   Yes, list, believe it or not, I'm not always correct.  I'm just
going to let that sink in a little bit.

   Okay, now that everyone is done laughing at me (well, mostly
everyone), let's get on with it.

   I still think it's best to split the files across a RAID.  Ask
your datacenter to discuss the pros and cons of both RAID 0+1 and RAID
5 with you, and research it on the web.  It would be better to split
the files into different directories, as well, but *probably* is not
necessary.  Take that as you will.

   That said, one way of doing it that is very common is to create a
minimum of 36 directories, from 0 - 9 and a - z.  Each directory
should contain only files where the first character is the same as the
directory within which it resides.  However, if you have a specific
character that comes up much more frequently than others, or even all
the time, this won't work, of course.

   The point is, in my experience, holding even a terabyte of data in
smaller files within one directory is not a Bad Thing [tm], per se.
I've administered MySQL databases on servers that were in the
two-to-three terabyte range, and one of which had well over 3,000
separate tables.  Each of those tables is three separate files
(minimum) on disk, mind you: table.frm, table.MYD, table.MYI.  Also,
keep in mind that I didn't create the database structure, but was
instead hired to ensure that it ran smoothly.  In the four months and
n-million queries that were run on it while it was in use, the server
responded as if it were a standard 50MB database in under a dozen
files (if memory serves, it was a Dual Xeon 2.6GHz with 4GB RAM) and
only used for MySQL).  After the project was completed, however, we
did upgrade the systems to a distributed network for further
expansion, but I think you get the point there.

   Bottom line, however, is that just because you're not experiencing
problems now doesn't mean you won't soon in the future.  Seriously
consider, with that many separate files and that much data, how much
it's worth to you in the long run, and if a RAID setup and
directory-splitting is a Good Thing [tm] for your situation.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] OK to have many files in one folder?

2007-06-15 Thread Daniel Brown

On 6/15/07, Jay Blanchard [EMAIL PROTECTED] wrote:

[snip]
I can easily break it up into 100 subdirectories, 2500 files in each,
would that be good insurance against problems?
[/snip]

As someone mentioned, directories are just a human convenience. Each
file will have an inode and is identified by an inode number in the file
system where it resides. Inodes store information on files such as user
and group ownership, access mode (read, write, execute permissions) and
type of file. There is a fixed number of inodes, which indicates the
maximum number of files each filesystem can hold. Hence, beware the
inode.

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




   Perfect, Jay.  That's something I forgot to mention.  Also, keep
in mind that, while there are file byte size limits (4GB, 8GB, etc.),
directories are NOT limited in byte size.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



Re: [PHP] OK to have many files in one folder?

2007-06-15 Thread Satyam
Since it depends on many factors, some out of your control, some others that 
might vary over the lifetime of the application, one thing you might do, to 
be on the safe side is try to put files in different directories, for 
example, by breaking up their filenames every three characters and making 
each segment a folder but no more than three levels deep so that the file 
./abcdefghijkl.jpg would be located at ./abc/def/ghijkl.jpg.  This breakup 
would allow even to mount extra disk volumes for some of the folders, should 
they exceed certain capacity or to split the risk.  Whether to break 
filenames every two, three or more characters might be a matter of 
optimization, but I would guess that around three (or four) for the first 
two segments and whatever is left for the filename would be a reasonable 
number.  I wouldn't go more than three levels deep either, because jumping 
from one directory level to the next also takes some time, thus it is a 
compromise in between searching sequentially in a directory for a filename 
(for those filesystems that do so) and going deep into the directory tree.


Satyam



- Original Message - 
From: Brian Dunning [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Friday, June 15, 2007 9:38 PM
Subject: Re: [PHP] OK to have many files in one folder?


Thanks for the replies but I'm not sure I know what to do with them.  Is 
the problem with the number of files, or is the problem with the 
activity? Can you dumb down your answers at all for me?  :)



On Jun 15, 2007, at 11:51 AM, Daniel Brown wrote:


6/15/07, Jay Blanchard [EMAIL PROTECTED] wrote:

[snip]
Server is running Linux, and PHP is constantly creating and modifying
images in a directory. Apache is constantly serving these same
images. There are about 250,000 of them in the same directory. Seems
to be running OK, no problematic CPU load, but I'm wondering if
anyone knows whether I'm living dangerously having that many docs in
one directory with that much activity. It is an extremely busy  server.

Sorry is this seems like more of a linux sysad question than a PHP
question. Thanks...  :)
[/snip]

Two words. Beware the inode.

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




   If that directory is all on one single partition, God help you if
there's any corruption.  Check into RAID 0+1/RAID 5 disk striping if
you've got that many images.  And remember, the fact that they're all
in one directory doesn't matter at all to the system, as directories,
folders, et cetera, are just representations for human readability and
organization.  In fact, those files reside on several sectors
throughout the drive, and each file itself is probably fragmented many
times.

   Just for fun, though, if you want to crash your server, you  could 
always do:

   `while [ 1 = 1 ]; do ls -l;done`

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

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



--
No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.472 / Virus Database: 
269.8.16/849 - Release Date: 14/06/2007 12:44





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



Re: [PHP] OK to have many files in one folder?

2007-06-15 Thread Crayon Shin Chan
On Saturday 16 June 2007 03:47, Daniel Brown wrote:

 Once again, this doesn't matter so much for per-directory (though
 listing will take longer, as I think I mentioned) as it does the
 filesystem mount. 

Several years ago, having say 3000+ files in single directory on ext2 
would mean that a simple 'ls -al' takes several orders of magnitude 
longer to perform than on a directory with just several hundred files. As 
I haven't used ext2/3 for ages I don't know whether the same is still 
true today.

 The ext2/ext3 filesystems were made for these 
 reasons, especially with journaling like ReiserFS, XFS, et cetera
 (which is a completely different bag of nuts).

Not sure what point you're trying to make here, but, of the common 
filesystems for linux, ext2/3 is the absolute slowest (by far) when you 
have a large number of files in a directory.

-- 
Crayon

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



Re: [PHP] OK to have many files in one folder?

2007-06-15 Thread Stut

Jay Blanchard wrote:

[snip]
Server is running Linux, and PHP is constantly creating and modifying  
images in a directory. Apache is constantly serving these same  
images. There are about 250,000 of them in the same directory. Seems  
to be running OK, no problematic CPU load, but I'm wondering if  
anyone knows whether I'm living dangerously having that many docs in  
one directory with that much activity. It is an extremely busy server.


Sorry is this seems like more of a linux sysad question than a PHP  
question. Thanks...  :)

[/snip]

Two words. Beware the inode. 

 ^^ ^^^ ^
   1 23

Here endeth the lesson.

-Stut

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



RE: [PHP] OK to have many files in one folder?

2007-06-15 Thread Jay Blanchard
[snip]
 Two words. Beware the inode. 
  ^^ ^^^ ^
1 23

Here endeth the lesson.
[/snip]

Can I get an Admin brotha'!?

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



[PHP] Ok next php problem

2006-06-18 Thread Rob W.
I got the previous question answered, Now here's my next problem.

With the numbers displaying correctly again I got:

1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
18
19
20
21
22
25

listed in that order in the database

Now i'm trying to figure out how to write a syntax saying that if like number 8 
isnt listed, display it.

I've tried doing a 

if ($count != $data) {
  echo $data;
}
$count++;

But when I get to like id number 9 it dont work right because the next entrie 
is displayed as 10 in the db. So that's my problem is to try and display only 
them numbers that are not in there. I have also tried putting the numbers in to 
an array and matching from there but it still come's up as the same as above.

- Rob


Re: [PHP] Ok next php problem

2006-06-18 Thread Chris

Rob W. wrote:

I got the previous question answered, Now here's my next problem.

With the numbers displaying correctly again I got:

1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
18
19
20
21
22
25

listed in that order in the database

Now i'm trying to figure out how to write a syntax saying that if like number 8 
isnt listed, display it.


Get them both into arrays and compare:

$good_list = range(1,10);
$db_list = array(4,7,10);

$missing = array_diff($good_list, $db_list);

http://php.net/array_diff

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Ok next php problem

2006-06-18 Thread Rob W.
Ok but my problem is is that in the process of doing that, numbers can be 
released so they pretty much haft to be dynamic. Any idea how I do it with 
that.


IE:

1
2
3
6
9
10
...

So if them numbers change, which they can, because they are assigned port 
numbers for servers, How do I make it so they are not scripted statically.



- Original Message - 
From: Chris [EMAIL PROTECTED]

To: Rob W. [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Sunday, June 18, 2006 8:38 PM
Subject: Re: [PHP] Ok next php problem



Rob W. wrote:

I got the previous question answered, Now here's my next problem.

With the numbers displaying correctly again I got:

1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
18
19
20
21
22
25

listed in that order in the database

Now i'm trying to figure out how to write a syntax saying that if like 
number 8 isnt listed, display it.


Get them both into arrays and compare:

$good_list = range(1,10);
$db_list = array(4,7,10);

$missing = array_diff($good_list, $db_list);

http://php.net/array_diff

--
Postgresql  php tutorials
http://www.designmagick.com/




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



Re: [PHP] Ok next php problem

2006-06-18 Thread tedd
At 7:21 PM -0500 6/18/06, Rob W. wrote:
I got the previous question answered, Now here's my next problem.

With the numbers displaying correctly again I got:

1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
18
19
20
21
22
25

listed in that order in the database

Now i'm trying to figure out how to write a syntax saying that if like number 
8 isnt listed, display it.

I've tried doing a

if ($count != $data) {
  echo $data;
}
$count++;

But when I get to like id number 9 it dont work right because the next entrie 
is displayed as 10 in the db. So that's my problem is to try and display only 
them numbers that are not in there. I have also tried putting the numbers in 
to an array and matching from there but it still come's up as the same as 
above.

- Rob

Rob:

Why?

If you want to show the number of records in your dB, then just show them. If 
you want a counter, then add a counter but don't list the id number. Besides, 
why would you want to anyway?

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] Ok next php problem

2006-06-18 Thread Chris

Rob W. wrote:
Ok but my problem is is that in the process of doing that, numbers can 
be released so they pretty much haft to be dynamic. Any idea how I do it 
with that.


IE:

1
2
3
6
9
10
...

So if them numbers change, which they can, because they are assigned 
port numbers for servers, How do I make it so they are not scripted 
statically.


That was an example only.

See my next reply for an example of how to get the port from the db and 
go from there.


Since we don't know your db structure, table names, field names I made 
it generic and you'll have to modify to suit your needs.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] GD text proc via php OK for local strings, but NOT for SESSION-passed strings. why?

2006-04-29 Thread Richard Lynch
On Fri, April 28, 2006 4:54 pm, OpenMacNews wrote:
 -BEGIN PGP SIGNED MESSAGE-
 in a given php file, this returns an image as expected:

   ...
   $word=blah;
   imagefttext($im, ... other params ... , $word);
   ...
   header (Content-type: image/png);
   imagepng($im);
   ...

 however, if rather than defining $word locally in the script, i

   $_SESSION['test']=blah;

 elsewhere, then:

   $word=$_SESSION['test']=blah;
   imagefttext($im, ... other params ... , $word);
   imagepng($im);

 i simply get a blank image.  NO error in either the browser or my
 apache
 logs.

 a simple test with:

   echo $word;

 outputs

   blah

 as expected; i.e, the _SESSION var *is* passed.

 QUESTION: what's different about the string passed via SESSION?

Just for fun, try it with imagestring.

And, really, show us the image creation and whatnot.

You've trimmed so much out, and we're going to have to second-guess
you and think you just messed up creating the image in the second
script, or that you got the arguments to the imagefttext() wrong,
which is easy to do, since there are so many paramters on those image
functions.

And the bits you've trimmed out wouldn't make your post THAT much
longer.  A handful of lines more, if you keep it to a minimum.

TIP:
I always copy and paste the prototype line from the reference manual
as a comment the line before my call to those image functions with
many arguments -- Then I can better track what I'm typing.

Yeah, those fancy IDEs can help too, but I'm an old-school vi kind of
guy -- The IDEs with all the bells and whistles just get in my way
more than they help.

It's pretty hard to see how the string coming from the SESSION could
matter...

Though there WAS one RC version where, as I recall, SESSION strings
were being passed out as, errr, references to strings, even though no
such beast actually exists in PHP User Land...

Altering the string would also alter the session data, which was very
disconcerting.

I don't see how that would apply here, mind you, but you could try this:

$word = '';
$word .= $_SESSION['test'];

The point being that by appending to an existing string, you can be
sure it's a fresh string, and not a reference to the string.

The bug I refer to was easily spotted by doing a var_dump on the data
string.  It showed  string rather than just string, as I recall.
(Or maybe it was string )

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] GD text proc via php OK for local strings, but NOT for SESSION-passed strings. why?

2006-04-28 Thread OpenMacNews
-BEGIN PGP SIGNED MESSAGE-
Hash: RIPEMD160


hi all,

php-5.1.2 built from src on OSX 10.4.6.

GD-2.0.33 + libpng-1.2.10 are built/enabled.

GD is working fine ... locally.

in a given php file, this returns an image as expected:

...
$word=blah;
imagefttext($im, ... other params ... , $word);
...
header (Content-type: image/png);
imagepng($im);
...

however, if rather than defining $word locally in the script, i

$_SESSION['test']=blah;

elsewhere, then:

$word=$_SESSION['test']=blah;
imagefttext($im, ... other params ... , $word);
imagepng($im);

i simply get a blank image.  NO error in either the browser or my apache
logs.

a simple test with:

echo $word;

outputs

blah

as expected; i.e, the _SESSION var *is* passed.

QUESTION: what's different about the string passed via SESSION?

thx!

richard

- --

/\
\ /  ASCII Ribbon Campaign
 X   against HTML email, vCards
/ \   micro$oft attachments

[GPG] OpenMacNews at gmail dot com
fingerprint: 50C9 1C46 2F8F DE42 2EDB  D460 95F7 DDBD 3671 08C6
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.3 (Darwin)

iEYEAREDAAYFAkRSjyEACgkQlffdvTZxCMZz/ACgvI60Zm6JfUDnczpOl3gpNLjj
ObMAoLOobf7h7CGuD6dX7Rz2KRV/9vsf
=Znuf
-END PGP SIGNATURE-

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



Re: [PHP] Ok, why is this happening...

2005-07-22 Thread Richard Lynch
On Tue, July 19, 2005 10:26 am, John Nichel said:

 There's some freaky math going on there or something.  I added a couple
 of other echos in to see and for some reason it seems to be losing
 single digit value (subtracting, rounding down, I don't know).

 $calculatedGross  = $originalNet + ( $originalNet * $commissionPct * 0.01
 );

 echo ( Gross :  . (int)$calculatedGross . = . $originalNet . + ( .
 $originalNet . * . $commissionPct . *.01 )br /\n );

 $calculatedNet= $calculatedGross / ( 1 + ( $commissionPct * 0.01 ));

 echo ( Net :  . (int)$calculatedNet. =  . (int)$calculatedGross . 
 / ( 1 + (  . $commissionPct .  * .01 ) )br /\n );

Floating point mathematics is inherently unreliable in computers.

Consider, for example, 1/3 in decimal notation:

1.33...

PHP can only write so many digits down in a 32-bit floating point
representation, just as you can only write down so many digits before your
hand cramps up or you run out of paper or you get lazy and put ... on
the end. :-)

Now, the thing to remember is, the problem won't appear where you expect
it to from your experience with DECIMAL numbers all your life because
floating point numbers are being stored in a binary/hexidecimal notation.

If you are feeling particularly masochistic, you can Google for floating
point internal representation mantissa exponent and you're gonna find out
EXACTLY how those numbers get stored.  Set aside a good chunk of time to
absorb it all... :-)

Even something as simple as:

?php
  $foo = (float) 2;
  echo $foo;
?
could, in theory, print out something like:
1.
and be correct as far as Computer Science is concerned.

If you need PRECISE mathematics, you should use integer and count pennies
instead of dollars -- or even 1/10th of pennies or whatever resolution you
need.

Of course, every step you take on the right, you can only store 1/10th as
large a number of dollars as your maximum amount.  But you are starting
with 2 billion as your max, so that's a lot of room to play with.

If you *need* float numbers and precision out to decimal point N, look
into BC_MATH and that new-fangled Math package PHP has for this very
reason. You'll still be dealing with this issue, but you'll know your
numbers are accurate to the Nth decimal point, and it will be painfully
obvious in your code that it is so.  [It will also be SLOWER than just
plain float numbers.]

If you just don't care about the damn penny, but want your code to work,
something like:

if (1.00 = $x  $x = 1.01){
  // $x == 1, really
}
may suffice for your everyday work-a-day computing needs...

Though that can also turn into a lot more problems than you think, down
the line...

Remember 2nd Grade when long division was tricky?  Yeah, well, computers
are a hell of a lot more stupid than 2nd Graders, any day of the week.

Note that there *ARE* computer languages where are prefectly happy to work
in fractions (Lisp is one such language) because somebody has programmed
the algebraic rules of fraction arithmetic into the language:
(let ((x 1/3)
  (y 2/3))
  (print (+ x y))
will cheefully and with 100% accuracy print out 1 every single time.
[Apologies to Guy Steele if my 10-years-unused Lisp syntax is not spot on.]

Lisp stores fractions as 2 integers, not as floating point numbers.
[Though of course you can ask it to convert and round off if you like.]

You could, if you so desired, whip up a PHP class fraction { code-base,
or even just store fractions as 2-element arrays (numerator, denominator)
and write some procedural functions to work with them.

It's not exactly Rocket Science to do that.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Ok, why is this happening...

2005-07-19 Thread Chris Boget
Consider the following test script:

script language=php

  set_time_limit( 0 );

  echo 'html';
  echo 'headtitleTest Rounding Net Premium/title/head';
  echo 'body';

  echo 'Running test...br';
  flush();

  echo 'table';

  echo 'tr';
echo 'tdOriginal Net/td';
echo 'tdCommission %/td';
echo 'tdCalculated Gross/td';
echo 'tdCalculated Net/td';
  echo '/tr';

  $numberOfFailures = 0;
  for( $originalNet = 1; $originalNet = 10005; $originalNet++ ) {
for( $commissionPct = 1; $commissionPct = 20; ( $commissionPct += .1 ))
{
  $calculatedGross  = $originalNet + ( $originalNet * $commissionPct *
.01 );
  $calculatedNet= $calculatedGross / ( 1 + ( $commissionPct *
.01 ));

echo if( $originalNet != $calculatedNet ) =  . ( (int)$originalNet !==
(int)$calculatedNet ) . br\n;
  if( (int)$originalNet !== (int)$calculatedNet ) {
$numberOfFailures++;

echo 'tr';
  echo 'td' . $originalNet . '/td';
  echo 'td' . $commissionPct   . '%/td';
  echo 'td' . $calculatedGross . '/td';
  echo 'td' . $calculatedNet   . '/td';
echo '/tr';

flush();

  }
}
  }
  echo '/table';

  if( 0  $numberOfFailures ) {
echo number_format( $numberOfFailures ) . ' calculations failed to match
the original net premium.br';

  }
  echo '/body';
  echo '/html';

/script

Why is the if( (int)$originalNet !== (int)$calculatedNet ) failing some
times even though they are the exact same value?  I've tried using just
the != comparison operator, I've tried casting the values (as seen above)
I've tried testing to see if the values are either less than or greater than
one another (as a test for inequality).  I just can't figure out why in the
world the IF is showing the values are inequal when you can view the
output and see they are exactly equal.  What's going on?

thnx,
Chris

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



Re: [PHP] Ok, why is this happening...

2005-07-19 Thread John Nichel

Chris Boget wrote:
snip

echo if( $originalNet != $calculatedNet ) =  . ( (int)$originalNet !==
(int)$calculatedNet ) . br\n;

/snip

Change this to echo out what you're comparing...

echo if( . (int)$originalNet . != . (int)$calculatedNet . ) =  . ( 
(int)$originalNet !== (int)$calculatedNet ) . br\n;


That'll show what numbers is actually trying to match.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Ok, why is this happening...

2005-07-19 Thread Chris Boget
 Chris Boget wrote:
 snip
  echo if( $originalNet != $calculatedNet ) =  . ( (int)$originalNet !==
  (int)$calculatedNet ) . br\n;
 /snip
 Change this to echo out what you're comparing...
 echo if( . (int)$originalNet . != . (int)$calculatedNet . ) =  . (
 (int)$originalNet !== (int)$calculatedNet ) . br\n;
 That'll show what numbers is actually trying to match.

Ok, then that begs the following questions:

If I don't cast any of the values, why do they display as being identicle?
Additionally, why does every IF check fail in that case?

thnx,
Chris

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



Re: [PHP] Ok, why is this happening...

2005-07-19 Thread John Nichel

Chris Boget wrote:

Chris Boget wrote:
snip


echo if( $originalNet != $calculatedNet ) =  . ( (int)$originalNet !==
(int)$calculatedNet ) . br\n;


/snip
Change this to echo out what you're comparing...
echo if( . (int)$originalNet . != . (int)$calculatedNet . ) =  . (
(int)$originalNet !== (int)$calculatedNet ) . br\n;
That'll show what numbers is actually trying to match.



Ok, then that begs the following questions:

If I don't cast any of the values, why do they display as being identicle?
Additionally, why does every IF check fail in that case?


There's some freaky math going on there or something.  I added a couple 
of other echos in to see and for some reason it seems to be losing 
single digit value (subtracting, rounding down, I don't know).


$calculatedGross  = $originalNet + ( $originalNet * $commissionPct * 0.01 );

echo ( Gross :  . (int)$calculatedGross . = . $originalNet . + ( .
$originalNet . * . $commissionPct . *.01 )br /\n );

$calculatedNet= $calculatedGross / ( 1 + ( $commissionPct * 0.01 ));

echo ( Net :  . (int)$calculatedNet. =  . (int)$calculatedGross .  
/ ( 1 + (  . $commissionPct .  * .01 ) )br /\n );


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Ok, why is this happening...

2005-07-19 Thread Andy Pieters
Hi 

I admit not gone trough all of your code, but mostly this happens when mixing 
the string concatenation operator (.) with the addition (+) or substraction 
(-) operator.

HTH

With kind regards

Andy

On Tuesday 19 July 2005 19:26, John Nichel wrote:
 Chris Boget wrote:
 Chris Boget wrote:
 snip
 
 echo if( $originalNet != $calculatedNet ) =  . ( (int)$originalNet !==
 (int)$calculatedNet ) . br\n;
 
 /snip
 Change this to echo out what you're comparing...
 echo if( . (int)$originalNet . != . (int)$calculatedNet . ) =  . (
 (int)$originalNet !== (int)$calculatedNet ) . br\n;
 That'll show what numbers is actually trying to match.
 
  Ok, then that begs the following questions:
 
  If I don't cast any of the values, why do they display as being
  identicle? Additionally, why does every IF check fail in that case?

 There's some freaky math going on there or something.  I added a couple
 of other echos in to see and for some reason it seems to be losing
 single digit value (subtracting, rounding down, I don't know).

 $calculatedGross  = $originalNet + ( $originalNet * $commissionPct * 0.01
 );

 echo ( Gross :  . (int)$calculatedGross . = . $originalNet . + ( .
 $originalNet . * . $commissionPct . *.01 )br /\n );

 $calculatedNet= $calculatedGross / ( 1 + ( $commissionPct * 0.01 ));

 echo ( Net :  . (int)$calculatedNet. =  . (int)$calculatedGross . 
 / ( 1 + (  . $commissionPct .  * .01 ) )br /\n );

 --
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED]

-- 
Registered Linux User Number 379093
   Cockroaches and socialites are the only things that can 
   stay up all night and eat anything.
Herb Caen
--
-- --BEGIN GEEK CODE BLOCK-
Version: 3.1
GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++
L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e$@ h++(*) r--++ y--()
-- ---END GEEK CODE BLOCK--
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--


pgptzLlv5o2r7.pgp
Description: PGP signature


RE: [PHP] OK ... WHY does this work ?????

2004-09-15 Thread Gryffyn, Trevor
Read over some of the examples at:
http://us4.php.net/types.array

If you don't set a key, PHP starts with '0' and increments as you add
more elements to the array.

If you have NOTICEs turned on, I believe you'll get a notice saying
that $arrlevels[99] doesn't exist.  It's not a fatal error, so PHP just
passes over it and doesn't say anything unless you tell it to.

# One dimensional array
$arrlevels = array(1,2,3);

# Three dimensional array.  $lvl_guest is a key and 'levelname' is a key
$arrlevels[$lvl_guest]['levelname'];

-TG

 On Tue, 14 Sep 2004 22:32:54 +0200, -{ Rene Brehmer }-
 [EMAIL PROTECTED] wrote:
  Unless I misunderstand how PHP make unspecified arrays (and 
 I probably do
  since this works), when you have an array of 3 elements on the first
  dimenstion like I do, and then ask for 
 $arrlevels[$lvl_guest]['levelname'],
  which in this case actually means it asks for 
 $arrlevels[99]['levelname']
   how come it pick the correct element, and not error 
 out that element
  99 don't exist ??
  
  My only conclusion (based on the fact that this actually 
 works) is that PHP
  makes the key the same as the value if the key isn't 
 specified. But is this
  actually correct  Or is there something going on that 
 I don't know
  about ???

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



[PHP] OK ... WHY does this work ?????

2004-09-14 Thread -{ Rene Brehmer }-
This is some experimental code I did to try and find a way to recycle the 
same query multiple times as efficient as possible. With the purpose of 
efficiently comparing the results of 2 queries where the resultset from 
both queries won't match in the size (in this sample test it coincidently 
does, but I've tried with a variant where it doesn't, and it works just as 
beautiful). Although it's nice that it actually works like intended, I'm a 
little baffled to exactly WHY it works (this being why the 2 dimensional 
array I build actually works like intended). I tried looking through the 
manual to find how PHP build the associate arrays when no key is specified, 
but came out empty. So if anyone can explain how this come to function like 
intended despite immediate logic dictating it shouldn't, I'd really 
appreciate it ... I hate when I get the code to work, but don't get why it 
works...

This is the code (pieced together from much larger script ... that does 
lots more than this in between:

?php
// global data pull of base configuration
$config_query = SELECT setting,value FROM hf_config;
$config = mysql_query($config_query) or die('Unable to get base 
configurationbr'.mysql_error());

while ($config_data = mysql_fetch_array($config)) {
  if ($config_data['setting'] == 'admin_level') {
$lvl_admin = $config_data['value'];
  } elseif ($config_data['setting'] == 'new_member_level') {
$lvl_new = $config_data['value'];
  } elseif ($config_data['setting'] == 'guest_level') {
$lvl_guest = $config_data['value'];
  }
}
// load levels and build array
$level_query = SELECT levelID,levelname,description FROM hf_levels ORDER 
BY `levelorder` ASC;
$levels = mysql_query($level_query);
while ($leveldata = mysql_fetch_array($levels)) {
  $arrlevels[$leveldata['levelID']] = array('levelname' = 
$leveldata['levelname'],
'description' = $leveldata['description']);
}
?

table
  tr
td colspan=3 class=adm_titleGeneral configuration/td
  /trtr
td class=adm_subtitleAdministrator level/td
td class=adm_regular?php echo($lvl_admin.' - 
'.$arrlevels[$lvl_admin]['levelname']); ?/td
td/td
  /trtr
td class=adm_subtitleNew member level/td
td class=adm_regular?php echo($lvl_new.' - 
'.$arrlevels[$lvl_new]['levelname']); ?/td
  /trtr
td class=adm_subtitleGuest level/td
td class=adm_regular?php echo($lvl_guest.' - 
'.$arrlevels[$lvl_guest]['levelname']); ?/td
  /tr
/table

The query results look like this:
mysql SELECT setting,value FROM hf_config;
+--+---+
| setting  | value |
+--+---+
| admin_level  | 1 |
| new_member_level | 50|
| guest_level  | 99|
+--+---+
3 rows in set (0.00 sec)
mysql SELECT levelID,levelname,description FROM hf_levels ORDER BY 
`levelorder`
 ASC;
+-++---+
| levelID | levelname  | description   |
+-++---+
|   1 | Admin  | System administrators |
|  50 | New member | new members   |
|  99 | Guest  | Guest users   |
+-++---+
3 rows in set (0.00 sec)

Output of the script looks like this:
General configuration
Administrator level 1 - Admin
New member level 50 - New member
Guest level 99 - Guest
Unless I misunderstand how PHP make unspecified arrays (and I probably do 
since this works), when you have an array of 3 elements on the first 
dimenstion like I do, and then ask for $arrlevels[$lvl_guest]['levelname'], 
which in this case actually means it asks for $arrlevels[99]['levelname'] 
 how come it pick the correct element, and not error out that element 
99 don't exist ??

My only conclusion (based on the fact that this actually works) is that PHP 
makes the key the same as the value if the key isn't specified. But is this 
actually correct  Or is there something going on that I don't know 
about ???

I've got another sample, that uses the same query recycling method, but 
with much, much more complex database queries, and it works just as 
perfectly well

I really just wanna understand why this actually work, and how ... it can 
be rather confusing to stumble across a useful functionality and solution 
when you're still learning how to do the more complex things in PHP.
--
Rene Brehmer
aka Metalbunny

If your life was a dream, would you wake up from a nightmare, dripping of 
sweat, hoping it was over? Or would you wake up happy and pleased, ready to 
take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OK ... WHY does this work ?????

2004-09-14 Thread Greg Donald
On Tue, 14 Sep 2004 22:32:54 +0200, -{ Rene Brehmer }-
[EMAIL PROTECTED] wrote:
 Unless I misunderstand how PHP make unspecified arrays (and I probably do
 since this works), when you have an array of 3 elements on the first
 dimenstion like I do, and then ask for $arrlevels[$lvl_guest]['levelname'],
 which in this case actually means it asks for $arrlevels[99]['levelname']
  how come it pick the correct element, and not error out that element
 99 don't exist ??
 
 My only conclusion (based on the fact that this actually works) is that PHP
 makes the key the same as the value if the key isn't specified. But is this
 actually correct  Or is there something going on that I don't know
 about ???

Yes, that is what's happening, a simple test shows this:

#!/usr/bin/php
?php
$a = array(1, 2, 3);
print_r($a);
?

output:
Array
(
[0] = 1
[1] = 2
[2] = 3
)


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] OK SQL experts...

2004-04-25 Thread Daniel Clark
I think you want to remove the single quotes around the field names.

SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%' OR 
field_2 LIKE '%$keyword%' OR field_3 LIKE '%$keyword%') AND 
status = 'active';


I STFW and RTFM and I still can't figure out why this returns a 1064 
parse error:

SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';

Anyone? TIA!

- B1ff Lamer

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



Re: [PHP] OK SQL experts...

2004-04-25 Thread Daniel Clark
The parenthesis are OK.   The query might take a long time to run with 3 LIKE 
statements.


Backticks, single quotes, or nothing at all makes no difference. I 
believe the parsing error is due to my parentheses or AND/OR structure. 
Any thoughts on that?



On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

 From: Brian Dunning [EMAIL PROTECTED]

 I STFW and RTFM and I still can't figure out why this returns a 1064
 parse error:

 SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
 'status' = 'active';




[PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
I STFW and RTFM and I still can't figure out why this returns a 1064 
parse error:

SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';

Anyone? TIA!

- B1ff Lamer

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


RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
why are the table and field names surrounded by single quotes?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP] OK SQL experts...


I STFW and RTFM and I still can't figure out why this returns a 1064 
parse error:

SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';

Anyone? TIA!

- B1ff Lamer

-- 
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] OK SQL experts...

2004-04-23 Thread Brian Dunning
I tried it both ways - didn't make any difference (phpmyadmin adds the 
single quotes when I was trying to use its sql function to debug, so I 
figured what the hell)...

On Apr 23, 2004, at 8:27 AM, Edward Peloke wrote:

why are the table and field names surrounded by single quotes?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP] OK SQL experts...
I STFW and RTFM and I still can't figure out why this returns a 1064
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
'status' = 'active';
Anyone? TIA!

- B1ff Lamer

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


- Brian

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


RE: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip]
I tried it both ways - didn't make any difference (phpmyadmin adds the 
single quotes when I was trying to use its sql function to debug, so I 
figured what the hell)...
[/snip]

Those aren't single quotes it adds to table and column names...those are
back tics (on the same key as the tilde) If you chnage those you should
be OK.

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



RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
does it just return the error when running in the php page?  If you pull it
out can you run it in mysql without errors?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:23 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...


I tried it both ways - didn't make any difference (phpmyadmin adds the
single quotes when I was trying to use its sql function to debug, so I
figured what the hell)...


On Apr 23, 2004, at 8:27 AM, Edward Peloke wrote:

 why are the table and field names surrounded by single quotes?

 -Original Message-
 From: Brian Dunning [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 23, 2004 11:19 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] OK SQL experts...


 I STFW and RTFM and I still can't figure out why this returns a 1064
 parse error:

 SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
 'status' = 'active';

 Anyone? TIA!

 - B1ff Lamer

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



- Brian

--
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] OK SQL experts...

2004-04-23 Thread Brian Dunning
It gives the same error when I run it in phpmyadmin.

On Apr 23, 2004, at 8:34 AM, Edward Peloke wrote:

does it just return the error when running in the php page?  If you 
pull it
out can you run it in mysql without errors?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:23 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...
I tried it both ways - didn't make any difference (phpmyadmin adds the
single quotes when I was trying to use its sql function to debug, so I
figured what the hell)...
On Apr 23, 2004, at 8:27 AM, Edward Peloke wrote:

why are the table and field names surrounded by single quotes?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:19 AM
To: [EMAIL PROTECTED]
Subject: [PHP] OK SQL experts...
I STFW and RTFM and I still can't figure out why this returns a 1064
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
'status' = 'active';
Anyone? TIA!

- B1ff Lamer

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


- Brian

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

- Brian

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


Re: [PHP] OK SQL experts...

2004-04-23 Thread Richard Harb
AFAIK phpMyAdmin uses backticks for table/field names, not single
quotes ...


Friday, April 23, 2004, 5:22:35 PM, thus was written:
 I tried it both ways - didn't make any difference (phpmyadmin adds the
 single quotes when I was trying to use its sql function to debug, so I
 figured what the hell)...


 On Apr 23, 2004, at 8:27 AM, Edward Peloke wrote:

 why are the table and field names surrounded by single quotes?

 -Original Message-
 From: Brian Dunning [mailto:[EMAIL PROTECTED]
 Sent: Friday, April 23, 2004 11:19 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] OK SQL experts...


 I STFW and RTFM and I still can't figure out why this returns a 1064
 parse error:

 SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
 'status' = 'active';

 Anyone? TIA!

 - B1ff Lamer

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



 - Brian

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



Re: [PHP] OK SQL experts...

2004-04-23 Thread John W. Holmes
From: Brian Dunning [EMAIL PROTECTED]

 I STFW and RTFM and I still can't figure out why this returns a 1064 
 parse error:
 
 SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
 'status' = 'active';

Use backticks around table and column names, not single quotes. 

---John Holmes...

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



Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
Backticks, single quotes, or nothing at all makes no difference. I 
believe the parsing error is due to my parentheses or AND/OR structure. 
Any thoughts on that?



On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

From: Brian Dunning [EMAIL PROTECTED]

I STFW and RTFM and I still can't figure out why this returns a 1064
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
'status' = 'active';
Use backticks around table and column names, not single quotes.

---John Holmes...

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

- Brian

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


RE: [PHP] OK SQL experts...

2004-04-23 Thread Jeff McKeon
  SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
  'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
  'status' = 'active';

Longshot but try to remove the ' ' from around the field names in the
where statement..

Or 

SELECT * FROM My_Table
WHERE field_1 like '%$keyword%'  status = 'active'
|| field_2 like '%$keyword%'  status = 'active'
|| field_3 like '%$keyword%'  status = 'active'

Jeff

 -Original Message-
 From: Brian Dunning [mailto:[EMAIL PROTECTED] 
 Sent: Friday, April 23, 2004 11:30 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] OK SQL experts...
 
 
 It gives the same error when I run it in phpmyadmin.
 
 
 On Apr 23, 2004, at 8:34 AM, Edward Peloke wrote:
 
  does it just return the error when running in the php page?  If you
  pull it
  out can you run it in mysql without errors?
 
  -Original Message-
  From: Brian Dunning [mailto:[EMAIL PROTECTED]
  Sent: Friday, April 23, 2004 11:23 AM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] OK SQL experts...
 
 
  I tried it both ways - didn't make any difference 
 (phpmyadmin adds the 
  single quotes when I was trying to use its sql function to 
 debug, so I 
  figured what the hell)...
 
 
  On Apr 23, 2004, at 8:27 AM, Edward Peloke wrote:
 
  why are the table and field names surrounded by single quotes?
 
  -Original Message-
  From: Brian Dunning [mailto:[EMAIL PROTECTED]
  Sent: Friday, April 23, 2004 11:19 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] OK SQL experts...
 
 
  I STFW and RTFM and I still can't figure out why this 
 returns a 1064 
  parse error:
 
  SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
  'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
  'status' = 'active';
 
  Anyone? TIA!
 
  - B1ff Lamer
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
  - Brian
 
  --
  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
 
 
 - Brian
 
 -- 
 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] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip]
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';
[/snip]

How about this?

SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%' OR 
field_2 LIKE '%$keyword%' OR field_3 LIKE '%$keyword%') AND 
status = 'active';

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



RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
what value is being put in the $keyword variable?  You are sure all these
columns exist?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...


Backticks, single quotes, or nothing at all makes no difference. I
believe the parsing error is due to my parentheses or AND/OR structure.
Any thoughts on that?



On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

 From: Brian Dunning [EMAIL PROTECTED]

 I STFW and RTFM and I still can't figure out why this returns a 1064
 parse error:

 SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
 'status' = 'active';

 Use backticks around table and column names, not single quotes.

 ---John Holmes...

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


- Brian

--
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] OK SQL experts...

2004-04-23 Thread Edward Peloke
if you echo out the query..what is the output?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...


Backticks, single quotes, or nothing at all makes no difference. I 
believe the parsing error is due to my parentheses or AND/OR structure. 
Any thoughts on that?



On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

 From: Brian Dunning [EMAIL PROTECTED]

 I STFW and RTFM and I still can't figure out why this returns a 1064
 parse error:

 SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
 'status' = 'active';

 Use backticks around table and column names, not single quotes.

 ---John Holmes...

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


- Brian

-- 
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] OK SQL experts...

2004-04-23 Thread Brian Dunning
Yes, I've checked and rechecked the spelling on everything. I've been 
testing with a word that I know appears in at least one of the fields.

On Apr 23, 2004, at 8:54 AM, Edward Peloke wrote:

what value is being put in the $keyword variable?  You are sure all 
these
columns exist?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...
Backticks, single quotes, or nothing at all makes no difference. I
believe the parsing error is due to my parentheses or AND/OR structure.
Any thoughts on that?


On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

From: Brian Dunning [EMAIL PROTECTED]

I STFW and RTFM and I still can't figure out why this returns a 1064
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
'status' = 'active';
Use backticks around table and column names, not single quotes.

---John Holmes...

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

- Brian

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

- Brian

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


Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
phpmyadmin echoes it out exactly as I copied  pasted into my first 
post.

On Apr 23, 2004, at 8:56 AM, Edward Peloke wrote:

if you echo out the query..what is the output?

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...
Backticks, single quotes, or nothing at all makes no difference. I
believe the parsing error is due to my parentheses or AND/OR structure.
Any thoughts on that?


On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

From: Brian Dunning [EMAIL PROTECTED]

I STFW and RTFM and I still can't figure out why this returns a 1064
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
'status' = 'active';
Use backticks around table and column names, not single quotes.

---John Holmes...

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

- Brian

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

- Brian

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


Re: [PHP] OK SQL experts...

2004-04-23 Thread Mark

--- Brian Dunning [EMAIL PROTECTED] wrote:
 Yes, I've checked and rechecked the spelling on everything. I've
 been 
 testing with a word that I know appears in at least one of the
 fields.
 

I'm coming in a bit late, but have you tried echoing out the query
variable contents and copying and pasting that to the MySQL command
line?

Also, any chance you could post the table decription? 

 
 On Apr 23, 2004, at 8:54 AM, Edward Peloke wrote:
 
  what value is being put in the $keyword variable?  You are sure
 all 
  these
  columns exist?
 
  -Original Message-
  From: Brian Dunning [mailto:[EMAIL PROTECTED]
  Sent: Friday, April 23, 2004 11:36 AM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] OK SQL experts...
 
 
  Backticks, single quotes, or nothing at all makes no difference.
 I
  believe the parsing error is due to my parentheses or AND/OR
 structure.
  Any thoughts on that?
 
 
 
  On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:
 
  From: Brian Dunning [EMAIL PROTECTED]
 
  I STFW and RTFM and I still can't figure out why this returns a
 1064
  parse error:
 
  SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
  'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
  'status' = 'active';
 
  Use backticks around table and column names, not single quotes.
 
  ---John Holmes...
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  - Brian
 
  --
  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
 
 
 - Brian
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***




__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

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



RE: [PHP] OK SQL experts...

2004-04-23 Thread Daniel Purdy
 I STFW and RTFM and I still can't figure out why this returns a 1064

 parse error:

 SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
 'status' = 'active';

Why don't you try rebuilding the query. I mean go into phpmyadmin and
issue select * from `my_table` if that works. Then add on one where
clause
Select * FROM `my_table` WHERE (`field_1 LIKE '%key%' )  , and just put
it back together piece by piece until it breaks. That should at least
help narrow down what is breaking.

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



RE: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip]
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';
[/snip]

*slaps forehead*

SELECT * FROM my_table WHERE (field_1 LIKE '% . $keyword . %' OR 
field_2 LIKE '% . $keyword . %' OR field_3 LIKE '% . $keyword . %')
AND 
status = 'active';

The single quoted variables do not get parsed

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



Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
I don't have access to the MySQL command line; it's hosted at my ISP.

:(

On Apr 23, 2004, at 8:54 AM, Mark wrote:

--- Brian Dunning [EMAIL PROTECTED] wrote:
Yes, I've checked and rechecked the spelling on everything. I've
been
testing with a word that I know appears in at least one of the
fields.
I'm coming in a bit late, but have you tried echoing out the query
variable contents and copying and pasting that to the MySQL command
line?
Also, any chance you could post the table decription?

On Apr 23, 2004, at 8:54 AM, Edward Peloke wrote:

what value is being put in the $keyword variable?  You are sure
all
these
columns exist?
-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 11:36 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...
Backticks, single quotes, or nothing at all makes no difference.
I
believe the parsing error is due to my parentheses or AND/OR
structure.
Any thoughts on that?



On Apr 23, 2004, at 8:32 AM, John W. Holmes wrote:

From: Brian Dunning [EMAIL PROTECTED]

I STFW and RTFM and I still can't figure out why this returns a
1064
parse error:

SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
'status' = 'active';
Use backticks around table and column names, not single quotes.

---John Holmes...

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

- Brian

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

- Brian

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


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to 
fight to death to defend everyone else's right to the same thing.
***



__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

- Brian

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


RE: [PHP] OK SQL experts...

2004-04-23 Thread Chris W. Parker
Brian Dunning mailto:[EMAIL PROTECTED]
on Friday, April 23, 2004 8:19 AM said:

 SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR
 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND
 'status' = 'active';

have you tried simply:

SELECT * FROM my_table WHERE status = 'active';

??

if that works move up into:

SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%') AND status =
'active';

if that works continue until you get an error.



chris.

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



RE: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip]
SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%') AND status =
'active';

if that works continue until you get an error.
[/snip]

That'll give you an error right there. That old single quoted variable
will get you every time. :)

WHERE (field_1 LIKE '%$keyword%') 

WHERE (field_1 LIKE '% . $keyword . %') 

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



Re[2]: [PHP] OK SQL experts...

2004-04-23 Thread Tom Rogers
Hi,

Saturday, April 24, 2004, 1:55:36 AM, you wrote:
JB [snip]
JB SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
JB 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
JB 'status' = 'active';
JB [/snip]

JB *slaps forehead*

JB SELECT * FROM my_table WHERE (field_1 LIKE '% . $keyword . %' OR
JB field_2 LIKE '% . $keyword . %' OR field_3 LIKE '% . $keyword . %')
JB AND 
JB status = 'active';

JB The single quoted variables do not get parsed

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


They do if they are themselves inside double quotes :)

echo '$var'; will get parsed ok

-- 
regards,
Tom

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



Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
if that works move up into:
SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%') AND status =
'active';
Yes, I actually did exactly that. Everything works until I have more 
than one statement inside the (x LIKE x OR x LIKE x) parens. That's why 
I figured there has to be something wrong with my paren structure. When 
I RTFM I saw someplace to use {}+ instead of () but it gave a different 
error.

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


RE: Re[2]: [PHP] OK SQL experts...

2004-04-23 Thread Jay Blanchard
[snip]
They do if they are themselves inside double quotes :)

echo '$var'; will get parsed ok
[/snip]

I know, but since I saw no double quotes I had to go for the obvious. :)

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



Re[4]: [PHP] OK SQL experts...

2004-04-23 Thread Tom Rogers
Hi,

Saturday, April 24, 2004, 2:03:36 AM, you wrote:
JB [snip]
JB They do if they are themselves inside double quotes :)

JB echo '$var'; will get parsed ok
JB [/snip]

JB I know, but since I saw no double quotes I had to go for the obvious. :)

Yes I would like to see the whole truth as well :) including the
mysterious search word.

-- 
regards,
Tom

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



Re[2]: [PHP] OK SQL experts...

2004-04-23 Thread Richard Davey
Hello Brian,

Friday, April 23, 2004, 5:02:00 PM, you wrote:

BD Yes, I actually did exactly that. Everything works until I have more
BD than one statement inside the (x LIKE x OR x LIKE x) parens. That's why
BD I figured there has to be something wrong with my paren structure. When
BD I RTFM I saw someplace to use {}+ instead of () but it gave a different
BD error.

I don't think it's anything to do with your () placement, I just
tested and the follow 3 queries all bring back the same results:

SELECT * FROM table WHERE (field LIKE '%var%') OR (field2 LIKE
'%var%') AND field3 = 'condition'

SELECT * FROM table WHERE (field LIKE '%var%' OR field2 LIKE
'%var%') AND field3 = 'condition'

SELECT * FROM table WHERE field LIKE '%var%' OR field2 LIKE
'%var%' AND field3 = 'condition'

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] OK SQL experts...

2004-04-23 Thread William Lovaton
How are you manipulating the whole SQL string?? 

$sql = SELECT...; ???

or 

$sql = 'SELECT...'; ???

In this case you will have to use double quotes because PHP won't parse
single quote strings for searching embedded PHP variables.

May be this is the problem.


-William


El vie, 23-04-2004 a las 11:02, Brian Dunning escribió:
  if that works move up into:
  SELECT * FROM my_table WHERE (field_1 LIKE '%$keyword%') AND status =
  'active';
 
 Yes, I actually did exactly that. Everything works until I have more 
 than one statement inside the (x LIKE x OR x LIKE x) parens. That's why 
 I figured there has to be something wrong with my paren structure. When 
 I RTFM I saw someplace to use {}+ instead of () but it gave a different 
 error.

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



Re: [PHP] OK SQL experts...

2004-04-23 Thread Curt Zirzow
* Thus wrote Brian Dunning ([EMAIL PROTECTED]):
 I STFW and RTFM and I still can't figure out why this returns a 1064 
 parse error:
 
 SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
 'status' = 'active';

You might want to change your subject to 'mind reading experts'.  A
lot of things can be wrong with this, as per the whole discussion
on this topic has shown.

All you need to do is echo mysql_error() and echo the actual string
that you are passing to mysql_query(). You're problem will be
solved rather quickly if you do that.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] OK SQL experts...

2004-04-23 Thread John Nichel
Brian Dunning wrote:
I STFW and RTFM and I still can't figure out why this returns a 1064 
parse error:

SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 'field_2' 
LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 'status' = 'active';

Anyone? TIA!

- B1ff Lamer

What does mysql_error() tell you?

--
***
*  _  __   __  __   _  * John  Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___  __ ___ _ __  * 716.856.9675 *
* | ' / -_) _` \ \/\/ / _ \ '_| / /(_-_/ _/ _ \ '  \ * 737 Main St. *
* |_|\_\___\__, |\_/\_/\___/_| |_\_\/__(_)__\___/_|_|_|* Suite #150   *
*  |___/   * Buffalo, NY  *
* http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 *
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
On Apr 23, 2004, at 10:13 AM, John Nichel wrote:

Brian Dunning wrote:
I STFW and RTFM and I still can't figure out why this returns a 1064 
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';
Anyone? TIA!
- B1ff Lamer
What does mysql_error() tell you?
You have an error in your SQL syntax. Check the manual that corresponds 
to your MySQL server version for the right syntax to use near 
''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'

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


RE: [PHP] OK SQL experts...

2004-04-23 Thread Edward Peloke
doesn't look like your $keyword value contains anything.

-Original Message-
From: Brian Dunning [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 1:19 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OK SQL experts...



On Apr 23, 2004, at 10:13 AM, John Nichel wrote:

 Brian Dunning wrote:
 I STFW and RTFM and I still can't figure out why this returns a 1064 
 parse error:
 SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
 'status' = 'active';
 Anyone? TIA!
 - B1ff Lamer

 What does mysql_error() tell you?

You have an error in your SQL syntax. Check the manual that corresponds 
to your MySQL server version for the right syntax to use near 
''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'

-- 
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] OK SQL experts...

2004-04-23 Thread Brian Dunning
On Apr 23, 2004, at 10:27 AM, Edward Peloke wrote:

doesn't look like your $keyword value contains anything.
My error. Here is the actual return:

You have an error in your SQL syntax. Check the manual that corresponds 
to your MySQL server version for the right syntax to use near 
''my_table' WHERE ('field_1' LIKE '%custom%' OR 'field_

I am searching for the word custom, which I put in at least one of 
the fields in several records, so the search SHOULD find something.

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


Re: [PHP] OK SQL experts...

2004-04-23 Thread Curt Zirzow
* Thus wrote Brian Dunning ([EMAIL PROTECTED]):
 
 On Apr 23, 2004, at 10:13 AM, John Nichel wrote:
 
 Brian Dunning wrote:
 I STFW and RTFM and I still can't figure out why this returns a 1064 
 parse error:
 SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
 'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
 'status' = 'active';
 Anyone? TIA!
 - B1ff Lamer
 
 What does mysql_error() tell you?
 
 You have an error in your SQL syntax. Check the manual that corresponds 
 to your MySQL server version for the right syntax to use near 
 ''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'

Because you are using a single quotes around  your table/field
names. Remove them or use ` (back tick). As suggested earlier.

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re[2]: [PHP] OK SQL experts...

2004-04-23 Thread Richard Davey
Hello Brian,

Friday, April 23, 2004, 6:18:43 PM, you wrote:

BD You have an error in your SQL syntax. Check the manual that corresponds
BD to your MySQL server version for the right syntax to use near 
BD ''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'

my_table should NOT be quoted in this instance and it causes the mysql
error above. I just tried a query on a table and put the table name in
quotes and it generated the exact same error. You can use back-ticks:
` but not the ' character which is what was in your post above.

Also - wrapping field_1 in ' quotes ' DOES effect the outcome of the
query, it should not have anything around it. If you wrap the field
name in back-ticks that is fine.

Unless the back-ticks have been converted to quotes by your email
client automatically, that is most definitely the root of the problem.

If PHPMyAdmin offers the ability to enter an execute a standard SQL
statement - try it for yourself and you'll see what I mean.

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
You have an error in your SQL syntax. Check the manual that 
corresponds
to your MySQL server version for the right syntax to use near
''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'
Because you are using a single quotes around  your table/field
names. Remove them or use ` (back tick). As suggested earlier.
NOW IT WORKS!! I thought I had tried back ticks and nothing - I did try 
it, must have made a typo. But all is well now. THANKS VERY MUCH

- B1ff Lamer

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


Re: [PHP] OK SQL experts...

2004-04-23 Thread John W. Holmes
From: Brian Dunning [EMAIL PROTECTED]
 My error. Here is the actual return:

 You have an error in your SQL syntax. Check the manual that corresponds
 to your MySQL server version for the right syntax to use near
 ''my_table' WHERE ('field_1' LIKE '%custom%' OR 'field_

 I am searching for the word custom, which I put in at least one of
 the fields in several records, so the search SHOULD find something.

Take out the single quotes around your table name! If you must, use
backticks, but even they aren't necessary. Then tell us what the new error
is.

---John Holmes...

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



Re: [PHP] OK SQL experts...

2004-04-23 Thread Brian Dunning
You have an error in your SQL syntax. Check the manual that 
corresponds
to your MySQL server version for the right syntax to use near
''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'
Because you are using a single quotes around  your table/field
names. Remove them or use ` (back tick). As suggested earlier.
NOW IT WORKS!! I thought I had tried back ticks and nothing - I did try 
it, must have made a typo. But all is well now. THANKS VERY MUCH

- B1ff Lamer

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


Re: [PHP] OK SQL experts...

2004-04-23 Thread John Nichel
Brian Dunning wrote:
On Apr 23, 2004, at 10:13 AM, John Nichel wrote:

Brian Dunning wrote:

I STFW and RTFM and I still can't figure out why this returns a 1064 
parse error:
SELECT * FROM 'my_table' WHERE ('field_1' LIKE '%$keyword%' OR 
'field_2' LIKE '%$keyword%' OR 'field_3' LIKE '%$keyword%') AND 
'status' = 'active';
Anyone? TIA!
- B1ff Lamer


What does mysql_error() tell you?


You have an error in your SQL syntax. Check the manual that corresponds 
to your MySQL server version for the right syntax to use near 
''my_table' WHERE ('field_1' LIKE '%%' OR 'field2'

I think this has been mentioned already, but your field names shouldn't 
have quotes around them.  You should be using back ticks.

--
***
*  _  __   __  __   _  * John  Nichel *
* | |/ /___ __ \ \/ /__ _ _| |__ ___  __ ___ _ __  * 716.856.9675 *
* | ' / -_) _` \ \/\/ / _ \ '_| / /(_-_/ _/ _ \ '  \ * 737 Main St. *
* |_|\_\___\__, |\_/\_/\___/_| |_\_\/__(_)__\___/_|_|_|* Suite #150   *
*  |___/   * Buffalo, NY  *
* http://www.KegWorks.com[EMAIL PROTECTED] * 14203 - 1321 *
***
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] OK

2003-07-22 Thread Rausch Alexandru
Sorry, i didn't itent to be a spam, believe me. But i don't know how to do this 
aplication


Re: [PHP] OK

2003-07-22 Thread Jeff Harris
On Jul 22, 2003, Rausch Alexandru claimed that:

|Sorry, i didn't itent to be a spam, believe me. But i don't know how to
|do this aplication
|

In that case, you might want to start with something a bit less ambitious,
maybe learning to wrap your mail, and some tutorials?
http://www.devshed.com/Server_Side/PHP/PHP101/PHP101_1/page1.html

Maybe a web search to see if what you want to do has already been done?

-- 
Registered Linux user #304026.
lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import
Key fingerprint = 52FC 20BD 025A 8C13 5FC6  68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.



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



Re: [PHP] OK, So I am new to these List. Win2000 help!

2003-07-13 Thread John Nichel
John A. Thomason wrote:
Thanks, that did it. And yes, I am trying to run this as a shell script.
Thank you very much.
John.

- Original Message - 
From: John Nichel [EMAIL PROTECTED]
To: John A. Thomason [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Saturday, July 12, 2003 10:01 PM
Subject: Re: [PHP] OK, So I am new to these List. Win2000 help!



John A. Thomason wrote:

The following is my output in the command prompt window(DOS Prompt?)

C:\PHPhello.php
Content-type: text/html
X-Powered-By: PHP/4.3.2
!#C:\php\;
echoHello World!;
if ($foo):
echo yep\n;
elseif ($bar):
echo almost\n;
else:
echo nope\n;
endif;
phpinfo();
C:\PHP
And the following is the PHP code to generate it.

!#C:\php\;

echoHello World!;

if ($foo):

echo yep\n;

elseif ($bar):

echo almost\n;

else:

echo nope\n;

endif;

phpinfo();

Now, I know that the variables are not set, so they should be false, but

the

output just displays a listing of the code and doesn't process it. In

the

documentation, it states that PHP can be run from the command prompt,

like a

batch file. Now what am I doing wrong.

I do have it working correctly with an Apache server, that I am using
backend.
and my install dir is C:\php, and it is listed first in the path.

John A. Thomason

[EMAIL PROTECTED]

Looks like you're trying to run it as a shell script, or a cgi program.
 Replace the sh-bang on the first line with ?php and make sure the
last line of the script is ?
eg:

?php
echoHello World!;
if ($foo):
echo yep\n;
elseif ($bar):
echo almost\n;
else:
echo nope\n;
endif;
phpinfo();
?
Yeah, you just need to enclose the actual script in the opening/closing 
php tags (?php and ?).  And to run it as a shell script, you can 
either call the script as...

c:\path\to\php\php.exe filename.php (or just 'php filename.php' if the 
php interperter is in your path), or put the sh-bang as the first line 
(before the opening php tag).

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


[PHP] OK, So I am new to these List. Win2000 help!

2003-07-12 Thread John A. Thomason
The following is my output in the command prompt window(DOS Prompt?)

C:\PHPhello.php
Content-type: text/html
X-Powered-By: PHP/4.3.2

!#C:\php\;
echoHello World!;
if ($foo):
echo yep\n;
elseif ($bar):
echo almost\n;
else:
echo nope\n;
endif;
phpinfo();
C:\PHP

And the following is the PHP code to generate it.

!#C:\php\;

echoHello World!;

if ($foo):

echo yep\n;

elseif ($bar):

echo almost\n;

else:

echo nope\n;

endif;

phpinfo();

Now, I know that the variables are not set, so they should be false, but the
output just displays a listing of the code and doesn't process it. In the
documentation, it states that PHP can be run from the command prompt, like a
batch file. Now what am I doing wrong.

I do have it working correctly with an Apache server, that I am using
backend.

and my install dir is C:\php, and it is listed first in the path.

John A. Thomason

[EMAIL PROTECTED]





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



Re: [PHP] OK, So I am new to these List. Win2000 help!

2003-07-12 Thread John Nichel
John A. Thomason wrote:
The following is my output in the command prompt window(DOS Prompt?)

C:\PHPhello.php
Content-type: text/html
X-Powered-By: PHP/4.3.2
!#C:\php\;
echoHello World!;
if ($foo):
echo yep\n;
elseif ($bar):
echo almost\n;
else:
echo nope\n;
endif;
phpinfo();
C:\PHP
And the following is the PHP code to generate it.

!#C:\php\;

echoHello World!;

if ($foo):

echo yep\n;

elseif ($bar):

echo almost\n;

else:

echo nope\n;

endif;

phpinfo();

Now, I know that the variables are not set, so they should be false, but the
output just displays a listing of the code and doesn't process it. In the
documentation, it states that PHP can be run from the command prompt, like a
batch file. Now what am I doing wrong.
I do have it working correctly with an Apache server, that I am using
backend.
and my install dir is C:\php, and it is listed first in the path.

John A. Thomason

[EMAIL PROTECTED]

Looks like you're trying to run it as a shell script, or a cgi program. 
 Replace the sh-bang on the first line with ?php and make sure the 
last line of the script is ?

eg:

?php
echoHello World!;
if ($foo):
echo yep\n;
elseif ($bar):
echo almost\n;
else:
echo nope\n;
endif;
phpinfo();
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] OK guys, thank you so far

2003-06-04 Thread Øystein Håland
Now my code is

extract ($_GET);
if ($_GET['printout'] != yeah) { include(header.php); }

but I still get the following error:

Undefined index: printout

I understand nothing

Jonathan Wilkes [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
Hi,

What he means is that with register_globals=off you cannot do this:

echo $path

you need to do this (if the variable is sent by POST action)

echo _POST('path')

and through GET

echo _GET('path')

-Original Message-
From: Øystein Håland [mailto:[EMAIL PROTECTED]
Sent: 03 June 2003 17:02
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Migration from register_globals=on to
register_globals=off


I'm not sure what you mean. To give ONE example:
Earlier I could use this code on top of every page:
if  ($printout != yeah) { include(header.php); }
This code gives an error today. The variable $printout is set if the visitor
choose to click on the 'print_page_image', otherwise the variable has no
value.

Esteban FernáNdez [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 When you recivied that error ?, in a form ?, if is in a Form just put in
the
 top of .php files this code

 $HTTP_GET_VARS[variable2];
 $HTTP_GET_VARS[variable3];

 Of course if you send with other method (post) change the GET for POST

 $HTTP_POS_VARS[variable2];
 $HTTP_POS_VARS[variable3];

 Regards.

 Esteban.



 ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje
 news:[EMAIL PROTECTED]
  None of my old scripts worx nowadays and the most common error message
is
  'undefined variable'. What is the best/simplest way to work around this
  situation?
  if !isset($myvar) {
  do this
  blah blah
  }
  ?
 
 





-- 
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] OK guys, thank you so far

2003-06-04 Thread Edward Peloke
can you try if ($HTTP_GET_VARS['printout']!=yeah) {include(header.php);}

does that work?

-Original Message-
From: Øystein Håland [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 03, 2003 1:17 PM
To: [EMAIL PROTECTED]
Subject: [PHP] OK guys, thank you so far


Now my code is

extract ($_GET);
if ($_GET['printout'] != yeah) { include(header.php); }

but I still get the following error:

Undefined index: printout

I understand nothing

Jonathan Wilkes [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
Hi,

What he means is that with register_globals=off you cannot do this:

echo $path

you need to do this (if the variable is sent by POST action)

echo _POST('path')

and through GET

echo _GET('path')

-Original Message-
From: Øystein Håland [mailto:[EMAIL PROTECTED]
Sent: 03 June 2003 17:02
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Migration from register_globals=on to
register_globals=off


I'm not sure what you mean. To give ONE example:
Earlier I could use this code on top of every page:
if  ($printout != yeah) { include(header.php); }
This code gives an error today. The variable $printout is set if the visitor
choose to click on the 'print_page_image', otherwise the variable has no
value.

Esteban FernáNdez [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 When you recivied that error ?, in a form ?, if is in a Form just put in
the
 top of .php files this code

 $HTTP_GET_VARS[variable2];
 $HTTP_GET_VARS[variable3];

 Of course if you send with other method (post) change the GET for POST

 $HTTP_POS_VARS[variable2];
 $HTTP_POS_VARS[variable3];

 Regards.

 Esteban.



 ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje
 news:[EMAIL PROTECTED]
  None of my old scripts worx nowadays and the most common error message
is
  'undefined variable'. What is the best/simplest way to work around this
  situation?
  if !isset($myvar) {
  do this
  blah blah
  }
  ?
 
 





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


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



Re: [PHP] OK guys, thank you so far

2003-06-04 Thread Wendell Brown
On Tue, 3 Jun 2003 19:16:30 +0200, +ystein H†land wrote:

Now my code is

extract ($_GET);
if ($_GET['printout'] != yeah) { include(header.php); }

but I still get the following error:

Undefined index: printout

I understand nothing

Ok, it looks like you are mixing your metaphors ;)

If you use extract( $_GET ); -- you should have a $printout variable
available (assuming you aren't doing a POST form and you are on a
version of PHP that supports $_GET).  At least two of the following
should work...

--- Option 1 --- GET method - New PHP
 
extract($_GET);
if ($printout != yeah) { include(header.php); }

--- Option 2 --- POST method - New PHP 

extract($_POST);
if ($printout != yeah) { include(header.php); }

--- Option 3 --- GET method - Older PHP

extract($HTTP_GET_VARS);
if ($printout != yeah) { include(header.php); }

--- Option 4 --- POST method - Older PHP

extract($HTTP_POST_VARS);
if ($printout != yeah) { include(header.php); }

--- Option 5 --- GET method - new php - No extract

if ( $_GET[ 'printout' ] != yeah) { include(header.php); }

--- Option 6 --- POST method - new php - No extract

if ( $_POST[ 'printout' ] != yeah) { include(header.php); }

--- Option 7 --- GET method - older php - No extract

if ( $HTTP_GET_VARS[ 'printout' ] != yeah) { include(header.php); }

--- Option 8 --- POST method - older php - No extract

if ( $HTTP_POST_VARS[ 'printout' ] != yeah) { include(header.php);
}

 End ---




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



Re: [PHP] OK guys, thank you so far

2003-06-04 Thread Øystein Håland
I've tried and here's the output:
Undefined index: input

if ($HTTP_GET_VARS['printout'] != yeah) { include(header.php); }

Edward Peloke [EMAIL PROTECTED] skrev i meddelandet
news:[EMAIL PROTECTED]
 can you try if ($HTTP_GET_VARS['printout']!=yeah)
{include(header.php);}

 does that work?

 -Original Message-
 From: Øystein Håland [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 03, 2003 1:17 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] OK guys, thank you so far


 Now my code is

 extract ($_GET);
 if ($_GET['printout'] != yeah) { include(header.php); }

 but I still get the following error:

 Undefined index: printout

 I understand nothing

 Jonathan Wilkes [EMAIL PROTECTED] skrev i meddelandet
 news:[EMAIL PROTECTED]
 Hi,

 What he means is that with register_globals=off you cannot do this:

 echo $path

 you need to do this (if the variable is sent by POST action)

 echo _POST('path')

 and through GET

 echo _GET('path')

 -Original Message-
 From: Øystein Håland [mailto:[EMAIL PROTECTED]
 Sent: 03 June 2003 17:02
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: Migration from register_globals=on to
 register_globals=off


 I'm not sure what you mean. To give ONE example:
 Earlier I could use this code on top of every page:
 if  ($printout != yeah) { include(header.php); }
 This code gives an error today. The variable $printout is set if the
visitor
 choose to click on the 'print_page_image', otherwise the variable has no
 value.

 Esteban FernáNdez [EMAIL PROTECTED] skrev i meddelandet
 news:[EMAIL PROTECTED]
  When you recivied that error ?, in a form ?, if is in a Form just put in
 the
  top of .php files this code
 
  $HTTP_GET_VARS[variable2];
  $HTTP_GET_VARS[variable3];
 
  Of course if you send with other method (post) change the GET for POST
 
  $HTTP_POS_VARS[variable2];
  $HTTP_POS_VARS[variable3];
 
  Regards.
 
  Esteban.
 
 
 
  ØYstein HåLand [EMAIL PROTECTED] escribió en el mensaje
  news:[EMAIL PROTECTED]
   None of my old scripts worx nowadays and the most common error message
 is
   'undefined variable'. What is the best/simplest way to work around
this
   situation?
   if !isset($myvar) {
   do this
   blah blah
   }
   ?
  
  
 
 



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




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



Re: [PHP] OK guys, thank you so far

2003-06-04 Thread David Nicholson
Hello,

This is a reply to an e-mail that you wrote on Tue, 3 Jun 2003 at 20:04,
lines prefixed by '' were originally written by you.
 I've tried and here's the output:
 Undefined index: input
 if ($HTTP_GET_VARS['printout'] != yeah) { include(header.php); }

You have error reporting set to E_ALL, turn it down a bit.

More information at:
http://uk2.php.net/error_reporting

David.

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



Re: [PHP] OK guys, thank you so far

2003-06-04 Thread Lars Torben Wilson
On Tue, 2003-06-03 at 13:20, David Nicholson wrote:
 Hello,
 
 This is a reply to an e-mail that you wrote on Tue, 3 Jun 2003 at 20:04,
 lines prefixed by '' were originally written by you.
  I've tried and here's the output:
  Undefined index: input
  if ($HTTP_GET_VARS['printout'] != yeah) { include(header.php); }
 
 You have error reporting set to E_ALL, turn it down a bit.
 
 More information at:
 http://uk2.php.net/error_reporting
 
 David.

This is a good idea for a production machine, but for your development
environment, turning down error reporting is not a good idea. :) You 
will kill yourself trying to track down subtle errors when they aren't
displayed.

Try checking your variables before using them:

 if (isset($_GET['printout'])  $_GET['printout'] != 'yeah') { 
// . . .
 }



Torben


-- 
 Torben Wilson [EMAIL PROTECTED]+1.604.709.0506
 http://www.thebuttlesschaps.com  http://www.inflatableeye.com
 http://www.hybrid17.com  http://www.themainonmain.com
 - Boycott Starbucks!  http://www.haidabuckscafe.com -




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



Re: [PHP] Ok, problem found, but that makes way for another...

2003-04-03 Thread Ryan Vennell
ok, now where in that heck can i find the php entry in that file?  i cant seem to find 
it anywhere.  would it be with the CGI entry or in a different place?

 Marek Kilimajer[EMAIL PROTECTED] 04/03/03 04:37AM 
The old installation is likely in /usr, and you installed in /usr/local. 
Simply remove the old installation (man rm ;-) and change httpd.conf  to 
look for php in the new place

Ryan Vennell wrote:

ok, my last post stated that i've tried reconfigureing.making/makeinstalling php 
4.3.1 a tons of times.  well, today when i typed php -v it told me that version 4.2.2 
was the one that was installed.  so apparently my installing has not been taking the 
place of the old one.  

The original root is that the original compile of php (not done by me) was installed 
w/out mysql and i need mysql for what i'm working on.

now that i know the problem here, any suggestions?

I'm running apache for what i'm working on, tomcat for other things that this server 
does, and the latest version of mysql

now how do i get rid of hte old php and make sure this new one goes into its place?

P.S.- i'm not a total linux newb but i'm not, NOT a newb either.

  





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



Re: [PHP] Ok, problem found, but that makes way for another...

2003-04-03 Thread Marek Kilimajer
The old installation is likely in /usr, and you installed in /usr/local. 
Simply remove the old installation (man rm ;-) and change httpd.conf  to 
look for php in the new place

Ryan Vennell wrote:

ok, my last post stated that i've tried reconfigureing.making/makeinstalling php 4.3.1 a tons of times.  well, today when i typed php -v it told me that version 4.2.2 was the one that was installed.  so apparently my installing has not been taking the place of the old one.  

The original root is that the original compile of php (not done by me) was installed w/out mysql and i need mysql for what i'm working on.

now that i know the problem here, any suggestions?

I'm running apache for what i'm working on, tomcat for other things that this server does, and the latest version of mysql

now how do i get rid of hte old php and make sure this new one goes into its place?

P.S.- i'm not a total linux newb but i'm not, NOT a newb either.

 



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


[PHP] Ok, problem found, but that makes way for another...

2003-04-02 Thread Ryan Vennell
ok, my last post stated that i've tried reconfigureing.making/makeinstalling php 4.3.1 
a tons of times.  well, today when i typed php -v it told me that version 4.2.2 was 
the one that was installed.  so apparently my installing has not been taking the place 
of the old one.  

The original root is that the original compile of php (not done by me) was installed 
w/out mysql and i need mysql for what i'm working on.

now that i know the problem here, any suggestions?

I'm running apache for what i'm working on, tomcat for other things that this server 
does, and the latest version of mysql

now how do i get rid of hte old php and make sure this new one goes into its place?

P.S.- i'm not a total linux newb but i'm not, NOT a newb either.

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



[PHP] ok now my sessions are *not* timing out

2003-03-11 Thread freaky deaky
before my problem was that my sessions were being terminated spontaneously. it looks 
like i've managed to fix that problem - so far i haven't been randomly logged off my 
application. the problem is, according to my php.ini settings, my session should have 
been terminated after 2 hours, it's been almost 5 hours now... 

my php.ini: 
snip 
; Lifetime in seconds of cookie or, if 0, until browser is restarted. 
session.cookie_lifetime =0 
; Percentual probability that the 'garbage collection' process is started 
; on every session initialization. 
session.gc_probability =100 
; After this number of seconds, stored data will be seen as 'garbage' and 
; cleaned up by the garbage collection process. 
session.gc_maxlifetime =7200 
/snip 

after making the above changes in my php.ini, it looks like the javascript timer i 
have in the headers of my authenticated pages does not work anymore. this javascript 
is supposed to popup a warning message at 18 minutes of inactivity, and at 20 minutes, 
redirect the user to the logout page, which calls session_destroy(). 

the js looks like: 
snip 
script language=JavaScript 
!-- 
function timeout_2MinuteAlert() 
{if(confirm('Warning: You are about to time out. As a security measure, we log you out 
after 20 minutes of inactivity. You have been inactive for 18 minutes. Click Ok 
within the next 2 minutes to continue with your application, otherwise you will be 
logged out. If you are logged out, you will need to log in again to continue your 
session.')) 
{ 
history.go(0) 
} 
} 
function timeout_FinalAlert() 
{ 
if(confirm('Warning: You have timed out. As a security measure, you have been logged 
out after 20 minutes of inactivity. Click Ok again to return to log in again to 
continue your session.')) 
{ 
history.go(0) 
} 
} 
setTimeout('timeout_2MinuteAlert()', 108); // = 18 minutes 
setTimeout('timeout_FinalAlert()', 1212000); // = 20 minutes 
//-- 
/snip 

what happens is that the javascript gets to the 18 minute warning, but never gets to 
the 20 minute warning, the user is not redirected to the logout page. ideally, i would 
like to have this work. i would like the user to be able to click around on the site 
without their session expiring indefinitely, but at 18 minutes of inactivity, have 
this javascript pop up a warning message, and at 20 mins of inactivity have them be 
automatically redirected to the logout page and their session destroyed. 

what am i doing wrong?


-- 
__
http://www.linuxmail.org/
Now with e-mail forwarding for only US$5.95/yr

Powered by Outblaze

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



  1   2   >