php-general Digest 3 Mar 2006 12:16:19 -0000 Issue 3995

2006-03-03 Thread php-general-digest-help
php-general Digest 3 Mar 2006 12:16:19 - Issue 3995 Topics (messages 231390 through 231399): Re: APC and PHP 5.1.2 231390 by: Jens Kleikamp Re: Only 4 of 5... 231391 by: John Nichel Problems with file() 231392 by: Julius Hacker 231394 by: Chris Re: binding

Re: [PHP] Coordenates latitude / longitude on PHP - SOLVED

2006-03-03 Thread Ruben Rubio Rey
It wasn't so hard! I ll post the solution, so everyone ll be able to do it function getlocationcoords($lat, $lon, $width, $height) { $lat=$lat*20; $lon=$lon*28; $x = (($lon + 180) * ($width / 360)); $y = ((($lat * -1) + 90) * ($height / 180)); return

[PHP] help with nl2br

2006-03-03 Thread canobit canobit
I have cobbled the following code that when it retrieves the data from Mysql, the data is displayed with no line breaks which results in one large paragraph. I have been trying for quite awhile without sucess to get nl2br working with this code. The original data is entered by the user via a

[PHP] DOMElement::setAttribute() manual example question

2006-03-03 Thread Andreas Korthaus
Hi! I've a question regarding the example in DOMElement::setAttribute() chapter of the PHP manual: http://de3.php.net/dom-domelement-setattribute There, an attribute is added to an element this way: ?php $doc = new DOMDocument(1.0); $node = $doc-createElement(root); $newnode =

[PHP] Beware of OS X PHP security update...

2006-03-03 Thread Marcus Bointon
The OS X security update issued yesterday includes a PHP 'fix', by which they mean that it installs PHP 4.4.1. If you have installed PHP 5 from elsewhere, it will get trashed along with your PEAR setup. PEAR is now completely confused or me and just crashes when I try to do anything.

RE: [PHP] LDAP confusion

2006-03-03 Thread jblanchard
[snip] I vaguely recall you couldn't do an anonymous bind to an active directory system - you had to properly authenticate before you could do a search. You didn't include the bind stuff so I can't tell if that's the problem :) [/snip] I thought that I was not doing an anonymous bind, until I

[PHP] Re: DOMElement::setAttribute() manual example question

2006-03-03 Thread Rob
Andreas Korthaus wrote: Hi! I've a question regarding the example in DOMElement::setAttribute() chapter of the PHP manual: http://de3.php.net/dom-domelement-setattribute There, an attribute is added to an element this way: ?php $doc = new DOMDocument(1.0); $node = $doc-createElement(root);

Re: [PHP] help with nl2br

2006-03-03 Thread Max Schwanekamp
canobit canobit wrote: I have cobbled the following code that when it retrieves the data from Mysql, the data is displayed with no line breaks which results in one large paragraph. I have been trying for quite awhile without sucess to get nl2br working with this code. The original data is

Re: [PHP] help with nl2br

2006-03-03 Thread canobit canobit
Thanks Pablo, that did the trick with one minor change, I had to remove the . in the quotations as it is was leading the first line of text with a . echo . nl2br($row[2]) . /b; TD. On 3/3/06, Pablo M. Rivas [EMAIL PROTECTED] wrote: Hello canobit: Did you try echo . . nl2br($row[1]) . /b;

Re: [PHP] Only 4 of 5...

2006-03-03 Thread Gustav Wiberg
- Original Message - From: John Nichel [EMAIL PROTECTED] To: PHP General php-general@lists.php.net Sent: Friday, March 03, 2006 2:30 AM Subject: Re: [PHP] Only 4 of 5... Gustav Wiberg wrote: Hi there! What's wrong here?? ?php ... open db... $sql = SELECT IDPic, picNameSmall FROM

[PHP] Coding Practice: Use global $var or pass in by refernce

2006-03-03 Thread Mark Steudel
I was wondering what the general rule on using the global driective versus passing in a variable by reference, why you should or shouldn't, etc. e.g. function () { global $db; $res = $db-query( SQL); } or function ( $db ) { $res = $db-query( SQL); } -- PHP General Mailing

Re: [PHP] Re: DOMElement::setAttribute() manual example question

2006-03-03 Thread Gustav Wiberg
- Original Message - From: Rob [EMAIL PROTECTED] To: Andreas Korthaus [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, March 03, 2006 4:43 PM Subject: [PHP] Re: DOMElement::setAttribute() manual example question Andreas Korthaus wrote: Hi! I've a question regarding the

Re: [PHP] help with nl2br

2006-03-03 Thread canobit canobit
snip All that said, you might want to invest some time in learning a DB abstraction layer such as ADODb or PEAR::DB (there are lots of others). You'll commonly find convenience functions to do things like output query results into an HTML table. Why waste time debugging the wheel? --

Re: [PHP] Coding Practice: Use global $var or pass in by refernce

2006-03-03 Thread Gustav Wiberg
- Original Message - From: Mark Steudel [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Friday, March 03, 2006 7:46 PM Subject: [PHP] Coding Practice: Use global $var or pass in by refernce I was wondering what the general rule on using the global driective versus passing in a

Re: [PHP] Re: DOMElement::setAttribute() manual example question

2006-03-03 Thread Rob
Gustav Wiberg wrote: Check out: http://de3.php.net/manual/en/function.dom-domdocument-createelement.php ( This function creates a new instance of class DOMElement. This node will not show up in the document unless it is inserted with e.g. DOMNode-appendChild().) I really don't understand

Re: [PHP] Re: APC and PHP 5.1.2

2006-03-03 Thread steve
Thanks for that! It meant that I should look in other directions which helped me figure out the problem. Can you try again with: apc.optimization=1 I think the optimizer is what dies with php 5.1.x. It works for me now if I don't have that line. :) Too bad APC can't work with Zend Optimizer,

Re: [PHP] Coding Practice: Use global $var or pass in by refernce

2006-03-03 Thread Andreas Korthaus
Hi Gustav! Gustav Wiberg wrote: My oponion is that is insane to use global variables. The main drawback with global variables is that is very easy to mix up variables, and keep track of what variable belongs to what. So an advice: Don't use it! Ok, so what's your recommendation to solve the

Re: [PHP] Re: DOMElement::setAttribute() manual example question

2006-03-03 Thread Gustav Wiberg
- Original Message - From: Rob [EMAIL PROTECTED] To: Gustav Wiberg [EMAIL PROTECTED] Cc: Andreas Korthaus [EMAIL PROTECTED]; php-general@lists.php.net Sent: Friday, March 03, 2006 8:04 PM Subject: Re: [PHP] Re: DOMElement::setAttribute() manual example question Gustav Wiberg wrote:

Re: [PHP] Coding Practice: Use global $var or pass in by refernce

2006-03-03 Thread Luis MagaƱa
I would go for: - you can create a new instance (new DB) in every methode (but you usually only want a single DB-connection per script, and where do you pass config-data to access the DB?) or This way the code keeps well organized and about the use of only one connection I wouldn't worry

Re: [PHP] Coding Practice: Use global $var or pass in by refernce

2006-03-03 Thread Gustav Wiberg
- Original Message - From: Andreas Korthaus [EMAIL PROTECTED] To: php-general@lists.php.net; Gustav Wiberg [EMAIL PROTECTED] Sent: Friday, March 03, 2006 8:53 PM Subject: Re: [PHP] Coding Practice: Use global $var or pass in by refernce Hi Gustav! Gustav Wiberg wrote: My oponion

[PHP] Re: Coding Practice: Use global $var or pass in by refernce

2006-03-03 Thread Jens Kleikamp
Mark Steudel wrote: I was wondering what the general rule on using the global driective versus passing in a variable by reference, why you should or shouldn't, etc. e.g. function () { global $db; $res = $db-query( SQL); } or function ( $db ) { $res = $db-query( SQL);

[PHP] Re: APC and PHP 5.1.2

2006-03-03 Thread Jens Kleikamp
steve wrote: Thanks for that! It meant that I should look in other directions which helped me figure out the problem. Can you try again with: apc.optimization=1 Your script also seems to work on my sytem with optimization=1. -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

[PHP] Swedish sourgeforge for php-prg

2006-03-03 Thread Gustav Wiberg
Hi there! I wonder as a swedish PHP-programmer if there are any sites like sourgeforge.net but in swedish? /G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Coding Practice: Use global $var or pass in by refernce

2006-03-03 Thread Robert Cummings
On Fri, 2006-03-03 at 14:53, Andreas Korthaus wrote: - use a factory/singleton, which is not so much better than a global variable (and again, what about config-data?). I use a global configuration to register database connection params. InterJinn uses something like the following:

[PHP] Help with Acrostix

2006-03-03 Thread Jay Contonio
I am using acrostix so I can add text and photos to an existing pdf. So far I have the text working with this, ?php require(acrostix.php); $text = file_get_contents(blah.txt); $doc = ax_open_pdf_file(todo.pdf); $style = ax_create_standard_styles(Times-Roman, 16); $region =

Re: [PHP] Coding Practice: Use global $var or pass in by refernce

2006-03-03 Thread tedd
So what's the way [using Globals] you'd recommend and why? best regards Andreas Andreas: I have to agree with Gustav on this -- I very seldom use Globals. I might use one for debugging, but not for finished code. Their use simply creates problems in porting code, keeping things modular, and

Re: [PHP] Re: APC and PHP 5.1.2

2006-03-03 Thread steve
Really? Now I am confused on why I'd be having a problem and you aren't. I even deleted the php.ini file and made a new one that only contained this: extension=apc.so apc.optimization=1 and it still failed. At least I have it working without the second line. My phpinfo() has this as the

Re: [PHP] Beware of OS X PHP security update...

2006-03-03 Thread Geoff Martin
On 03/03/2006, at 11:15 PM, Marcus Bointon wrote: The OS X security update issued yesterday includes a PHP 'fix', by which they mean that it installs PHP 4.4.1. If you have installed PHP 5 from elsewhere, it will get trashed along with your PEAR setup. PEAR is now completely confused or

Re: [PHP] Coding Practice: Use global $var or pass in by refernce

2006-03-03 Thread Rafael
Andreas Korthaus wrote: Hi Gustav! Gustav Wiberg wrote: My oponion is that is insane to use global variables. The main drawback with global variables is that is very easy to mix up variables, and keep track of what variable belongs to what. So an advice: Don't use it! Ok, so what's your

[PHP] Prepared statements

2006-03-03 Thread Julius Hacker
Hi, so I need help again: I want to use prepared statements to insert lots of data in my MySQL-database. For that I use foreach because I have an array containing all necessary information. Before that foreach, I use mysqli_stmt_init, mysql_stmt_prepare and mysql_stmt_bind_param. In the

[PHP] Mysql Rows

2006-03-03 Thread benifactor
i need to find a way to find out what number of a row is in a database... for example: //this is the database Username: Chuck Password: adsasa Username: jimmy Password: adsf Username: stewart Password: dfds the information i need is what row jimmy resides on.. this is what i tried: function

Re: [PHP] Mysql Rows

2006-03-03 Thread Anthony Ettinger
define $1 = 0 outside your loop. i'm curious why you are relying on row-order in the database? Typically you'd have a PRIMARY KEY auto_increment for something like this. On 3/3/06, benifactor [EMAIL PROTECTED] wrote: i need to find a way to find out what number of a row is in a database...

Re: [PHP] Prepared statements

2006-03-03 Thread Anthony Ettinger
are you executing the statement in your loop too? On 3/3/06, Julius Hacker [EMAIL PROTECTED] wrote: Hi, so I need help again: I want to use prepared statements to insert lots of data in my MySQL-database. For that I use foreach because I have an array containing all necessary information.

[PHP] Re: APC and PHP 5.1.2

2006-03-03 Thread Jens Kleikamp
steve wrote: Really? Now I am confused on why I'd be having a problem and you aren't. I even deleted the php.ini file and made a new one that only contained this: extension=apc.so apc.optimization=1 and it still failed. At least I have it working without the second line. My phpinfo() has this

Re: [PHP] CLI utility

2006-03-03 Thread Kevin Kinsey
John Nichel wrote: Ray Cantwell wrote: Hello again, I was wondering if any of you knew of a good command line utility for php5 on linux? The box i write on has no X-windows. Ray. A command line utility to do what? Indeed. Context might even indicate he's looking for something to use

Re: [PHP] CLI utility

2006-03-03 Thread Ray Cantwell
Indeed i am looking for a tool to write my code with on a box that has no gui environment, However if a Jihad is going to ensue because of it, i shall withdraw my question, head bowed. RTC Kevin Kinsey wrote: John Nichel wrote: Ray Cantwell wrote: Hello again, I was wondering if any of

Re: [PHP] CLI utility

2006-03-03 Thread Kevin Kinsey
Ray Cantwell wrote: Indeed i am looking for a tool to write my code with on a box that has no gui environment, However if a Jihad is going to ensue because of it, i shall withdraw my question, head bowed. RTC context snipped in froward violation of common sense Well, kudos to you for

Re: [PHP] Mysql Rows

2006-03-03 Thread benifactor
thank you. the table does have and id feild that auto increments, however if you delete a user there will be a gap between the users between which would not be what is not acurate enough. thank you for you help. simple fix. i should have caught it. - Original Message - From: Anthony

Re: [PHP] Re: APC and PHP 5.1.2

2006-03-03 Thread Rasmus Lerdorf
Jens Kleikamp wrote: steve wrote: Thanks for that! It meant that I should look in other directions which helped me figure out the problem. Can you try again with: apc.optimization=1 Your script also seems to work on my sytem with optimization=1. The optimizer doesn't work very well at

[PHP] Is it better to return a multi-array, or an array of objects?

2006-03-03 Thread Daevid Vincent
I'm building a fairly large project. I've been trying to follow best practices, but I'm a bit worried about performance. Using PHP 5.1 and mySQL 5.0. I have product and company classes. So when a user does a search of the database, is it better/faster/etc. to return just a two dimensional

Re: [PHP] Is it better to return a multi-array, or an array of objects?

2006-03-03 Thread chris smith
On 3/4/06, Daevid Vincent [EMAIL PROTECTED] wrote: I'm building a fairly large project. I've been trying to follow best practices, but I'm a bit worried about performance. Using PHP 5.1 and mySQL 5.0. I have product and company classes. So when a user does a search of the database, is it

Re: [PHP] LDAP confusion

2006-03-03 Thread chris smith
On 3/4/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: [snip] I vaguely recall you couldn't do an anonymous bind to an active directory system - you had to properly authenticate before you could do a search. You didn't include the bind stuff so I can't tell if that's the problem :) [/snip]

Re: [PHP] Is it better to return a multi-array, or an array of objects?

2006-03-03 Thread Murray @ PlanetThoughtful
On 4/03/2006 3:10 PM, Daevid Vincent wrote: I'm building a fairly large project. I've been trying to follow best practices, but I'm a bit worried about performance. Using PHP 5.1 and mySQL 5.0. I have product and company classes. So when a user does a search of the database, is it

[PHP] Re: Is it better to return a multi-array, or an array of objects?

2006-03-03 Thread Manuel Lemos
Hello, on 03/04/2006 02:10 AM Daevid Vincent said the following: Does it matter that I'm only showing say 10 fields of perhaps 50 or more possible ones (that the classes and database would hold)? My gut feeling is to use an array as it seems less overhead and faster. However the object

Re: [PHP] Mysql Rows

2006-03-03 Thread Murray @ PlanetThoughtful
On 4/03/2006 2:49 PM, benifactor wrote: thank you. the table does have and id feild that auto increments, however if you delete a user there will be a gap between the users between which would not be what is not acurate enough. thank you for you help. simple fix. i should have caught it. -

Re: [PHP] Mysql Rows

2006-03-03 Thread Anthony Ettinger
On 3/3/06, Murray @ PlanetThoughtful [EMAIL PROTECTED] wrote: On 4/03/2006 2:49 PM, benifactor wrote: thank you. the table does have and id feild that auto increments, however if you delete a user there will be a gap between the users between which would not be what is not acurate enough.

Re: [PHP] Coding Practice: Use global $var or pass in by refernce

2006-03-03 Thread Paul Scott
On Fri, 2006-03-03 at 16:19 -0500, tedd wrote: Perhaps I'm fortunate, but I usually find a way around using Globals. And since I've been coding in PHP, I've never been forced to use them. Just my 2c... In our framework, I use globals as well, although I do tend to agree with Tedd regarding

RE: [PHP] Is it better to return a multi-array, or an array of objects?

2006-03-03 Thread Daevid Vincent
SELECT field1, field2, field8 FROM mytable WHERE whatever as opposed to: SELECT * FROM mytable WHERE whatever It may be you're already doing this, but it wasn't clear from your post. Yes, Murray, thank you, and I am already doing this. :) -- PHP General Mailing List

Re: [PHP] Mysql Rows

2006-03-03 Thread Murray @ PlanetThoughtful
I have to agree with Anthony - why are you using row order to determine something relating to users? I couldn't follow your brief explanation above, and the fact that you're doing it sets off some soft alarm bells about the design of your application. Why is it important that there shouldn't be

Re: [PHP] Mysql Rows

2006-03-03 Thread Anthony Ettinger
On 3/3/06, Murray @ PlanetThoughtful [EMAIL PROTECTED] wrote: I have to agree with Anthony - why are you using row order to determine something relating to users? I couldn't follow your brief explanation above, and the fact that you're doing it sets off some soft alarm bells about the

Re: [PHP] Mysql Rows

2006-03-03 Thread Murray @ PlanetThoughtful
On 4/03/2006 5:36 PM, Anthony Ettinger wrote: Yep, that's one good reason among many for using unique ids. Thinking a little about the OP's question, I could understand row order being relevant in certain situations where you wanted to display something like, You were the