php-general Digest 25 Jul 2005 13:35:33 -0000 Issue 3587

2005-07-25 Thread php-general-digest-help

php-general Digest 25 Jul 2005 13:35:33 - Issue 3587

Topics (messages 219282 through 219300):

Re: how to post a question?
219282 by: Richard Lynch
219285 by: Ryan A
219297 by: Jochem Maas

Re: Loading dynamic extension
219283 by: Richard Lynch

Re: Don't ejecute a sentence if a field is empty
219284 by: Richard Lynch
219299 by: Jochem Maas

Re: speed - PHP/MYSQL
219286 by: balwant singh

function MAX with WHERE
219287 by: Jesús Alain Rodríguez Santos
219288 by: Georgi Ivanov
219289 by: Mark Rees

Re: is_array() doesn't work on DOM properties?
219290 by: Jochem Maas

Re: Installing OLE/Spreadsheet Excel Writer Query
219291 by: Jochem Maas

running number
219292 by: Roger Thomas
219295 by: Richard Davey
219296 by: Sascha Kaufmann

Closing persistent ODBC connections
219293 by: Dodot

Re: Delivery Protection
219294 by: jonathan.ernst.netoxygen.ch

Re: quick question about using capital letters coding w/ PHP
219298 by: Jochem Maas

A strategy question about using mySQL for saving flat-file stings?
219300 by: Al

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
php-general@lists.php.net


--
---BeginMessage---
On Fri, July 22, 2005 10:11 am, Ryan A said:
 The str_replace calls are kinda expensive IMHO, a good regex would be
 better

I'd be interested to see a benchmark (any benchmark) where str_replace is
SLOWER than the corresponding Regex...

-- 
Like Music?
http://l-i-e.com/artists.htm
---End Message---
---BeginMessage---
Hey Rich,

  The str_replace calls are kinda expensive IMHO, a good regex would be
  better

 I'd be interested to see a benchmark (any benchmark) where str_replace is
 SLOWER than the corresponding Regex...

I am not very good with RegEx's myself, and I have never benchmarked any of
them but
I was told or read (when i first started learning php) that using multiple
str_replace()s are
not a good idea and to use a regex instead.
(Thats why I wrote the IMHO,if i was wrong one of the gurus here could
correct me)

It kind of makes sense, for example using this from the php site:

$phrase  = You should eat fruits, vegetables, and fiber every day.;
$healthy = array(fruits, vegetables, fiber);
$yummy  = array(pizza, beer, ice cream);

$newphrase = str_replace($healthy, $yummy, $phrase);

in the above, first it searches the entire phrase for the first parameter
(fruits) then it starts
again fro the second parameter (vegetables) etc, if you have a really long
text it could
be quite process intensivebecause it would have to go through the whole
text searching for
the parameters one by oneright?

You're the guy who usually helps me (and a whole lot of others) when we have
questions
so I am really interested on your view on this, and why your view favours
one side more than
the other.

Cheers,
Ryan
---End Message---
---BeginMessage---

Ryan A wrote:

Hey Rich,



The str_replace calls are kinda expensive IMHO, a good regex would be
better




I'd be interested to see a benchmark (any benchmark) where str_replace is
SLOWER than the corresponding Regex...



I am not very good with RegEx's myself, and I have never benchmarked any of
them but
I was told or read (when i first started learning php) that using multiple
str_replace()s are
not a good idea and to use a regex instead.
(Thats why I wrote the IMHO,if i was wrong one of the gurus here could
correct me)

It kind of makes sense, for example using this from the php site:

$phrase  = You should eat fruits, vegetables, and fiber every day.;
$healthy = array(fruits, vegetables, fiber);
$yummy  = array(pizza, beer, ice cream);

$newphrase = str_replace($healthy, $yummy, $phrase);

in the above, first it searches the entire phrase for the first parameter
(fruits) then it starts
again fro the second parameter (vegetables) etc, if you have a really long
text it could
be quite process intensivebecause it would have to go through the whole
text searching for
the parameters one by oneright?

You're the guy who usually helps me (and a whole lot of others) when we have
questions


isn't he just! :-) I have to wonder how long his keyboards last ;-), or
whether he retro-fits them with smoke alarms (speedtyping - overheating -
fire)


so I am really interested on your view on this, and why your view favours
one side more than
the other.


regexps require a complete engine (in the same way as PHP is a engine)
in order to be parsed. loading/initializing such an engine is heavier than 
doing a 'simple'
search and replace action performance results (between str_replace() and 
pre_replace()) will
definitely be skewed when comparing simple regexps against a comparable 
str_replace()
because (to 

Re: [PHP] function MAX with WHERE

2005-07-25 Thread Georgi Ivanov
What print_r($test_m) say ?
Or echo mysql_num_rows($test);
May be you get 0 records from your query.

On Monday 25 July 2005 09:06, Jesús Alain Rodríguez Santos wrote:
 I have someting like this:

 $test = mysql_query(SELECT MAX(dato) AS datos FROM tabla WHERE campo_mes
 = '$mes');
 $test_m = mysql_fetch_array($test);
 $test_mes = $test_m['datos'];

 print $test_mes

 where $mes is a value
 I need to know if something its wrong, because I don't recive any error,
 but I see nothing




 --
 Este mensaje ha sido analizado por MailScanner
 en busca de virus y otros contenidos peligrosos,
 y se considera que está limpio.

-- 
Regards
Georgi Ivanov

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



[PHP] Re: function MAX with WHERE

2005-07-25 Thread Mark Rees
Jesús Alain Rodríguez Santos [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have someting like this:

 $test = mysql_query(SELECT MAX(dato) AS datos FROM tabla WHERE campo_mes
 = '$mes');
 $test_m = mysql_fetch_array($test);
 $test_mes = $test_m['datos'];

 print $test_mes

 where $mes is a value
 I need to know if something its wrong, because I don't recive any error,
 but I see nothing

Try this, it will tell you if something is wrong

echo  mysql_error();

If nothing is wrong, then perhaps your query returns no rows? Test this by
removing the where clause (assuming there is some data in tabla).

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



Re: [PHP] is_array() doesn't work on DOM properties?

2005-07-25 Thread Jochem Maas

John Smith wrote:

I'm trying to avoid error messages while iterating
over DOM properties. e.g.





if(is_array($dom-stuff-props)) {


maybe you can get roudn the problem by saying?:

if($dom-stuff-props) {

or?:

if(!empty($dom-stuff-props)) {


  foreach($dom-stuff-props as $prop) {
...
  }
}

It works without the is_array() check, but not with


my guess is you'll find that $dom-stuff-props is an object
which overloads the array accessor stuff...
basically it's implementing Iterator (or some other SPL Interface)

hard to tell though because you don't mention which DOM
related extension you are using.


it. I've done var_dumps and $dom-stuff-props is
indeed an array. I've also tried using an intermediate
variable ($stuff=$dom-stuff) then checking that, but
that doesn't work either).

John




Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 



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



Re: [PHP] Installing OLE/Spreadsheet Excel Writer Query

2005-07-25 Thread Jochem Maas

kevin.o'[EMAIL PROTECTED] wrote:

Hi Jochem,

can you telnet to pear.php.net:80 ?



didn't see your reply earlier (been away from the PC). here is the answer:

open a dosbox (type 'CMD' in the run dialog) then type the following in
the dosbox:

telnet pear.php.net 80

if you get a 'Connecting to...' flashing on your cmdline and then an empty
screen then you are connecting fine. the empty screen is actually a prompt
for you to type a request (an HTTP request) e.g. type the following (+ ENTER)
will return the HTML for the index page of that domain:

GET / HTTP/1.1


AND PLEASE NEVER ONLY POST A QUESTION DIRECT TO THE GUY/GIRL THAT
IS HELPING YOU ATM THEY (i.e. me) ARE NOT YOUR PERSONAL HELPDESK...
POST TO THE LIST (also gives other people to learn from your problems!)



How do I do this? I have selected start  run  cmd  telnet so far.

Kevin.



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



[PHP] running number

2005-07-25 Thread Roger Thomas
I am required to write a user registration script that captures the basics like 
name, phone number etc etc. I would also have to write to mySQL database a 
number that is associated with that user.

At this point of writing, the start of that number is unknown. But the number 
will be incremented by 1 after each successfull registration.

Let's say the number starts from 12345.

I am quite new at all these stuff and would like to seek your advise on the 
*recommended way* of achieving this. I am thinking along these lines:
a) store that number (12345) in a table
b) a user registers and assign that number to him
c) increment number to 12346
d) process repeats for the next registration

Concern: How do tell mySQL to lock the 'number' table when a new registration 
process is about to take place. Is locking the best option here or is/are there 
better ways?

Please advise.

--
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] Closing persistent ODBC connections

2005-07-25 Thread Dodot
Hello everyone,

The php manual isn't very clear about when and how ODBC persistent
connection are actually closed.

I tried with odbc_close_all() but I'm not sure it really closes the
connection, since the next call to odbc_pconnect() will be faster than
before!

The problem is that regularly I really need to close all connections
to the ODBC for maintenance... And I would like to do this without
shutting down apache ;)

Thanks for all your advices!

Jean-Francois, 22, France.

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



[PHP] Re: Delivery Protection

2005-07-25 Thread jonathan . ernst

SMTP: Please confirm the attached message.


+++ Attachment: No Virus found
+++ MessageLabs AntiVirus - www.messagelabs.com


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

Re: [PHP] running number

2005-07-25 Thread Richard Davey
Hello Roger,

Monday, July 25, 2005, 10:21:54 AM, you wrote:

RT I am quite new at all these stuff and would like to seek your
RT advise on the *recommended way* of achieving this. I am thinking
RT along these lines:
RT a) store that number (12345) in a table
RT b) a user registers and assign that number to him
RT c) increment number to 12346
RT d) process repeats for the next registration

RT Concern: How do tell mySQL to lock the 'number' table when a
RT new registration process is about to take place. Is locking the
RT best option here or is/are there better ways?

Do you HAVE to have a starting off number of 12345? If there is no
real reason to do this, then use an auto-increment column in MySQL and
let that do all the hard work for you!

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

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



Re: [PHP] running number

2005-07-25 Thread Sascha Kaufmann
try mySQL's auto increment attribute

http://dev.mysql.com/doc/mysql/en/example-auto-increment.html

Roger Thomas wrote:
 I am required to write a user registration script that captures the basics 
 like name, phone number etc etc. I would also have to write to mySQL database 
 a number that is associated with that user.
 
 At this point of writing, the start of that number is unknown. But the number 
 will be incremented by 1 after each successfull registration.
 
 Let's say the number starts from 12345.
 
 I am quite new at all these stuff and would like to seek your advise on the 
 *recommended way* of achieving this. I am thinking along these lines:
 a) store that number (12345) in a table
 b) a user registers and assign that number to him
 c) increment number to 12346
 d) process repeats for the next registration
 
 Concern: How do tell mySQL to lock the 'number' table when a new registration 
 process is about to take place. Is locking the best option here or is/are 
 there better ways?
 
 Please advise.
 
 --
 Roger
 
 
 ---
 Sign Up for free Email at http://ureg.home.net.my/
 ---
 

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



Re: [PHP] how to post a question?

2005-07-25 Thread Jochem Maas

Ryan A wrote:

Hey Rich,



The str_replace calls are kinda expensive IMHO, a good regex would be
better




I'd be interested to see a benchmark (any benchmark) where str_replace is
SLOWER than the corresponding Regex...



I am not very good with RegEx's myself, and I have never benchmarked any of
them but
I was told or read (when i first started learning php) that using multiple
str_replace()s are
not a good idea and to use a regex instead.
(Thats why I wrote the IMHO,if i was wrong one of the gurus here could
correct me)

It kind of makes sense, for example using this from the php site:

$phrase  = You should eat fruits, vegetables, and fiber every day.;
$healthy = array(fruits, vegetables, fiber);
$yummy  = array(pizza, beer, ice cream);

$newphrase = str_replace($healthy, $yummy, $phrase);

in the above, first it searches the entire phrase for the first parameter
(fruits) then it starts
again fro the second parameter (vegetables) etc, if you have a really long
text it could
be quite process intensivebecause it would have to go through the whole
text searching for
the parameters one by oneright?

You're the guy who usually helps me (and a whole lot of others) when we have
questions


isn't he just! :-) I have to wonder how long his keyboards last ;-), or
whether he retro-fits them with smoke alarms (speedtyping - overheating -
fire)


so I am really interested on your view on this, and why your view favours
one side more than
the other.


regexps require a complete engine (in the same way as PHP is a engine)
in order to be parsed. loading/initializing such an engine is heavier than 
doing a 'simple'
search and replace action performance results (between str_replace() and 
pre_replace()) will
definitely be skewed when comparing simple regexps against a comparable 
str_replace()
because (to start with) the overhead of calling a function in php (which is why 
its better
to call str_replace() with arrays in param 1 and 2 rather than calling 
str_replace()
multiple times)

...also sporadic CPU load due to totally unrelated processes (even when running 
on
your local machine) can totally skew a benchmark test.

I think you can trust Richard on this one!
and if you don't ... :-) ... then I bet you a beer he'd say we'll then, why not
test it and see!





Cheers,
Ryan



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



Re: [PHP] quick question about using capital letters coding w/ PHP

2005-07-25 Thread Jochem Maas

Richard Lynch wrote:

On Sun, July 24, 2005 11:39 am, Dotan Cohen said:


On 7/24/05, Bruce Gilbert [EMAIL PROTECTED] wrote:


I am well versed in coding with xhtml which requires all lower case
and am pretty much a newbie at PHP so that is why I am asking this
question.

is this acceptible

if ($_post [sender_email] == ) or does at have to be if ($_POST
[sender_email] == )

in short, do uppercase and lowercase always have the same meaning.

thx,



PHP is case-sensitive. UppERCase is NOT the same as uppercase. HTML is
not case sensitive only because browsers are forgiving.



PHP variables are case-sensitive.

PHP FUNCTIONS are not.

You're on your own figuring out if class names/methods are/aren't
case-sensitive this week. :-v


1. classname are case-insensitive (at least in all the builds I have running)
but since 5.0.1 (IIRC) the engine honors your case when using get_class(),
in the past the class name was always returned lowercase. so:

php -r 'class Test {} $t = new Test; if ($t instanceof test) { echo yeah!\n; } echo 
get_class($t),\n;'

will echo:

yeah!
Test

2. methodnames are the same as functionname with regard to case-sensitivity

3. constants (and class constants) are case sensitive.

...somebody beat me with a virtual stick if I am wrong!





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



Re: [PHP] Don't ejecute a sentence if a field is empty

2005-07-25 Thread Jochem Maas

Jesús Alain Rodríguez Santos wrote:

Hello I'm new:
I need to know how can I stop a php sentence if my db is empty, for example
I have writed a php sentence, if every fields from mmy db are full, there


what do you mean by 'php sentence'?


is no problem, but I delete every values from the all fields in my db when
I ejecute my script mysql give me an error, Ej:

$fecha = mysql_query(SELECT event_day, event_month, event_year FROM
$db_table WHERE event_title = $dia_maximo);
$fecha_max = mysql_fetch_array($fecha);
$fecha_maxima = $fecha_max['event_day'];
$diames_maximo = $fecha_max['event_month'];

wehen I ejecute the script the error message is it:


you get this message because $fecha is not what you think it is - I am willing
to bet that it actually contains FALSE), the reason it would contain false is
that your SQL statement is invalid. at the very least it should read something 
like:

SELECT event_day, event_month, event_year
 FROM $db_table
 WHERE event_title = '$dia_maximo'

if the value of $dia_maximo is coing from the user then you should be 
sanitizing the
value before using it in a query (see, as a start,
http://nl3.php.net/manual/en/function.mysql-real-escape-string.php)



Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in /home/www/cfg/prueba/calendar_este2/index.php on line
277

sorry for my english, I'm cuban


dont be! (your english is better than my spanish! this probably goes for most 
people
onm the list!)

besides for some reason I had to really laugh when I read then the word 
'ejecute'
... laughing is always good! :-)

btw I think you meant 'execute'







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



[PHP] A strategy question about using mySQL for saving flat-file stings?

2005-07-25 Thread Al
I've been creating a number of CM applications for a virtual-host website. One feature, of several 
applications, allows the editor [one of our people] to create simple text files.  I've been using 
simple flat-files in a directory for saving the files.


I've gotten tried of dealing with directory permission problems, etc., and am considering using a 
simple mySQL DB for storing the file strings.


Obviously, for each file-string to be unique, its path must be included as part 
of the ID.

Here is my question.

I can use one table for all the path/files and use the following as the primary key 
/home/some-dir/filename.


fields: fullpath-filename | path | type | date | binary-string

path is so the code can do an equivalent of scandir()
type signifies whether data has been serialized() or not.  This is so I can 
save arrays
date is the equivalent of file last mod date.

Or, I can create a separate table for each full-path used and then just use the filename for the 
primary key. In this case, since the table name is in effect the path, only the filename is needed.


The first approach is obviously simplest; but, I'm concerned about getting myself into a trap later 
on.  Anyone offer any suggestions?


Many thanks.

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



[PHP] A directory permissions question

2005-07-25 Thread Al
I'm on virtual-host server and have been following a rule of making certain all directories on the 
root have permissions set to 755.  This is the default when creating new directories with ftp, etc.


Occasionally, I need directories with 757 and have always made certain they 
were not on the root.

I've started thinking about whether my rule really makes any sense for security 
reasons.

In general, the site is well protected by the host's security measures and my use of the Apache 
basic authorization where needed, etc.


Comments and suggestions???

Thanks.

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



Re: [PHP] A strategy question about using mySQL for saving flat-file stings?

2005-07-25 Thread James
I don't know if this is of any help, but you can make a mysql field Unique 
without it being an index/primary key.


- Original Message - 
From: Al [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Monday, July 25, 2005 9:40 AM
Subject: [PHP] A strategy question about using mySQL for saving flat-file 
stings?



I've been creating a number of CM applications for a virtual-host website. 
One feature, of several applications, allows the editor [one of our 
people] to create simple text files.  I've been using simple flat-files in 
a directory for saving the files.


I've gotten tried of dealing with directory permission problems, etc., and 
am considering using a simple mySQL DB for storing the file strings.


Obviously, for each file-string to be unique, its path must be included as 
part of the ID.


Here is my question.

I can use one table for all the path/files and use the following as the 
primary key /home/some-dir/filename.


fields: fullpath-filename | path | type | date | binary-string

path is so the code can do an equivalent of scandir()
type signifies whether data has been serialized() or not.  This is so I 
can save arrays

date is the equivalent of file last mod date.

Or, I can create a separate table for each full-path used and then just 
use the filename for the primary key. In this case, since the table name 
is in effect the path, only the filename is needed.


The first approach is obviously simplest; but, I'm concerned about getting 
myself into a trap later on.  Anyone offer any suggestions?


Many thanks.

--
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] Wierd time shifting problem?!?

2005-07-25 Thread Gord Busse
Greetings,

 

I have an application I built that allows the user to schedule mailings to
subscribed users for specific times and dates. Everything was working fine
as far as I could tell then all of a sudden this time shifting problem
started popping up and seems to be getting worse. The application makes
extensive use of the date() and time() command for generating and displaying
dates and times. It appears that the times are shifting 7 hours into the
future. If I shutdown Apache then start it back up next time I log into the
application all of the times are now displayed correctly. Below is my server
configuration:

 

-  Windows Advanced Server 2000 with all updates applied

-  Apache 2.0.47 non SSL

-  PHP 4.3.3 using Apache2 module

-  MySQL 4.0.14-max

-  phpMyAdmin 2.5.2-pl1

 

The application itself also makes heavy use of:

 

-  Adodb 4.52

-  Smarty 2.6.5

 

I am hoping someone can at least point me in the right direction here as
this is starting to become very annoying. We are going to be moving the
application over to an Mac OSX 10.4 server in the near future but I still
need to find out why this is happening on the Windows server. I have never
had this type of thing happen on this server to my knowledge. I am going to
be upgrading Apache to 2.0.54 and PHP to 4.4.0 probably today to see if this
helps. I have also considered moving Apache back to the 1.3x series as I
have heard that the 2.x series has some stability problems on Windows.

 

Anyways, thank you in advance to anyone that can help me!!!

 

Gord

 

 

 

--

 

Gord Busse  mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]

Website:  http://gordo.bussefamily.net http://gordo.bussefamily.net

 

99 little bugs in the code, 99 bugs in the code,
fix one bug, compile it again...
101 little bugs in the code 

 

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



[PHP] Prepopulating form fields afer an error

2005-07-25 Thread Jack Jackson

Hi,
I have a form and it does basic error checking after submission; when 
the user omits required fields it kicks back the form with highlighted 
errors telling them the error of their ways.


I've sussed out that by populating the value of the field with 
$fieldvalue I can have that form field populated with the data the 
user *did* enter for that field:


something like

input type=text name=email_address value=?php echo $email_address?

That works great. But how can I do the same thing for drop down boxes, 
when they select an option?


I tried the unwieldy,

select name='blah'
 ?php if (!empty(blah)) {
echo option value=';
echo $blah;
echo '
echo $blah;
echo /option\n;
}
   ?


And that, lo and behold, didn't work. Can anyone offer a suggestion?

Thanks in advance
JJ

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



[PHP] how to install phpize and php-config?

2005-07-25 Thread Victor Alvarez
Hi,
 I'm afraid I'm not sure about how to install phpize and php-config. 
 I used to install php using rpms, but this time I downloaded php5 from php.net 
and configure it with the following options:

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-soap 


The installation runs fine but phpize and php-config are required to install 
eaccelerator and now I don't know if I should add the pear module to the above 
line or It should be done another way.
 

locate phpize returns:
/usr/src/php-5.0.4/scripts/phpize.m4
/usr/src/php-5.0.4/scripts/phpize.in
/usr/src/php-5.0.4/scripts/phpize


locate php-config returns:
/usr/src/php-5.0.4/scripts/php-config.in
/usr/src/php-5.0.4/scripts/php-config


but I don't have the executables in  /usr/local/bin, as usual. What should I do?

What about php from the command line? What can I do to install the usual 
/usr/local/bin/php?



Thanks in advance,

  Victor.


[PHP] How would you create a tracking pixel?

2005-07-25 Thread Brian Dunning
I want to create a pixel that can be used to track certain activity  
on the site. I've got it working fine: I just mod_rewrite  
spacer.gif to a PHP app that does what I want it to do; but then I  
don't know how to actually return a blank pixel. Can anyone point me  
in the right direction?


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



Re: [PHP] Prepopulating form fields afer an error

2005-07-25 Thread Matt Darby

select name=user
   $_REQUEST['user']==$curr_user?$select=selected:$select=;
   echo(option $select$curr_user/option);
/select

Jack Jackson wrote:


Hi,
I have a form and it does basic error checking after submission; when 
the user omits required fields it kicks back the form with highlighted 
errors telling them the error of their ways.


I've sussed out that by populating the value of the field with 
$fieldvalue I can have that form field populated with the data the 
user *did* enter for that field:


something like

input type=text name=email_address value=?php echo 
$email_address?


That works great. But how can I do the same thing for drop down boxes, 
when they select an option?


I tried the unwieldy,

select name='blah'
 ?php if (!empty(blah)) {
echo option value=';
echo $blah;
echo '
echo $blah;
echo /option\n;
}
   ?


And that, lo and behold, didn't work. Can anyone offer a suggestion?

Thanks in advance
JJ



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



Re: [PHP] How would you create a tracking pixel?

2005-07-25 Thread Philip Hallstrom
I want to create a pixel that can be used to track certain activity on the 
site. I've got it working fine: I just mod_rewrite spacer.gif to a PHP app 
that does what I want it to do; but then I don't know how to actually return 
a blank pixel. Can anyone point me in the right direction?


Create a 1x1 blank pixel gif and then...

Header(Content-type: image/gif);
readfile(/path/to/spacer.gif);

Why use mod_rewrite?  Why not just do something like...

href=/path/to/phpapp.php/spacer.gif

?

-philip

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



Re: [PHP] How would you create a tracking pixel?

2005-07-25 Thread Matt Darby
A blank (transparent) pixel would be more difficult, but a simple 
colored pixel would be easy:


In target file:
img src=pixel.php

pixel.php

?
$im=imagecreate(1,1);
$white=imagecolorallocate($im,255,255,255);
imagesetpixel($im,1,1,$white);
header(content-type:image/jpg);
imagejpeg($im);
imagedestroy($im);
?

I guess this begs the question, why not use session variables to track 
activity??


Matt Darby

Brian Dunning wrote:

I want to create a pixel that can be used to track certain activity  
on the site. I've got it working fine: I just mod_rewrite  
spacer.gif to a PHP app that does what I want it to do; but then I  
don't know how to actually return a blank pixel. Can anyone point me  
in the right direction?




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



Re: [PHP] How would you create a tracking pixel?

2005-07-25 Thread Brian Dunning

Thanks. A transparent pixel is what I'll need - any guidance on that?


On Jul 25, 2005, at 12:37 PM, Matt Darby wrote:

A blank (transparent) pixel would be more difficult, but a simple  
colored pixel would be easy:


In target file:
img src=pixel.php

pixel.php

?
$im=imagecreate(1,1);
$white=imagecolorallocate($im,255,255,255);
imagesetpixel($im,1,1,$white);
header(content-type:image/jpg);
imagejpeg($im);
imagedestroy($im);
?

I guess this begs the question, why not use session variables to  
track activity??


Matt Darby

Brian Dunning wrote:


I want to create a pixel that can be used to track certain  
activity  on the site. I've got it working fine: I just  
mod_rewrite  spacer.gif to a PHP app that does what I want it to  
do; but then I  don't know how to actually return a blank pixel.  
Can anyone point me  in the right direction?






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



Re: [PHP] Prepopulating form fields afer an error

2005-07-25 Thread Mark Cain

Here's the way I do it:

The following is an HTML code snippet with embedded PHP code for the
intelligence.

select name=shipper
 option value=DHL ? if ($shipped_via == DHL) echo selected;
?DHL
 option value=FedEx ? if ($shipped_via == FedEx) echo selected;
?FedEx
 option value=UPS ? if ($shipped_via == UPS) echo selected;
?UPS
/select




Mark Cain


- Original Message -
From: Jack Jackson [EMAIL PROTECTED]
To: [php] PHP General List php-general@lists.php.net
Sent: Monday, July 25, 2005 2:37 PM
Subject: [PHP] Prepopulating form fields afer an error


 Hi,
 I have a form and it does basic error checking after submission; when
 the user omits required fields it kicks back the form with highlighted
 errors telling them the error of their ways.

 I've sussed out that by populating the value of the field with
 $fieldvalue I can have that form field populated with the data the
 user *did* enter for that field:

 something like

 input type=text name=email_address value=?php echo $email_address?

 That works great. But how can I do the same thing for drop down boxes,
 when they select an option?

 I tried the unwieldy,

 select name='blah'
   ?php if (!empty(blah)) {
  echo option value=';
  echo $blah;
  echo '
  echo $blah;
  echo /option\n;
  }
 ?


 And that, lo and behold, didn't work. Can anyone offer a suggestion?

 Thanks in advance
 JJ

 --
 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] How would you create a tracking pixel?

2005-07-25 Thread Brian Dunning
I did some more STFW and came up with this - I'll try it to see if it  
works.


Header( Content-type: image/gif);
printf (%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c% 
c%c%c%c%c%c%c%c%c%c%c%c%c, 
71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,249,4,1,0,0,0,0 
,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59);


I guess this begs the question, why not use session variables to  
track activity??


A tracking pixel is used in a block of code that you provide to other  
people to post on their sites - i.e. for a web counter, ads, etc.


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



[PHP] Full time PHP/MySQL position available

2005-07-25 Thread Greg Donald
We have a great deal of PHP/MySQL web development work scheduled and
as a result my employer is in need of another coder.  Here is the ad
on Monster:

http://jobsearch.monster.com/getjob.asp?JobID=25532652

Resumes: [EMAIL PROTECTED]

The job is in Nashville, TN, USA.  Only local or soon to be local
candidates will be considered.

Thanks,

-- 
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

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



Re: [PHP] running number

2005-07-25 Thread Robert Sossomon

CREATE TABLE `users` (
  `num` int(10) NOT NULL auto_increment,
  `name` varchar(100) NOT NULL default '',
  `login` varchar(100) NOT NULL default '',
  `password` varchar(20) NOT NULL default '',
  PRIMARY KEY  (`num`),
  KEY `num` (`num`)
) TYPE=MyISAM AUTO_INCREMENT=12345 ;

That should help out.  When creating the table in mysql you can set the 
auto_increment number on the last line, which when you add a new user the query 
looks like:


insert into users values('','name','login','pass');

leaving the first field empty makes it automatically increase it.  The beauty is 
that you can have 400 people registering at once, and their number gets 
assigned as the query is run against the database, no matter what order they hit 
it in, the system will take it as they come.


HTH,
Robert

Roger Thomas is quoted as saying on 7/25/2005 5:21 AM:

I am required to write a user registration script that captures the basics like 
name, phone number etc etc. I would also have to write to mySQL database a 
number that is associated with that user.

At this point of writing, the start of that number is unknown. But the number 
will be incremented by 1 after each successfull registration.

Let's say the number starts from 12345.

I am quite new at all these stuff and would like to seek your advise on the 
*recommended way* of achieving this. I am thinking along these lines:
a) store that number (12345) in a table
b) a user registers and assign that number to him
c) increment number to 12346
d) process repeats for the next registration

Concern: How do tell mySQL to lock the 'number' table when a new registration 
process is about to take place. Is locking the best option here or is/are there 
better ways?

Please advise.

--
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---



--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
512 BrickHaven Drive Suite 220L, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]

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



[PHP] Delivery reports about your e-mail

2005-07-25 Thread cf-newbie
œÔ]»È§¦‹Fik˘ä/ÐÚZQ‰ò'É%
æQç6^ÂCÛ
3é
GÉÝwpÑtžÎ´ÎH*BOðqşªX©¦ tº!‡¡Ø:I9Ó¤xsʛ6ÚOJm¼ôRɽ¸»[ÚÛaÉ^JYû¼£79Ê5¤$}NbÍ4‘ÊÚª{ÞX£~7…»c¢©”bþ
ʗ|/ÃKN7áó¨-ËmBëwځœÄL°9#䩑ªjcÙ孅ôê³dÚ1‰Ãy‚放ú¤­âeiÒMEz?¥(—DÉä2Ù].¾¦êõËʱµVڏOÏÅík'”|²
„ùs¯°.•'z¦÷$_¶˜„)}•Iè݊ݛ6EìEHÇz,ƒ[ØÍîSóà{ð¸AÆ]Bz¯Fá¯)¸¼Ø±mŠ‡ƒÈ¨~K¤YŒM-rÇ¥Æ\éç£öÂ\Nh#ö7ÕÝVÅçt/e3]w«f®ô
™‚
sÓ`·øhXþfª¾¢Hu–6DÉp•`†{ùèaÞÖ[k:õ÷XD¡—Ô-S…Œª‹ý­â)Û³Ô;ã•ôAÒâµÄŸ¶wmBˎa\5–8E˜Û† 
„ˆ³Úk܊”lBs–ç!l…ëzáBôGz?ƒSq9®å„ÐGªù/\â±GÑyÍýÕAãÓϵ³n¡±ýðdU÷¨^t^Ž»(ý%ì´Dú/çð¯±Þú[u¿nŸZu­tCvô6i¿-$[èãàTöù·P­SÔòªÀ†í*t›•1†êfAÊ{®˜˜~º5!†‚… Ø•Åˇ^}EOíÂ]B·õéåò
¦¤8¨. µ!f‘ Aäs–ÓÉJKŽ·7Jꛆä3iÞa ÆpméêN®KrýÙµPù9ÌJ0/èw
‚­•ÅH»;ßJ­ú¸7vEd
±‡«Å£WÓȌ)åª4GwNŸu`¨ñ¬æ¤°¾«AV¾àö;’rQçºxØâ¢fòR,È!À3P¹,¥id†Â:|À4A“‚˜d½%Ž™ŸæHFŸ“{º0ãøÖ:¾bÆ\Ž3“fÞiÉ»nmȎ9Œð/a†ãOÍ0–ü;2áƼ$/s5’b,…Ç
u…øNÂþ
Ïû¬}¾µç³Ç4.»×ãSó
C³Ê~B™.Ãp†'M×h¼Õ¾¹äïåð¦c´æ,C†£Ó½h﮲sô„ 
{¬WšeØg÷óˆèð±]s\WéXEâãab¯°ƒ°£ãô•ˆc'k~蹄÷nû­$´Ÿ6Û;/ȅoHït°t¿t8‘3Æ1Þß7•Î»ù†¤_¤ÙHå1IdNž¹èýj¯„:­¸ÇáfòtÔÕ$¨”ÊŽœ²l½7Ák)öcýð·/eŽJ!Ó-ÚórݵZ:Y´×ßþ¦W!ØXÛìõי÷ϾÄëC¹‡VM–-é)‹‡úÜ­j«z.!¢P1–›å³Sç%?Ø£Rd„ß­”
hÏX?Ñ\aURjx«“ ‹‚!`C´gÃ3Q£îBÍrzuûªÏšÛ‰§KÊY£$J©ÆFÌùÕ·X…zܧœâp[òº­ònϳÔ#³l?#Õªà»;›xçÃüí9Ïö²Ãº;!áCô¯eTù(ÑȔPc¬o”ã%U?H,õ‚KJ4a‹Üäf9¾›¥îAœl‹RL;•¥ñ–¶07†®¯g•vÛàAäfNµÐÀ‚Ý66yá9V×'}ë²{,båŽqLŽsýސ
 …tóA†*nÁƒjÎ`”9#Ñf„¸ ö* *æáÅÁæYû|ý ¸„ŠUm¯'8ógǧj6
!‘s6½ÓîM¦Oƒ
A™¦:'”ĹM«ò©­fáƒe§5Ñgía¦J|¾·²5oOÛ,%n?‘°‡M:íòCÅÑäçµÄY 
iôk-¬•VÃä4ٞ²•:­ì)J.Oæ‹ÁÇPcæÑp—”£ã#SG“$½_µ'BŽ»þƉ¯Õ©rÅ¡FøŸ£z·ªÄaª£­úËlLªœŠV·¡
§¿ÎãnuyIדxq[\ªA·ü4ÀmkLŽÚÏz_Ó4»úL¿:ð
c„¨wüzºéý©Cw¦¢4d¦œv’ûùyú/¬Ö`—o”YOkÀ1ÄÒ»L13à
k¯®ÁÔ¨Y\| À¡#2ïýk6hý*ÂÃYÏ
PbdâK¤A|¦©¨C„Œñ
æXh¨Ý¾À¹w·¸Ö#ÅÂÇkðÑJϟš÷˜vþuH*ڄj;¤\•ý°Æp±ŸçC‹Ý‰/ßG)²oíBïiN„:TK×!P©¥¾09N.ôk—WYn§‡¢eÔ
çuâ#ÏÄû ™Z7h©h¹]×N¤$ 
©ÞuÐøi]Vì4:_íß\ôÌ¾mg¼ýxۗˆâ„ýÚ¡C°g¥äãQ\e÷0Pþ¡p2ÁÅN2VOþ\IÊdøPßÜट‰”áçßýüÂ]NK À¶zøPãêEý
~ȋxÓ¹xÑÐê¿ñۈõLõaR5›X-Ÿß°¤.
]1ñó Ì”`¹¥Í¾Ë)öEGì{íQ¥Ö?¬Š$*“
GÛ2é±mۊ†aØxš`rn¥`·ÅN\QÉ2´%ˆ_SGš½Rl¬E2,ŠLU§]xLFM6ÐO%‰5'pGŒl`´í5´’øã
՟Фœ[xæÁÉ«{¥gtg»,Mîµ_ýʾœWÁ¨ÁV—œTíMWÚà¿-P$vÅ։YËQ}h¾Ö¯Øƒ]ÖÆï
äßÀ塏ËýB÷¹ù‡±ietf2;êûûc©¸‰~öš¾Ù¹[•ñcÊVOÈK~O-U EœÒíTC¯fùîímqËMeµãvF’Ê›m¢.îjߖÀw›•Qíéæ)†cæ’ã¦X¯°‘x(ö|id]„ GÐïUhÅ×R›;fª_m©dÈTjƒÙ•ÛÜ[Ip‚¾‹¡Ç
òGX#ßU)³xâ\ϼ­
Ã~^9iùFýNåHbBªÍ´
6jhԌä~¾%ÁÃ\ÎgóZócKՁ


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

Re: [PHP] Prepopulating form fields afer an error

2005-07-25 Thread Jack Jackson

Thanks so much, Mark, Matt and John! I'll play with all those.

Much appreciated,

JJ

Mark Cain wrote:

Here's the way I do it:

The following is an HTML code snippet with embedded PHP code for the
intelligence.

select name=shipper
 option value=DHL ? if ($shipped_via == DHL) echo selected;
?DHL
 option value=FedEx ? if ($shipped_via == FedEx) echo selected;
?FedEx
 option value=UPS ? if ($shipped_via == UPS) echo selected;
?UPS
/select




Mark Cain


- Original Message -
From: Jack Jackson [EMAIL PROTECTED]
To: [php] PHP General List php-general@lists.php.net
Sent: Monday, July 25, 2005 2:37 PM
Subject: [PHP] Prepopulating form fields afer an error




Hi,
I have a form and it does basic error checking after submission; when
the user omits required fields it kicks back the form with highlighted
errors telling them the error of their ways.

I've sussed out that by populating the value of the field with
$fieldvalue I can have that form field populated with the data the
user *did* enter for that field:

something like

input type=text name=email_address value=?php echo $email_address?

That works great. But how can I do the same thing for drop down boxes,
when they select an option?

I tried the unwieldy,

select name='blah'
 ?php if (!empty(blah)) {
echo option value=';
echo $blah;
echo '
echo $blah;
echo /option\n;
}
   ?


And that, lo and behold, didn't work. Can anyone offer a suggestion?

Thanks in advance
JJ

--
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] [PHP4]: Problem with Form not putting Data in Post Request

2005-07-25 Thread maddog1169

Hi,

I got a slight problem with a Form that doesn't correctly transmits its 
data

correctly under entering some special data.

I put together an example to get hold of the problem but so far I do not 
have a clue

why this doesn't work.

Be great if someone got an idea.


Here is the sample script I put together to see what actually gets 
transferred when the Form is

submitted.

File: ftest.php

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
html
head
titleForm Test Page/title
META http-equiv=Content-Type content=text/html; 
charset=iso-8859-1
/head
body
form action=ftest.php method='post' encoding='text/plain'
			Enter a text: input name=TheText type=text size=10 maxlength=10input 
type=submit

/form

?php
import_request_variables(gPC,FORM);

echo Data from last request:br;
echo POST:br;
print_r ($_POST);
echo brGET:br;
print_r ($_GET);
echo brCookies:br;
print_r ($_COOKIE);
?
/body
/html



Pretty simple and straightforward.

The statistics page I currently work on requires to enter a Groupname.

All but one groupname so far get accepted.


The one that does not get accepted is

Group

including the 

If I enter this into the form and submit the data doesnt get forwarded 
into the post data.

Even changing the encoding did not work.


I triedthat did work strange enough
even  alone works but as soon something is in between  nothing gets 
into the post-data.


Does anybody have an explanation?

Maybe I overlooke something.

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



[PHP] performance.

2005-07-25 Thread Rodolfo Gonzalez Gonzalez

Hi,

this could be a silly question. Is there some performance penalty when 
using the  operator like this:


$var =EOP
add a bunch of text here
and here
EOP;

Just curious.

Thanks,
Rodolfo.

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



Re: [PHP] [PHP4]: Problem with Form not putting Data in Post Request

2005-07-25 Thread Rasmus Lerdorf
maddog1169 wrote:
 The one that does not get accepted is
 
 Group
 
 including the 

You have something like this?

  input type=text name=Group /

It should work.  Make sure you have quotes around it, of course, or
weird stuff will happen.

Try something like this:

form action=f.php method=POST
input type=text name=Group /
/form
?php phpinfo() ?

Type something in the form field and hit return and then scroll down and
look at the $_REQUEST and $_POST variables.

-Rasmus

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



Re: [PHP] running number

2005-07-25 Thread Roger Thomas
Thanks to all that have helped. I am inclined at Robert's suggestion below that 
would free me from worrying about locking issues. Thanks everybody.

--
Roger

Quoting Robert Sossomon [EMAIL PROTECTED]:

 CREATE TABLE `users` (
`num` int(10) NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
`login` varchar(100) NOT NULL default '',
`password` varchar(20) NOT NULL default '',
PRIMARY KEY  (`num`),
KEY `num` (`num`)
 ) TYPE=MyISAM AUTO_INCREMENT=12345 ;
 
 That should help out.  When creating the table in mysql you can set the 
 auto_increment number on the last line, which when you add a new user the
 query 
 looks like:
 
 insert into users values('','name','login','pass');
 
 leaving the first field empty makes it automatically increase it.  The beauty
 is 
 that you can have 400 people registering at once, and their number
 gets 
 assigned as the query is run against the database, no matter what order they
 hit 
 it in, the system will take it as they come.
 
 HTH,
 Robert
 
 Roger Thomas is quoted as saying on 7/25/2005 5:21 AM:
  I am required to write a user registration script that captures the basics
 like name, phone number etc etc. I would also have to write to mySQL database
 a number that is associated with that user.
  
  At this point of writing, the start of that number is unknown. But the
 number will be incremented by 1 after each successfull registration.
  
  Let's say the number starts from 12345.
  
  I am quite new at all these stuff and would like to seek your advise on the
 *recommended way* of achieving this. I am thinking along these lines:
  a) store that number (12345) in a table
  b) a user registers and assign that number to him
  c) increment number to 12346
  d) process repeats for the next registration
  
  Concern: How do tell mySQL to lock the 'number' table when a new
 registration process is about to take place. Is locking the best option here
 or is/are there better ways?
  
  Please advise.
  
  --
  Roger
  
  
  ---
  Sign Up for free Email at http://ureg.home.net.my/
  ---
  
 
 -- 
 Robert Sossomon, Business and Technology Application Technician
 4-H Youth Development Department
 512 BrickHaven Drive Suite 220L, Campus Box 7606
 N.C. State University
 Raleigh NC 27695-7606
 Phone: 919/515-8474
 Fax:   919/515-7812
 [EMAIL PROTECTED]
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 





---
Sign Up for free Email at http://ureg.home.net.my/
---

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



[PHP] Searching and Count within array

2005-07-25 Thread Bagus Nugroho
Hi Master,
 
I have an array as : 
$myArray = 
array('four','four','four','four','one,,'three','three','three','two','two'); 
 
Then I want output like this, 
//==
four is 4 times
three is 3 times
two is 2 times
one is 1 times //(it 's better if one is 1 time).
//===
 
How can I search and count the array? Or better search and count directly using 
MySQL API?
 
Note : array was generated from MySQL DB
//==
?php
$connection = mysql_connect(localhost,user,pass);
mysql_select_db(ecd);
$result = mysql_query(SELECT * FROM pre_main ORDER BY mDate DESC LIMIT 
20,$connection);
while ($row = mysql_fetch_row($result)) {
$myArray[] = $row[0];
}
   sort ($myArray);//sorting array
//result : $myArray = 
array('two','two','three','three','three','four','four','four','four','one');

?
//=
 
Thanks in advance
 


Re: [PHP] Searching and Count within array

2005-07-25 Thread Rasmus Lerdorf
array_count_values()

Bagus Nugroho wrote:
 Hi Master,
  
 I have an array as : 
 $myArray = 
 array('four','four','four','four','one,,'three','three','three','two','two'); 
  
 Then I want output like this, 
 //==
 four is 4 times
 three is 3 times
 two is 2 times
 one is 1 times //(it 's better if one is 1 time).
 //===
  
 How can I search and count the array? Or better search and count directly 
 using MySQL API?
  
 Note : array was generated from MySQL DB
 //==
 ?php
 $connection = mysql_connect(localhost,user,pass);
 mysql_select_db(ecd);
 $result = mysql_query(SELECT * FROM pre_main ORDER BY mDate DESC LIMIT 
 20,$connection);
 while ($row = mysql_fetch_row($result)) {
 $myArray[] = $row[0];
 }
sort ($myArray);//sorting array
 //result : $myArray = 
 array('two','two','three','three','three','four','four','four','four','one');
 
 ?
 //=
  
 Thanks in advance
  
 

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