php-general Digest 24 Jul 2006 06:26:36 -0000 Issue 4255

2006-07-24 Thread php-general-digest-help

php-general Digest 24 Jul 2006 06:26:36 - Issue 4255

Topics (messages 239710 through 239718):

parse text file
239710 by: Benjamin Adams
239711 by: Joe Wollard
239712 by: Sameer N Ingole
239713 by: Stut
239715 by: Benjamin Adams

Re: Step by step code running
239714 by: Robert Cummings

PHP on IIS and MS SQL 2000
239716 by: Igor Kryltsov
239717 by: Frank M. Kromann
239718 by: Igor Kryltsov

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---
how would I read a file one line at a time:

?php
if($lines  $alllines){ 
$newline .= $lines;
}
?

something like that, I'm cofused on if I use fread, something  which
will do one line at a time?
---End Message---
---BeginMessage---

Benjamin,

Use the file() function, it will read a file then return each line as
a new element in an array.
http://php.net/file

- Joe

On 7/23/06, Benjamin Adams [EMAIL PROTECTED] wrote:

how would I read a file one line at a time:

?php
if($lines  $alllines){
$newline .= $lines;
}
?

something like that, I'm cofused on if I use fread, something  which
will do one line at a time?

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


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

Joe Wollard wrote:

Benjamin,

Use the file() function, it will read a file then return each line as
a new element in an array.
http://php.net/file

And if file is big (biiig) then you want
http://php.net/fgets

--
Sameer N. Ingole
http://weblogic.noroot.org/
---
Better to light one candle than to curse the darkness.
---End Message---
---BeginMessage---
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Joe Wollard wrote:
 Use the file() function, it will read a file then return each line as
 a new element in an array.
 http://php.net/file

This will not read the file one line at a time. Try http://php.net/fgets.

- -Stut

 On 7/23/06, Benjamin Adams [EMAIL PROTECTED] wrote:
 how would I read a file one line at a time:

 ?php
 if($lines  $alllines){
 $newline .= $lines;
 }
 ?

 something like that, I'm cofused on if I use fread, something  which
 will do one line at a time?

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


 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEw9uX2WdB7L+YMm4RAvR3AJ4rsGP3ZUGBRuoEiv8ilwB9wzyu1wCggOm6
6ctTQ1Xufn0rStHFLcyOFB0=
=dGhv
-END PGP SIGNATURE-
---End Message---
---BeginMessage---
Thanks, fgets works great  didn't know the function before.

On Mon, 2006-07-24 at 01:56 +0530, Sameer N Ingole wrote:
 Joe Wollard wrote:
  Benjamin,
 
  Use the file() function, it will read a file then return each line as
  a new element in an array.
  http://php.net/file
 And if file is big (biiig) then you want
 http://php.net/fgets
 
 -- 
 Sameer N. Ingole
 http://weblogic.noroot.org/
 ---
 Better to light one candle than to curse the darkness.
 
---End Message---
---BeginMessage---
On Sun, 2006-07-23 at 08:51, Ryan A wrote:
 Hi,
 
 I need to explain a script to a pal of mine but either
 i cant explain it properly or he just cant get the
 concept being new to php's slightly advanced stuff
 (OO and classes, mind you...i ain't no expert myself
 in this, more like Jochem's(from this list) field of
 expertise)
 
 I remember in my old C++ days we used to use something
 that basically showed how the code executed, line by
 line, running in the loops etc
 
 anything like that for PHP?
 
 Personally I use EditPlus and a lot of echo/print
 statements when I debug, I try to keep things simple.

You're looking for a debugger. There's a whole thread on the go right
now for PHP Debugger Recommendations. Personally I prefer the
echo/print_r method that you're probably already using... but as you say
you're trying to demonstrate so that's a bit different.

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.  |
`'
---End Message---
---BeginMessage---
Our story is
We started building our application back in 2002 on FreeBSD/Apache with
PostgreSQL.

Than company we are working for became bigger and they bought SQL 

Re: [PHP] PHP on IIS and MS SQL 2000

2006-07-24 Thread Igor Kryltsov
Hi Frank,

Thanks a lot for your reply.
Just to clarify (Unix style of win commands :) ):
cp php_mssql.dll  php_mssql.dll.bak
cp  php_dblib.dll php_mssql.dll

What about freetds.conf?
Just touch it or it has to have something inside?
Can you give an example in this case?
And probably most importantly where to put it, which folder?


Thank you,

Igor

Frank M. Kromann [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Replace php_mssql.dll with php_dblib.dll. You aæso need to create a
 freetds.conf file but you remove the limitations created by ntwdblib and
 you get a thread safe environment.

 - Frank

  Our story is
  We started building our application back in 2002 on FreeBSD/Apache with
  PostgreSQL.
 
  Than company we are working for became bigger and they bought SQL 2000
  server and we had to switch to MS SQL 2000.
 
  Now company became even more bigger and they decided that keeping
 FreeBSD
  server which nobody knows and nobody wants to learn in IT department is
 a
  risk and we have been asked to move from FreeBSD/Apache to Win 2000/ IIS
 5.
 
  Back in 2002 we choose ADODB as db abstraction library.
 
  With OS switched we noticed a few things:
 
  1) ado-mssql driver which uses mssql_* calls in PHP has a problem of
  returning only first 255 characters for VARCHARs. I can not agree that
  casting varchars as text in SQL queries solves this problem (it may be
  solves it for simple applications) as TEXT datatype has many limitations
 on
  its use in SQL queries - you can't use LIKE and DISTINCT and other.
 
  2) ado-ado_mssql. This one uses not ntwdblib.dll but Win COM object ADO
 (if
  I am right)
  There are no problems with varchars but COM object does not like
 DATETIMEs
  less than 1970 and all your employees which were 'lucky' to be born
 before
  1970  suddenly become all born in 1970.
 
  I am not sure but it looks like choice of platform - PHP on IIS with
 MSSQL
  is not a good idea.
  And by trying to minimize IT department risk (necessity to support OS
 they
  do not know) we maximize our application support issues.
 
  If anybody can suggest or share experience - please do.
 
  Thank you,
 
  Igor Kryltsov
 
  -- 
  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] select option and php

2006-07-24 Thread weetat

Hi all ,

 I have a code below :

 function goToPageSelect($selectname,$totalItems){

  $_logger = new Log4jLogger();
  $_logger-logdebug(starting ..goToPageSelect());
  $_logger-logdebug(starting ..goToPageSelect(), $totalItems);

  $selecthtml = Go to Page:select name=\$selectname\ 
class=\inputfield\ onchange=\javascript:gotoPage()\;

  for ($index=0;$index$totalItems;$index++){
$value = $value + 1;
$selecthtml .= option value=\$value\$value/option;
  }
  $selecthtml .= /select;
  return $selecthtml;
}

It will produce the html tag as shown below:
script language=JavaScript
function gotoPage(){

 var urlpath = ../listflag.php?start=pageID=+3;
 document.forms['listfrm'].method = 'post';
 document.forms['listfrm'].action = urlpath;
 document.forms['listfrm'].submit;

}
/script

form name=listfrm
Go to Page:select name=pageid class=inputfield 
onchange=javascript:gotoPage()

option value=11/option
option value=22/option
option value=33/option
option value=44/option
option value=55/option
/select 
/form   


I tried using onchange in the select tag,but it did not work. It go to 
the javascript but the form is not submitted .


Anyideas why?

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



[PHP] Re: Step by step code running

2006-07-24 Thread weetat

Hi Ryan,

  I use Log4jPhp to log any debug value.
  I think it is better than using echo or print method.

Thanks

- weetat

Ryan A wrote:

Hi,

I need to explain a script to a pal of mine but either
i cant explain it properly or he just cant get the
concept being new to php's slightly advanced stuff
(OO and classes, mind you...i ain't no expert myself
in this, more like Jochem's(from this list) field of
expertise)

I remember in my old C++ days we used to use something
that basically showed how the code executed, line by
line, running in the loops etc

anything like that for PHP?

Personally I use EditPlus and a lot of echo/print
statements when I debug, I try to keep things simple.

Thanks!

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


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



[PHP] Checking $_POST var and stripping

2006-07-24 Thread Chris Grigor
Hi

Can anyone help with this ? its checking the $_POST and seeing if any of the
items begin with answer_,
if the do it should remove it from the beginning and place it into
$value_new.. does not seem to work though...



foreach($_POST as $qid = $value) {

$findme = 'answer_';
 if(stripos($value, $findme)) {
 $value_new = ltrim($value);
 print $value_newbr;
 }

}

Thanks

Chris


RE: [PHP] Checking $_POST var and stripping

2006-07-24 Thread Jay Blanchard
[snip]
Can anyone help with this ? its checking the $_POST and seeing if any of
the
items begin with answer_,
if the do it should remove it from the beginning and place it into
$value_new.. does not seem to work though...

foreach($_POST as $qid = $value) {

$findme = 'answer_';
 if(stripos($value, $findme)) {
 $value_new = ltrim($value);
 print $value_newbr;
 }

}
[/snip]

stripos should be strops and would look for a numeric value, not what
you want. You want strstr I believe

foreach($_POST as $qid = $value) {

$findme = 'answer_';
 if(strstr($value, $findme)) {
 $value_new = ltrim($value);
 print $value_newbr;
 }

}

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



RE: [PHP] select option and php

2006-07-24 Thread Jay Blanchard
[snip]
It will produce the html tag as shown below:
script language=JavaScript
function gotoPage(){

  var urlpath = ../listflag.php?start=pageID=+3;
  document.forms['listfrm'].method = 'post';
  document.forms['listfrm'].action = urlpath;
  document.forms['listfrm'].submit;

}
/script

form name=listfrm
Go to Page:select name=pageid class=inputfield 
onchange=javascript:gotoPage()
option value=11/option
option value=22/option
option value=33/option
option value=44/option
option value=55/option
/select   
/form 


I tried using onchange in the select tag,but it did not work. It go to 
the javascript but the form is not submitted .

Anyideas why?
[/snip]

In gotoPage() you're not referencing the value of pageid
(document.forms['listfrm'].pageid.value). More of a JavaScript question,
are you a member of a JavaScript list?

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



Re: [PHP] Help with dynamic radio buttons

2006-07-24 Thread Dimiter Ivanov

On 7/22/06, Chris Grigor [EMAIL PROTECTED] wrote:

Afternoon all

I need some help here with a problem on dynamic radio buttons.

I have a script that calls a database for a list of questions. The questions
are returned and each question needs to have 5
radio buttons assigned to it. The radio buttons are a score of 1 - 5 (1
being bad, 5 being good)

For example

1 . How would you rate your vacation?1 2 3 4 5 --- those are the radio
buttons.
2. How would you rate your dining at the resort? 1 2 3 4 5


Ok so I have all the questions being returned, I was thinking when creating
the radio buttons as follows

input name=?php echo $row_get_question_list['id']? type=radio
value=1 /
input name=?php echo $row_get_question_list['id']? type=radio
value=2 /
input name=?php echo $row_get_question_list['id']? type=radio
value=3 /
input name=?php echo $row_get_question_list['id']? type=radio
value=4 /
input name=?php echo $row_get_question_list['id']? type=radio
value=5 /

The input name for each radio group is the questions id from the database.
If there are 50 questions you would have 50 radio button answers submitted.
How are you going to identify the radio buttons being submitted as they are
dynamic? and also I would need to be stored in the
session data as they might want to go back / forward a page.

So basically I need to go through each $_GET item, identify it as a radio
submission and put it into an array.

Has anyone done anything similar before / or can point me in the right
direction??

Kind regards
Chris





You won't get all the radio buttons sumbitted.
You will have only the checked buttons.
So for every question's ID you will have the radio button that was checked.

Just do some testing.
Try echoing the $_POST array after you submit the form.
var_dump($_POST);

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



Re: [PHP] Step by step code running

2006-07-24 Thread Jochem Maas
Ryan A wrote:
 Hi,
 
 I need to explain a script to a pal of mine but either
 i cant explain it properly or he just cant get the
 concept being new to php's slightly advanced stuff
 (OO and classes, mind you...i ain't no expert myself
 in this, more like Jochem's(from this list) field of
 expertise)

I'm pretty good at abusing php's OO if thats what you mean ;-)

 
 I remember in my old C++ days we used to use something
 that basically showed how the code executed, line by
 line, running in the loops etc
 
 anything like that for PHP?

a debugger would be needed to single step through the code,
although how much help a debugger will be if someone doesn't
understand php's OO principles [very well] is questionable,
generally one has to have a good idea of what the code is meant to
be doing in order to make head/tails of the debuggers output.

maybe we can help in explaining what your script does?

 
 Personally I use EditPlus and a lot of echo/print
 statements when I debug, I try to keep things simple.
 
 Thanks!
 
 --
 - The faulty interface lies between the chair and the keyboard.
 - Creativity is great, but plagiarism is faster!
 - Smile, everyone loves a moron. :-)
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com 
 

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



Re: [PHP] Re: Stumped! 4.x to 5.1 problem!!

2006-07-24 Thread markw
[snip]

 seems the perceived problem is being caused by something else?


Sorry, I have to respectfully disagree.

I was converting all indexes to string indexes, and simply using
zend_hash_update to re-constitute the objects and they simply did not
work. When I scanned indexes strings to test for purely numeric content,
and when true, used zend_hash_index_update instead, it worked.

This behavior appears different in 5.1.X from 4.x, I can't explain it
100%, but I know that this change fixed the problem I was seeing.

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



Re: [PHP] Re: Stumped! 4.x to 5.1 problem!!

2006-07-24 Thread Jochem Maas
Mark wrote:
 Mark wrote:
 
 I have an extension that seems to create PHP variables correctly, and
 var_dump() doesn't seem to have a problem. but upon moving to 5.1.x it
 fails.

 Anyone have a suggestion?
 
 Well, it is fixed. Evidently, PHP 5.1 sees a difference between $var[0]
 and $var[0]. It never did before.

a quick test on 5.1.1 shows this not to be the case
(at least at the userland level):

# php -v
PHP 5.1.1 (cli) (built: Jan 18 2006 17:41:38)
Copyright (c) 1997-2005 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2005 Zend Technologies

# php -r '$r = array();$r[0] = test;var_dump($r[0],$r[0]);$r[0] = 
test2;var_dump($r[0],$r[0]);'
string(4) test
string(4) test
string(5) test2
string(5) test2

seems the perceived problem is being caused by something else?

 
 BTW: this behavior is almost certainly in wddx.
 

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



Re: [PHP] Re: Step by step code running

2006-07-24 Thread Mariano Guadagnini
Personally, i think the best one is Zend debugger. It's integrated on 
the Zend IDE, and let you debug remotely, from a server. The problem 
aside, is that is paid and closed source,  neverthless is the best IMHO.

You may give it a try: www.zend.com/products/zend_studio
HTH,

Mariano.

weetat wrote:

Hi Ryan,

  I use Log4jPhp to log any debug value.
  I think it is better than using echo or print method.

Thanks

- weetat

Ryan A wrote:

Hi,

I need to explain a script to a pal of mine but either
i cant explain it properly or he just cant get the
concept being new to php's slightly advanced stuff
(OO and classes, mind you...i ain't no expert myself
in this, more like Jochem's(from this list) field of
expertise)

I remember in my old C++ days we used to use something
that basically showed how the code executed, line by
line, running in the loops etc

anything like that for PHP?

Personally I use EditPlus and a lot of echo/print
statements when I debug, I try to keep things simple.

Thanks!

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 






--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.4/396 - Release Date: 24/07/2006

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



Re: [PHP] Step by step code running

2006-07-24 Thread Ryan A
Hey,


  I need to explain a script to a pal of mine but
 either
  i cant explain it properly or he just cant get the
  concept being new to php's slightly advanced
 stuff
  (OO and classes, mind you...i ain't no expert
 myself
  in this, more like Jochem's(from this list) field
 of
  expertise)

 
 I'm pretty good at abusing php's OO if thats what
 you mean ;-)


:) Your name just came  to mind when I thought of OO
as I saw a few of your threads before bitching (no
disrespect meant) about PHP5's OO, and future
compatability 




 a debugger would be needed to single step through
 the code,
 although how much help a debugger will be if someone
 doesn't
 understand php's OO principles [very well] is
 questionable,

Hmmm, I dont think I myself qualify then!

 generally one has to have a good idea of what the
 code is meant to
 be doing in order to make head/tails of the
 debuggers output.

Well, the script runs without a problem, so he can see
what the output is and what it is accomplishing, I
guess he just needs to hit the books a bit harder.
I learnt (brushed up) OO/class programming via an
online PHP site, they had some really good articles,
but just cant remember the site name :(

 
 maybe we can help in explaining what your script
 does?

Trust me, it would take longer for me to write down
the whole thing than actually show the guy's mum and
make her understand!
Writing descriptions for a script is always a PITA.


Cheers!
Ryan

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] Step by step code running

2006-07-24 Thread Ryan A
Thanks Rob, will check it out!


 You're looking for a debugger. There's a whole
 thread on the go right
 now for PHP Debugger Recommendations. Personally I
 prefer the
 echo/print_r method that you're probably already
 using... but as you say
 you're trying to demonstrate so that's a bit
 different.
 
 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
 
 


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



[PHP] Comparing Strings

2006-07-24 Thread Nils Holland

Hi folks,

well, I have a really dumb question:

I have the following script at http://www.tisys.org/misc/test.php:

?php
echo $_GET['license'];
?

Now I call it like this:

http://www.tisys.org/misc/test.php? 
license=0701770160811371731660412452242420381052542100071831272071031621 
17160180165221170166096217228128


And in fact, it echos the whole, long GET-string!

Now i have the following script a tttp://www.tisys.org/misc/ 
ol_license.php:


?php
if ($_GET['license'] ==  
07017701608113717316604124522424203810525421000718312720710316211716018 
0165221170166096217228128)

{
echo '1';
} else {
echo '0';
}
?

I launch it like:

http://www.tisys.org/misc/ol_license.php? 
license=0701770160811371731660412452242420381052542100071831272071031621 
17160180165221170166096217228128


And it returns a 1, which means: The strings match. Now I call it like

http://www.tisys.org/misc/ol_license.php? 
license=1701770160811371731660412452242420381052542100071831272071031621 
17160180165221170166096217228128


that is, I have changed the first number of my GET-String from a 0 to  
a 1 and indeed, the script returns 0, meaning: The scripts don't  
match. *HOWEVER*, no I call the script like:


http://www.tisys.org/misc/test.php? 
license=0701770160811371731660412452242420381052542100071831272071031621 
17160180165221170166096217228129


that is, I have changed the last number of the GET-String from an 8  
to a 9, and interestingly, it returns 1 this time, which means the  
strings do match, which, however, they don't.


My guess is that PHP only sees / compares the strings up to a certain  
position. Is this possible? And if so, is there any way around this,  
so that my whole string is seen?


Greetings and thanks in advance,
Nils

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



[PHP] database connections

2006-07-24 Thread Ryan A
Hi,

This is not really a problem, more like a slightly OT
question.

Recently I have been testing some CMS/carts/BB
boards and other related software, sometimes at the
end of the page the software outputs the time it took
to generate the page and the number of database calls.

I have seen some scripts give the number of database
calls in the hundreds (from 100 - 400) just to
generate one single damn page.
Isnt that just too much?

Or am I blowing smoke and MySql can handle that
without a sweat on a shared hosting environment? (with
say100 page requests per minute?)

Thanks!

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] database connections

2006-07-24 Thread Robert Cummings
On Mon, 2006-07-24 at 11:46, Ryan A wrote:
 Hi,
 
 This is not really a problem, more like a slightly OT
 question.
 
 Recently I have been testing some CMS/carts/BB
 boards and other related software, sometimes at the
 end of the page the software outputs the time it took
 to generate the page and the number of database calls.
 
 I have seen some scripts give the number of database
 calls in the hundreds (from 100 - 400) just to
 generate one single damn page.
 Isnt that just too much?

It's usually a sign of poor programming and/or purist OOP programming.

When I say purist OOP programming some idiot retrieves X topic IDs from
the database in 1 query, then proceeds to execute X queries in the
constructor of the object to build the actual topic objects, then each
of these stupid constructors then proceed to build their children
objects (replies) which they do by doing a single query that returns Y
children IDs, and then it loops over these and builds the objects via
the constructor which again makes another Y queries, and of course those
stupid objects go and create their children. I saw one really retarded
implementation of this kind of system where an excess of 2 queries
were issued to the database -- on a homepage nonetheless :/ I think it
was a testament to MySQLs speed that it performed within a reasonable
timeframe (under 3 seconds). Either way, such an application will never
be scalable such that the database server resides on a different
computer than the webserver (even over a LAN).

 Or am I blowing smoke and MySql can handle that
 without a sweat on a shared hosting environment? (with
 say100 page requests per minute?)

MySQL can probably handle it. But try not to do programming like that
yourself. Stuff like that gives PHP a bad name.

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



[PHP] Re: Comparing Strings

2006-07-24 Thread Adam Zey

Nils Holland wrote:

Hi folks,

well, I have a really dumb question:

I have the following script at http://www.tisys.org/misc/test.php:

?php
echo $_GET['license'];
?

Now I call it like this:

http://www.tisys.org/misc/test.php?license=070177016081137173166041245224242038105254210007183127207103162117160180165221170166096217228128 



And in fact, it echos the whole, long GET-string!

Now i have the following script a tttp://www.tisys.org/misc/ol_license.php:

?php
if ($_GET['license'] == 
070177016081137173166041245224242038105254210007183127207103162117160180165221170166096217228128) 


{
echo '1';
} else {
echo '0';
}
?

I launch it like:

http://www.tisys.org/misc/ol_license.php?license=070177016081137173166041245224242038105254210007183127207103162117160180165221170166096217228128 



And it returns a 1, which means: The strings match. Now I call it like

http://www.tisys.org/misc/ol_license.php?license=170177016081137173166041245224242038105254210007183127207103162117160180165221170166096217228128 



that is, I have changed the first number of my GET-String from a 0 to a 
1 and indeed, the script returns 0, meaning: The scripts don't match. 
*HOWEVER*, no I call the script like:


http://www.tisys.org/misc/test.php?license=070177016081137173166041245224242038105254210007183127207103162117160180165221170166096217228129 



that is, I have changed the last number of the GET-String from an 8 to a 
9, and interestingly, it returns 1 this time, which means the strings do 
match, which, however, they don't.


My guess is that PHP only sees / compares the strings up to a certain 
position. Is this possible? And if so, is there any way around this, so 
that my whole string is seen?


Greetings and thanks in advance,
Nils


Maybe it's interpreting something as a number somewhere. Did you try 
using === instead of == for your comparisons?


Regards, Adam Zey.

PS: Why is your license key so insanely long, and why doesn't it use 
alphanumeric characters to reduce the length?


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



Re: [PHP] database connections

2006-07-24 Thread Ryan A
Hey Rob,
Thanks for replying.


 It's usually a sign of poor programming and/or
 purist OOP programming.
 
 When I say purist OOP programming...
 I saw
 one really retarded
 implementation of this kind of system where an
 excess of 2 queries
 were issued to the database -- on a homepage
 nonetheless :/ 


That IS retarded, I wonder why someone would want to
do that.


 I think it
 was a testament to MySQLs speed that it performed
 within a reasonable
 timeframe (under 3 seconds). 

MySql is a workhorse... def one of my top 3 DBs (I
came into LAMP from Java/Oracle)

I see you have seen some of the apps I was talking
about, even though I have not mentioned any names to
offend anyone.

I was curious about this because I am working on a
project (with other team players) and we have a way of
building something with either lots more (complicated)
code and fewer database calls or less code and
multiple tables.

If we take the second option (multiple tables) I am
talking about maybe 15 database calls per page, and
the site will get around (i guess) 300-750 requests
for a page a minute at is peak.

The good thing is it will be running on a dedicated
server, sharing with around 5 of our other sites... no
exceptionally great traffic other than mentioned above
on the other sites either, plus most of the other
sites are plain html sites.


  Or am I blowing smoke and MySql can handle that
  without a sweat on a shared hosting environment?
 (with
  say100 page requests per minute?)
 
 MySQL can probably handle it. But try not to do
 programming like that yourself. Stuff like that
gives PHP a bad name.


I wouldnt be going to those extremes, was thinking of
around 5-15 queries per page.



Think we'll have a problem?

Thanks!
Ryan

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



[PHP] PHP Developer Needed in San Jose, CA w/ Occasional Travel to Palo Alto

2006-07-24 Thread Franco Pawlisz
Hello Everyone,

 

Let me introduce myself, My name is Franco Pawlisz with ObjectWave Corporation 
a Software Engineering Company Headquartered in Chicago, IL. 

 

ObjectWave Corporation specializes in the use of object-oriented (OO) 
technologies to design, develop and deploy software. ObjectWave's clients are 
typically companies seeking custom enterprise-class solutions for 
client-server, web-based and business-to-business e-commerce applications that 
can only be successfully realized by using a disciplined approach to software 
construction. Our approach delivers solutions that meet and exceed customer 
requirements for software flexibility, maintainability, extensibility and 
reusability.

 

ObjectWave is currently looking for a PHP Developer interested in a Minimum 6 
month Contract with one of our premier clients. 

 

Specifics:

 

My Client is specifically looking for a developer with strong front end PHP 
experience knowledge of Java and or Ruby is a major plus.

 

The pay rate for this position is open for negotiation based on experience. 
Please let me know as soon as possible how we can touch base on this 
opportunity with a word copy of your resume and a good time to reach you.

 

Regards,

 

Franco Pawlisz

Senior Technical Recruiter

ObjectWave Corporation

333 W. Wacker Drive

Suite 1860

Chicago, IL 60606

HYPERLINK mailto:[EMAIL PROTECTED][EMAIL PROTECTED]

Office: (312) 269-0111 x127

Cell: (312) 217-9669

HYPERLINK http://www.objectwave.comwww.objectwave.com

 

 


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.4/396 - Release Date: 7/24/2006
 



This e-mail, and any attachments thereto, is confidential and is intended only 
for the individual(s) named.  If you are not the intended recipient, please let 
us know by e-mail reply and delete it from your system; do not copy/save this 
e-mail or disclose its contents to anyone.  E-mail transmissions cannot be 
guaranteed to be secure or error-free as the transmission could be interrupted, 
corrupted, lost, destroyed, altered, arrive late or contain viruses.  
ObjectWave does not accept liability for any errors or omissions in the 
contents of this e-mail which arise as a result of e-mail transmission.  The 
views expressed in this e-mail do not necessarily reflect those of ObjectWave 
or its affiliates.






RE: [PHP] database connections

2006-07-24 Thread Kilbride, James P.
While that kind of query structure can be a huge issue the biggest
problem, and performance penalty, occurs if the programmer is opening
and closing actual real connections. A good structure would use a
singleton connection that is opened only the first time it is called and
the rest of the time returns the connection object already opened. Or,
use pooling or similar types of things. You will get orders of magnitude
increase in speed by not reopening the database multiple times per page
especially if you are seeing 15,20 or especially hundreds of
connections. Sometimes though you have no real choice but to build a
system that has to generate multiple queries, so don't judge the page
simply on the number of queries but on the completity of the reporting
and the number of database connections opened(you will occasionally need
more than one if you arn't pulling all the results at once, using
cursors or partial retrievals instead and have to have multiple result
sets open at any given time).

James Kilbride 

 -Original Message-
 From: Ryan A [mailto:[EMAIL PROTECTED] 
 Sent: Monday, July 24, 2006 2:34 PM
 To: Robert Cummings
 Cc: php php
 Subject: Re: [PHP] database connections
 
 Hey Rob,
 Thanks for replying.
 
 
  It's usually a sign of poor programming and/or purist OOP 
 programming.
  
  When I say purist OOP programming...
  I saw
  one really retarded
  implementation of this kind of system where an excess of 
 2 queries 
  were issued to the database -- on a homepage nonetheless :/
 
 
 That IS retarded, I wonder why someone would want to do that.
 
 
  I think it
  was a testament to MySQLs speed that it performed within a 
 reasonable 
  timeframe (under 3 seconds).
 
 MySql is a workhorse... def one of my top 3 DBs (I came into 
 LAMP from Java/Oracle)
 
 I see you have seen some of the apps I was talking about, 
 even though I have not mentioned any names to offend anyone.
 
 I was curious about this because I am working on a project 
 (with other team players) and we have a way of building 
 something with either lots more (complicated) code and fewer 
 database calls or less code and multiple tables.
 
 If we take the second option (multiple tables) I am talking 
 about maybe 15 database calls per page, and the site will get 
 around (i guess) 300-750 requests for a page a minute at is peak.
 
 The good thing is it will be running on a dedicated server, 
 sharing with around 5 of our other sites... no exceptionally 
 great traffic other than mentioned above on the other sites 
 either, plus most of the other sites are plain html sites.
 
 
   Or am I blowing smoke and MySql can handle that without a 
 sweat on a 
   shared hosting environment?
  (with
   say100 page requests per minute?)
  
  MySQL can probably handle it. But try not to do programming 
 like that 
  yourself. Stuff like that
 gives PHP a bad name.
 
 
 I wouldnt be going to those extremes, was thinking of around 
 5-15 queries per page.
 
 
 
 Think we'll have a problem?
 
 Thanks!
 Ryan
 
 --
 - The faulty interface lies between the chair and the keyboard.
 - Creativity is great, but plagiarism is faster!
 - Smile, everyone loves a moron. :-)
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection 
 around http://mail.yahoo.com 
 
 --
 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] database connections

2006-07-24 Thread Robert Cummings
On Mon, 2006-07-24 at 15:15, Kilbride, James P. wrote:
 While that kind of query structure can be a huge issue the biggest
 problem, and performance penalty, occurs if the programmer is opening
 and closing actual real connections. A good structure would use a
 singleton connection that is opened only the first time it is called and
 the rest of the time returns the connection object already opened. Or,
 use pooling or similar types of things. You will get orders of magnitude
 increase in speed by not reopening the database multiple times per page
 especially if you are seeing 15,20 or especially hundreds of
 connections. Sometimes though you have no real choice but to build a
 system that has to generate multiple queries, so don't judge the page
 simply on the number of queries but on the completity of the reporting
 and the number of database connections opened(you will occasionally need
 more than one if you arn't pulling all the results at once, using
 cursors or partial retrievals instead and have to have multiple result
 sets open at any given time).

Well the system was using one of those not so insightful global database
connections so opening up the connection was not the problem. I'm well
aware of where bottlenecks occur, but I assure you such a system is not
very scalable over a LAN even if you only open one connection. But I
guess it doesn't matter if scalability isn't your concern... until
further down the road anyways... YOUCH. Either way, using a factory to
produce the objects from the row data is much more efficient since you
can use a single query to get all children in one shot. This is still
not perfect due to recursive nature (there are ways to do it without as
some forum discussion have pointed to but I forget the links) but
depending on the branchiness of the tree structure will provide a much
better response time.

As for judging, I guess I was the only one there to see something as
simple as retrieval of product categories and products get really out of
hand. I reduced the queries to under 200... and since we were still only
opening one connection I know the time cost was reduced to about 1/5.
The queries could have been reduced more but it was more work than the
customer felt was worth the additional savings.

Knowing what choices are available is part of competence. If all you see
is one choice, there may in fact only be one choice, or you may be too
inexperienced to see the others that exist.

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] database connections

2006-07-24 Thread Ryan A


--- Kilbride, James P. [EMAIL PROTECTED]
wrote:

 While that kind of query structure can be a huge
 issue the biggest
 problem, and performance penalty, occurs if the
 programmer is opening
 and closing actual real connections. A good
 structure would use a
 singleton connection that is opened only the first
 time it is called and
 the rest of the time returns the connection object
 already opened. Or,
 use pooling or similar types of things. You will get
 orders of magnitude
 increase in speed by not reopening the database
 multiple times per page
 especially if you are seeing 15,20 or especially
 hundreds of
 connections. Sometimes though you have no real
 choice but to build a
 system that has to generate multiple queries, so
 don't judge the page
 simply on the number of queries but on the
 completity of the reporting
 and the number of database connections opened(you
 will occasionally need
 more than one if you arn't pulling all the results
 at once, using
 cursors or partial retrievals instead and have to
 have multiple result
 sets open at any given time).
 
 James Kilbride 

Hey James,
Thanks for replying.

Sorry, I guess i was not clear on that.

Its just one connection, I meant 15-20 queries not
connections.

Thanks!
Ryan

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



[PHP] Stripping weird characters again...

2006-07-24 Thread Paul Nowosielski
Dear All,

I'm having a problem replacing these bad characters from a feed.

Example:
descriptionThe United Kingdom92s National Arena Association has elected 
Geoff Huckstep, the current CEO of the National Ice Centre and Nottingham 
Arena, as chairman./description

The 92is actually a single quote. I have these from some of the data dumps. 
I can't figure out what exactly to strip.

When I view the file in vi they appear like 92 93 94 (highlighted in 
blue like controll characters.

Can someone point me in the right direction to purge this from my feed?


Thank you,

Paul Nowosielski
Webmaster

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



[PHP] Re: Stripping weird characters again...

2006-07-24 Thread Adam Zey

Paul Nowosielski wrote:

Dear All,

I'm having a problem replacing these bad characters from a feed.

Example:
descriptionThe United Kingdom92s National Arena Association has elected 
Geoff Huckstep, the current CEO of the National Ice Centre and Nottingham 
Arena, as chairman./description


The 92is actually a single quote. I have these from some of the data dumps. 
I can't figure out what exactly to strip.


When I view the file in vi they appear like 92 93 94 (highlighted in 
blue like controll characters.


Can someone point me in the right direction to purge this from my feed?


Thank you,

Paul Nowosielski
Webmaster


You want str_replace with arrays as parameters.

Regards, Adam Zey.

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



Re: [PHP] Re: Stripping weird characters again...

2006-07-24 Thread Paul Nowosielski
I understand I need to do a string replace. 
 
Should I do it like so?

$search = array(chr(145),chr(146),chr(147),chr(148),chr(150),chr(151));
$replace = array(',','','','-','-');

Is this what you mean?


Thank you,
-- 
Paul Nowosielski
Webmaster





On Monday 24 July 2006 16:12, Adam Zey wrote:
 Paul Nowosielski wrote:
  Dear All,
 
  I'm having a problem replacing these bad characters from a feed.
 
  Example:
  descriptionThe United Kingdom92s National Arena Association has
  elected Geoff Huckstep, the current CEO of the National Ice Centre and
  Nottingham Arena, as chairman./description
 
  The 92is actually a single quote. I have these from some of the data
  dumps. I can't figure out what exactly to strip.
 
  When I view the file in vi they appear like 92 93 94 (highlighted
  in blue like controll characters.
 
  Can someone point me in the right direction to purge this from my feed?
 
 
  Thank you,
 
  Paul Nowosielski
  Webmaster

 You want str_replace with arrays as parameters.

 Regards, Adam Zey.

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



Re: [PHP] Re: Stripping weird characters again...

2006-07-24 Thread Paul Nowosielski
It works, thank you!

On Monday 24 July 2006 16:21, Paul Nowosielski wrote:
 I understand I need to do a string replace.

 Should I do it like so?

 $search = array(chr(145),chr(146),chr(147),chr(148),chr(150),chr(151));
 $replace = array(',','','','-','-');

 Is this what you mean?


 Thank you,
 --
 Paul Nowosielski
 Webmaster

 On Monday 24 July 2006 16:12, Adam Zey wrote:
  Paul Nowosielski wrote:
   Dear All,
  
   I'm having a problem replacing these bad characters from a feed.
  
   Example:
   descriptionThe United Kingdom92s National Arena Association has
   elected Geoff Huckstep, the current CEO of the National Ice Centre and
   Nottingham Arena, as chairman./description
  
   The 92is actually a single quote. I have these from some of the data
   dumps. I can't figure out what exactly to strip.
  
   When I view the file in vi they appear like 92 93 94 (highlighted
   in blue like controll characters.
  
   Can someone point me in the right direction to purge this from my feed?
  
  
   Thank you,
  
   Paul Nowosielski
   Webmaster
 
  You want str_replace with arrays as parameters.
 
  Regards, Adam Zey.

-- 
Paul Nowosielski
Webmaster

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



[PHP] SQL Result Set - HTML Table Fragment (but Simple)

2006-07-24 Thread Michael B Allen
Anyone have a PHP fragment that just prints a very simple html table
from the contents of a db result set? I don't want phpmyadmin or anything
remotely that complex. I want something that simply extracts the header
info and prints a basic HTML table. It should be about 10 lines of code
I suspect. If so, can you post it?

Mike

-- 
Michael B Allen
PHP Extension for SSO w/ Windows Group Authorization
http://www.ioplex.com/

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



[PHP] Re: SQL Result Set - HTML Table Fragment (but Simple)

2006-07-24 Thread Adam Zey

Michael B Allen wrote:

Anyone have a PHP fragment that just prints a very simple html table
from the contents of a db result set? I don't want phpmyadmin or anything
remotely that complex. I want something that simply extracts the header
info and prints a basic HTML table. It should be about 10 lines of code
I suspect. If so, can you post it?

Mike



Writing code in a mail window, so forgive any errors or ugly code. This 
will print a table with the first row as headers of the field names, and 
 each row after that is a database row. I hope.


$firstrow = true;
echo table;
while ( $row = mysql_fetch_assoc($result) ) {
  if ( $firstrow ) {
echo tr . implode(/trtr, array_keys($row)) . /tr;
$firstrow = false;
  }

  echo tr;
  foreach ( $row as $value ) {
echo td$value/td;
  }
  echo /tr;
}
echo /table;

Essentially what it does is, loop over each row, and if we're the first 
row, write out the headers, and for all rows, write out each field. I 
haven't tested this, just typed it up from memory now, so I'm not sure 
if it'll compile.


Regards, Adam Zey.

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



[PHP] Re: SQL Result Set - HTML Table Fragment (but Simple)

2006-07-24 Thread Adam Zey

Adam Zey wrote:

Michael B Allen wrote:

Anyone have a PHP fragment that just prints a very simple html table
from the contents of a db result set? I don't want phpmyadmin or anything
remotely that complex. I want something that simply extracts the header
info and prints a basic HTML table. It should be about 10 lines of code
I suspect. If so, can you post it?

Mike



Writing code in a mail window, so forgive any errors or ugly code. This 
will print a table with the first row as headers of the field names, and 
 each row after that is a database row. I hope.


$firstrow = true;
echo table;
while ( $row = mysql_fetch_assoc($result) ) {
  if ( $firstrow ) {
echo tr . implode(/trtr, array_keys($row)) . /tr;
$firstrow = false;
  }

  echo tr;
  foreach ( $row as $value ) {
echo td$value/td;
  }
  echo /tr;
}
echo /table;

Essentially what it does is, loop over each row, and if we're the first 
row, write out the headers, and for all rows, write out each field. I 
haven't tested this, just typed it up from memory now, so I'm not sure 
if it'll compile.


Regards, Adam Zey.


On second thought, I'm not sure why I didn't use implode for the second 
one too, it makes things simpler (and possibly faster):


$firstrow = true;
echo table;
while ( $row = mysql_fetch_assoc($result) ) {
  if ( $firstrow ) {
echo tr . implode(/trtr, array_keys($row)) . /tr;
$firstrow = false;
  }

  echo tr . implode(/trtr, $row) . /tr;
}
echo /table;

And BTW, this code assumes that you've done your MySQL query and have 
$result as the return value of a mysql_query() call or something.



Regards, Adam Zey.

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



Re: [PHP] Re: SQL Result Set - HTML Table Fragment (but Simple)

2006-07-24 Thread Larry Garfield
On Monday 24 July 2006 18:50, Adam Zey wrote:

 Writing code in a mail window, so forgive any errors or ugly code. This
 will print a table with the first row as headers of the field names, and
   each row after that is a database row. I hope.

 $firstrow = true;
 echo table;
 while ( $row = mysql_fetch_assoc($result) ) {
if ( $firstrow ) {
  echo tr . implode(/trtr, array_keys($row)) . /tr;
  $firstrow = false;
}

echo tr;
foreach ( $row as $value ) {
  echo td$value/td;
}
echo /tr;
 }
 echo /table;

You don't need to pull the headers from the data, actually.  You can access 
the fields in the result object directly.

$result = mysql_query($sql);

echo table;

echo tr;
$num_fields = mysql_num_fields($result);
for($i=0; $i  $num_fields; $i++) {
  echo th, mysql_field_name($result, $i), /th;
}
echo /tr;

while ( $row = mysql_fetch_row($result) ) {
   echo trtd . implode(/tdtd, $row) . /td/tr;
}
echo /table;

The above should work, I think. :-)

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



[PHP] xml v php question

2006-07-24 Thread tedd

Hi gang:

Why does starting my php script with --

?xml version=1.0 encoding=utf-8?

-- stop it from running?

I would like to use php in a page, but the page has to begin with a 
xml declaration to generate a quirksmode for IE6 and under while 
permitting IE7 to be left in standards mode.


We've tried it in both Wordpress and Textpattern and both are php and 
neither are able to parse a document with an xml declaration above 
the header.


Is this problem solvable?  I've been told that better minds have 
already tried and failed to resolve this issue.


So, what say you group?

Thanks in advance for any replies, comments, explanations, or solutions.

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] select option and php

2006-07-24 Thread weetat

Hi Jay ,

   I am not in the javascript group.
   Btw , i have added document.forms['listfrm'].pageid.value in the 
page , but the form is not submitted ?


  var pageid = document.forms['listfrm'].pageid.value;
  var urlpath = ../listflag.php?start=pageID=+pageid;

  document.forms['listfrm'].method = 'post';  -- did not submit form 
at all

  document.forms['listfrm'].action = urlpath;
  document.forms['listfrm'].submit;

Any ideas why ? How to submit form when user change value in the select 
tag ?


Thanks


Jay Blanchard wrote:

[snip]
It will produce the html tag as shown below:
script language=JavaScript
function gotoPage(){

  var urlpath = ../listflag.php?start=pageID=+3;
  document.forms['listfrm'].method = 'post';
  document.forms['listfrm'].action = urlpath;
  document.forms['listfrm'].submit;

}
/script

form name=listfrm
Go to Page:select name=pageid class=inputfield 
onchange=javascript:gotoPage()

option value=11/option
option value=22/option
option value=33/option
option value=44/option
option value=55/option
/select 
/form   


I tried using onchange in the select tag,but it did not work. It go to 
the javascript but the form is not submitted .


Anyideas why?
[/snip]

In gotoPage() you're not referencing the value of pageid
(document.forms['listfrm'].pageid.value). More of a JavaScript question,
are you a member of a JavaScript list?


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



Re: [PHP] xml v php question

2006-07-24 Thread Larry Garfield
Disable short tags.

If short tags are enabled, the PHP parser sees the ? and switches into PHP 
mode.  It then starts parsing the xml and sees that it's not proper PHP, 
and freaks out.  

You can:

a) Use PHP to print out the XML declaration as a string:
?php print '?xml version=1.0 encoding=utf-8?'; ?

b) Disable short tags so that the PHP parser ignores ? and only recognizes 
?php.

The correct answer is (b).  (PHP 6 won't even have short tags, so get used to 
not having them.)

On Monday 24 July 2006 20:42, tedd wrote:
 Hi gang:

 Why does starting my php script with --

 ?xml version=1.0 encoding=utf-8?

 -- stop it from running?

 I would like to use php in a page, but the page has to begin with a
 xml declaration to generate a quirksmode for IE6 and under while
 permitting IE7 to be left in standards mode.

 We've tried it in both Wordpress and Textpattern and both are php and
 neither are able to parse a document with an xml declaration above
 the header.

 Is this problem solvable?  I've been told that better minds have
 already tried and failed to resolve this issue.

 So, what say you group?

 Thanks in advance for any replies, comments, explanations, or solutions.

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

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



Re: [PHP] SQL Result Set - HTML Table Fragment (but Simple)

2006-07-24 Thread Michael B Allen
Ok, I've been tinkering a little. This isn't simple but it's not a
lot of code either.

Basically the user supplies an array of cell renderers associated
with column names. Each renderer is a function name that will be called
to modify an array() representing an HTML TD element. The result is
printed to yield an HTML table. I think this is pretty extensible. You
can render columns or individual cells differently depending on the text
or position of the coloumn or cell. You can format numbers and dates,
render buttons, ... whatever you want.

The first column renderer below renders every odd column a light shade
of grey. The second renderer demonstrates formmating a timestamp. The
third renderer colors the background of an individual cell green if the
numeric value is greater than 1000.

I'm a C person myself. Can someone clean this up / improve on it (e.g. how
can I pass parameters to renderers?).

Mike

function db_cr_shade_odd($td, $i) {
if (($i % 2) == 0) { 
$td['style'] = background-color: #c0c0c0;;
} 
return $td;
} 
function db_cr_unix_ts_mdty($td, $i) {
if (isset($td['#text'])) {
$td['#text'] = date(M j, Y g:i a, $td['#text']);
}
return $td;
}
function db_result_print($result, $names, $renderers, $default_renderer) {
echo tr\n;
$i = 0; 
while ($i  mysql_num_fields($result)) {
$meta = mysql_fetch_field($result, $i);
$name = $meta-name;
if (isset($renderers[$name])) {
$renderers[$i] = $renderers[$name];
}
if (isset($names[$name])) {
$name = $names[$name];
}
echo th$name/td\n;
$i++;
}
echo /tr\n;
 
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo tr; 
$i = 0; 
foreach ($row as $str) { 
$td = array('#text' = $str);
if ($default_renderer) {
$td = call_user_func($default_renderer, $td, $i);
}   
if (isset($renderers[$i])) {
$td = call_user_func($renderers[$i], $td, $i);
}
echo td;
foreach ($td as $attr = $value) {
if (substr($attr, 0, 1) != '#') {
echo  $attr=\$value\;
}   
}
echo  . $td['#text'] . /td;
$i++;
}
echo /tr\n;
}
}

// EXAMPLE USAGE

// custom renderer specific to invoice report
function db_cr_gt_1000($td, $i) {
$amount = $td['#text'];
if ($amount  1000.00) {
$td['style'] = background-color: #00ff00;;
}
return $td;
}

// pretty column names
$names = array(
invoice_id = ID,
invoice_date = Date, 
invoice_amount = Amount,
invoice_transaction_id = Txn. ID,
invoice_approval_code = App. Code,
invoice_name = Name, 
invoice_email = Email,
invoice_company = Company);
// renderers
$renderers = array(
invoice_date = db_cr_mysql_ts_mdyt,
invoice_amount = db_cr_gt_1000);

echo table class=\d\ border='0' cellpadding=\3\\n;
db_result_print($result, $names, $renderers, db_cr_shade_odd);
echo /table\n;

-- 
Michael B Allen
PHP Extension for SSO w/ Windows Group Authorization
http://www.ioplex.com/

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



Re: [PHP] PHP Developer Needed in San Jose, CA w/ Occasional Travel to Palo Alto

2006-07-24 Thread Paul Scott

On Mon, 2006-07-24 at 14:17 -0500, Franco Pawlisz wrote:

 My Client is specifically looking for a developer with strong front end PHP 
 experience knowledge of Java and or Ruby is a major plus.
 

What the heck is front end PHP, or am I misinterpreting the bad
punctuation (or lack thereof)?

--Paul

All Email originating from UWC is covered by disclaimer  
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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