php-general Digest 31 Mar 2009 10:51:48 -0000 Issue 6041
php-general Digest 31 Mar 2009 10:51:48 - Issue 6041 Topics (messages 290869 through 290883): Re: PHP + MySQL - Load last inserts 290869 by: haliphax 290870 by: Chris formulate nested select 290871 by: PJ 290872 by: Chris 290875 by: Jim Lucas 290876 by: Chris 5.2.9 changes - phpwiki 290873 by: Charles Sprickman 290878 by: Michael A. Peters Re: Problem with header(); 290874 by: Phpster Working in UTF-8 - BOM trouble 290877 by: Merlin Morgenstern 290882 by: Jan G.B. 290883 by: Andrea Giammarchi GSoC - XDebug Profiling Web Frontend 290879 by: Alpár Török thread question 290880 by: Toke Herkild 290881 by: Carlos Medina Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On Mon, Mar 30, 2009 at 5:10 PM, Chris dmag...@gmail.com wrote: haliphax wrote: On Mon, Mar 30, 2009 at 9:13 AM, Sebastian Muszytowski s.muszytow...@googlemail.com wrote: haliphax schrieb: [..cut...] Except when your primary key value rolls over, or fills a gap between two other rows that was left when a row was deleted/moved/etc... there has got to be a better way than grabbing rows in descending order based on the auto_increment value. Are you doing the inserts one at a time? If so, why not just use code to remember what you put in the DB? I do the inserts one at a time, i could use code to remember but i think it would be very slow when i have too much users. The second thing that aware me from doing this is, why use/build ressources when you could use others? i think why should i use and add another system? I work with mysql already and when php+mysql have the function i need it's better and i don't waste ressources :) Insert 100 records. Delete 50 of them at random. Now do your grab the last few records and sort them in descending order trick and see where it gets you. Mysql does not re-use id's (nor does any other db as far as I'm aware, and nor should it). I don't know where you got that idea from. mysql create table test (id int auto_increment not null primary key, name text); Query OK, 0 rows affected (0.12 sec) mysql insert into test(name) values ('one'),('two'),('three'),('four'),('five'),('six'),('seven'),('eight'),('nine'),('ten'); Query OK, 10 rows affected (0.00 sec) Records: 10 Duplicates: 0 Warnings: 0 mysql select * from test; ++---+ | id | name | ++---+ | 1 | one | | 2 | two | | 3 | three | | 4 | four | | 5 | five | | 6 | six | | 7 | seven | | 8 | eight | | 9 | nine | | 10 | ten | ++---+ 10 rows in set (0.00 sec) mysql delete from test where id in (1,3,7); Query OK, 3 rows affected (0.00 sec) mysql insert into test(name) values('eleven'); Query OK, 1 row affected (0.00 sec) mysql select * from test; +++ | id | name | +++ | 2 | two | | 4 | four | | 5 | five | | 6 | six | | 11 | eleven | | 8 | eight | | 9 | nine | | 10 | ten | +++ 8 rows in set (0.00 sec) The physical order of the rows changed (as you can see) but it does not re-use the id's that were deleted. Ordering by the id will get you the last bunch inserted. If you're using innodb you'll have to be aware it's transaction specific, if you're using myisam it will be system wide. I'll have to check my DBs then, because the exact situation I described happened to me a few years back when I was first getting into the DB scene. Regardless, I'm fairly certain the MSSQL box we have at work behaves this way. -- // Todd ---End Message--- ---BeginMessage--- The physical order of the rows changed (as you can see) but it does not re-use the id's that were deleted. Ordering by the id will get you the last bunch inserted. If you're using innodb you'll have to be aware it's transaction specific, if you're using myisam it will be system wide. I'll have to check my DBs then, because the exact situation I described happened to me a few years back when I was first getting into the DB scene. Regardless, I'm fairly certain the MSSQL box we have at work behaves this way. Maybe it's a version thing, that test was done on mysql 5 (I'm sure it'll work on mysql 4.0/4.1 as well). No idea about ones before that. -- Postgresql php tutorials http://www.designmagick.com/ ---End Message--- ---BeginMessage--- I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's
[PHP] GSoC - XDebug Profiling Web Frontend
Hi, I am interested in this, the problem highlighted also annoyed me. I haven't participated in GSoC, nor any community projects ( i did want, but didn't had the occasion). I wouldn't mind maintaining this after GSoc either. Since GSoC is kind of new for me any guidance would be appreciated. -- Alpar Torok -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] thread question
Hi all, Another question: If a script starts to perform an operation and the user browses away will that terminate the thread perfoming the operation eg. the operation is aborted ? Mvh Toke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: thread question
Toke Herkild schrieb: Hi all, Another question: If a script starts to perform an operation and the user browses away will that terminate the thread perfoming the operation eg. the operation is aborted ? Mvh Toke Hi Toke, i think that the Operations in the Server will not aborted because the Browser was closed. The Browser wait for Response and set a timeout Message when the Time is over. Best Regards Carlos Medina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Working in UTF-8 - BOM trouble
2009/3/31 Merlin Morgenstern merli...@fastmail.fm: that php has trouble with files that are saved in UTF-8 with BOM. It is causing strange bahavior like adding extra headers. On the other hand most editors only save UTF-8 with BOM. Has somebody experienced the same problem? How did you overcome it? Use an Editor that can save without BOM. :-) I prefer Komodo Edit (Multiplattform) or Notepad++ or gPHPedit if it should be lightweight. All mentioned programs are opensource. Bye -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-INSTALL] Mac OS X + Apache2 + Dynamic Libraries
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 As you have now found out, doing the auto-build from PECL doesn't work. Start by building the dependancies (libraries that are linked in the build) then the modules. (you can copy the next 7 following lines verbatim since this works for most source packages, the 8th line is what you need to add per package so do not copy this line, it is a placeholder) CFLAGS= -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp \ CXXFLAGS= -arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp \ LDFLAGS= -arch i386 -arch x86_64 -force-flat-namespace \ ./configure \ - --disable-dependancy-tracking \ - --disable-shared \ - --enable-static \ REST OF CONFIGURE FLAGS If you build it properly and you build for all Mac supported architectures your module will work on any Mac running any 10.5.x Here's the memcache build using this principal. http://daleenterprise.com/download/memcache.so (not for general consumption) - -- BuildSmart On Mar 30, 2009, at 14:27 PM, Stutter Stutters wrote: I used Pecl to install memcache and imagick, I ran the command you mentioned and this was the output: $ file /usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so /usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so: Mach-O bundle i386 I don't see anything regarding x86_64, so I assume it's not built with 64 bit support. Sounds like an awesome time to fix. Especially, since I don't know where to begin :( Any pointers? -Stutter On Mon, Mar 30, 2009 at 1:05 PM, BuildSmart buildsm...@daleenterprise.com wrote: On Mar 30, 2009, at 09:22 AM, Stutter Stutters wrote: I've been wrestling with mac os x + php 5.2.6 off and on for a few months to get it to load the memcache.so and imagick.so extensions. When I executed php on the command line `php -i | grep imagick` or `php -i | grep memcache` the output shows that imagick and memcache are both being loaded successfully, and I can successfully use both libraries..from the command line. However, when I restart apache, the logs show that both extensions can not be loaded: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so' - (null) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/imagick.so' - (null) in Unknown on line 0 Let me take a wild guess, you built the modules and they don't include the x86_64 architecture? The following command will show the available architectures: file /usr/lib/php/extensions/no-debug-non-zts-20060613/memcache.so The good news is you can rebuild all of your dependent libraries for multi architecture and rebuild all of your modules to be multi architecture and you will have solved your problem. Both files are obviously there (as they are being loaded via the CLI execution of php). I've checked, both apache and php-cli are using the same php.ini configuration. I've thought it was some kind of permission or environment issue for the _www user, but i've managed to change my env information to the same as the _www user's (or, at least, as well as I know how) and I am still able to execute php from the CLI and have successfully loaded imagick and memcache. Again, I'm using OS X Leopard, and PHP 5.2.6, and Apache 2.2.9 Any help would be much appreciated. Thanks! stutter. -- BuildSmart -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.2 (Darwin) iD8DBQFJ0ffe0hzWbkf0eKgRAv2AAJ45Zx/I0UdzC/OonJJ1ueyp7Uu5dQCfUGZT NXRKTc7iXxuZHdHBRRcKP9s= =maLI -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formulate nested select
Jim Lucas wrote: Chris wrote: PJ wrote: I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID b.id = c.bookID snip Not really a php question :P You don't need a subquery for this. You can join all of the tables together and just use the where clause to cut down your results, but I'll give an example of both. select * from books b inner join book_authors c on (b.id=c.bookId) inner join authors a on (a.id=c.authorId) where left(a.last_name = 'A'); correct me if I'm wrong, but did you use the left() function in-correctly? The documentation shows a different way to use it then you describe. Something more like the following: WHERE LEFT(a.last_name, 1) = 'A'; But that would be case-sensitive... So, something like this would work better IMHO WHERE UPPER(LEFT(a.last_name, 1)) = 'A'; or WHERE a.last_name ILIKE 'A%'; would do the trick or select * from books b inner join book_authors c on (b.id=c.bookId) where c.authorId in ( select id from authors where left(last_name='A') Again... SELECT id FROM authors WHERE LEFT(last_name, 1) = 'A') but yet again, case-sensitive... SELECT id FROM authors WHERE UPPER(LEFT(last_name, 1)) = 'A') or SELECT id FROM authors WHERE last_name ILIKE 'A%' would do the trick ); Thank you for the suggestions, gentlemen. As to the case sensitivity, since the authors' names must be written with the first letter in uppercase, even Anonymous or Unknown I assume I don't need to specify uppercase. Or does it really make a difference? Glad to learn of the option, though. I'm just starting on the listing of the books by author and just realized that the sorting should be by author (last name). Can I foresee a problem in that since the last_name is in associative tables and not in the book table? Or does the JOIN incorporate the last_name in the results? -- unheralded genius: A clean desk is the sign of a dull mind. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Working in UTF-8 - BOM trouble
Directly from W3: http://www.w3.org/International/questions/qa-utf8-bom.en.php Notepad++ saves without BOM, it's fast, cool, and free ;) To: php-general@lists.php.net Date: Tue, 31 Mar 2009 06:32:41 +0200 From: merli...@fastmail.fm Subject: [PHP] Working in UTF-8 - BOM trouble Hi there, I am having trouble to switch with an i18n project to utf-8. The problem is, that php has trouble with files that are saved in UTF-8 with BOM. It is causing strange bahavior like adding extra headers. On the other hand most editors only save UTF-8 with BOM. Has somebody experienced the same problem? How did you overcome it? Regards, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ News, entertainment and everything you care about at Live.com. Get it now! http://www.live.com/getstarted.aspx
Re: [PHP] Multiple cookies on the same computer
On 3/27/2009 at 8:10 PM, in message 49cd6b07.6010...@mac.com, Michael A. Peters mpet...@mac.com wrote: Ken Watkins wrote: I have set up a blog site where my family creates posts and they get emailed to members of the family. To keep up with their identities, I created a script for each family member to run (dad.php, mom.php, etc.), and it sets a cookie on each computer and uses sessions so I know who is connecting. It works great unless I want to share a computer between two users. I thought I had a solution: install both Firefox and IE on the same computer and set two different cookies. But this doesn't seem to work. My question is: Is it possible to set one cookie for IE and another for Firefox so that, depending on which browser is used, I can tell who is connecting to the blog? If this is not possible, is there another easy way to do it? Thanks for your help. - Ken Watkins Why not just use session cookies that expire as soon as a session is over (browser quits) and use a login? Hi Michael. Thanks for the suggestion. I'm trying to keep it as simple as possible with as few keystrokes (for the user) as possible, but your suggestion may be the best way to go. Thanks! Ken Watkins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formulate nested select
I must be doing something wrong. Can't figure it out even though I've been searching the manuals tutorials, it still does not work. Here is the exact code that I have tried; the first version is commented out and obviously does not work either (the spelling, the table names and column names are correct): $books = array(); /*$SQL = SELECT * FROM book b JOIN book_author c ON b.id = c.bookID JOIN author a ON a.id = c.authID WHERE LEFT(a.last_name,1) = $Auth ORDER BY $sort $dir LIMIT $offset, $records_per_page; */ $SQL = SELECT * FROM book b INNER JOIN book_author c ON b.id = c.bookID WHERE c.authID = (SELECT id FROM author a WHERE LEFT(a.last_name, 1 ) = $Auth ) ORDER BY $sort $dir LIMIT $offset, $records_per_page; if ( ( $results = mysql_query($SQL, $db) ) !== false ) { while ( $row = mysql_fetch_assoc($results) ) { $books[$row['id']] = $row; } } echo auth = :, $Auth ; --- returns auth = :A (my quotes) var_dump($results); --- returns boolean false (my quotes) Now, this: $SQL = select * from book b inner join book_author c on (b.id = c.bookID) inner join author a on (a.id = c.authID) where left(a.last_name, 1 ) = $Auth; if ( ( $results = mysql_query($SQL, $db) ) !== false ) { while ( $row = mysql_fetch_assoc($results) ) { $books[$row['id']] = $row; --- returns Parse error: syntax error, unexpected '[', expecting ']' in this line There seems to be something odd in the query... and yet, it all three look right to me... could there be some inconsistency in the tables, like skipped records or a record in a column that is non-existent in a corresponding column? Jim Lucas wrote: Chris wrote: PJ wrote: I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID b.id = c.bookID snip Not really a php question :P You don't need a subquery for this. You can join all of the tables together and just use the where clause to cut down your results, but I'll give an example of both. select * from books b inner join book_authors c on (b.id=c.bookId) inner join authors a on (a.id=c.authorId) where left(a.last_name = 'A'); correct me if I'm wrong, but did you use the left() function in-correctly? The documentation shows a different way to use it then you describe. Something more like the following: WHERE LEFT(a.last_name, 1) = 'A'; But that would be case-sensitive... So, something like this would work better IMHO WHERE UPPER(LEFT(a.last_name, 1)) = 'A'; or WHERE a.last_name ILIKE 'A%'; would do the trick or select * from books b inner join book_authors c on (b.id=c.bookId) where c.authorId in ( select id from authors where left(last_name='A') Again... SELECT id FROM authors WHERE LEFT(last_name, 1) = 'A') but yet again, case-sensitive... SELECT id FROM authors WHERE UPPER(LEFT(last_name, 1)) = 'A') or SELECT id FROM authors WHERE last_name ILIKE 'A%' would do the trick ); -- unheralded genius: A clean desk is the sign of a dull mind. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Security Support
From: Grant Peel From: Michael A. Peters Grant Peel wrote: Good Morning / Afternoon, We run several of our own servers: - Dell Power Edge 1U, Pentium, - FreeBSD (6.x soon to be 7.x) - along with all the standard Web Application installation (PHP Apache Exim, Pop3, Proftp, MySQL etc etc). What I am asking here, is if any one in this community has the knowledge to act as a security consultant in an occasional, as required basis. Anyone interested should have expience with Apache, PHP, Perl on the FreeBSD platform. No experience with FreeBSD and probably not enough with Perl - but whoever you hire, make sure they suggest your php build is hardened by suhosin - both the core php patch and the loadable module. Hi Again all, I am not sure what to make of all the chatter on this post To date, I have not recieved any sincere replies, which is a bit suprising. I am thinking that this job would be easy money for someone who already knows the ins and outs of php/Apache from a secuirty standpoint. I already have sohosin patch applied (it is applied as part of the default FreeBSD - php port). Anyways, the offer is still out there if anyone is interested. Hi Grant, First off, I believe you are asking on the wrong list. Server security is an advanced topic, well outside the experience of most novice PHP developers. You would be better off asking on some of the advanced Apache or Perl Monks mailing lists. Second, from your brief description, I can easily picture a full time job with lots of overtime hours, not something most consultants will be interested in. Security is not easy to do correctly, particularly if you are not responsible and accountable for the outcome or don't have full authority and management support. We currently have a team of five people who are jointly responsible for the security of our servers and networks. Each of them spends more than 20% of their time on that portion of their job. And finally, there are companies that do what you asked for. Gibson Research(*) is the first one that comes to mind www.grc.com. They also provide monitoring services to keep an eye out for intrusions on your servers once they have been hardened. Foundstone(**) is another www.foundstone.com. Good luck, Bob McConnell Senior Software Engineer The CBORD Group, Inc. 61 Brown Road Ithaca NY, 14850 Phone 607 257-2410 FAX 607 257-1902 Email r...@cbord.com Web www.cbord.com (*) No relationship exists nor is implied, we're not even a customer. I just like his style. Plus his Shields Up test gave my home firewall a perfect score. (**) We have occasionally hired these folks to do training and intrusion audits. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with header();
I don't had the oportunity to test it yet, but today i will. Today i will make two tests: - Save the files without BOM. - If i dont have success i will disable the output buffering. Thanks to everybody for all support. Regards, Igor Escobar systems analyst interface designer www . igorescobar . com On Tue, Mar 31, 2009 at 12:39 AM, Phpster phps...@gmail.com wrote: Output buffering turned off? Bastien Sent from my iPod On Mar 30, 2009, at 15:03, Igor Escobar titiolin...@gmail.com wrote: Hi guys, probably everybody goes think: its the same problem ever HTML before header() functions ... but it is not. I has working on a project and this are a running in Windows (shame on me). Recently i migrate to *Ubuntu *and some problems occurred and that specifically i can't understand WHY this rappening Warning: Cannot modify *header* information - headers already sent by On my web server on the internet it's OK On my local web server on my work it's OK On my loca web server on my notebook it's the problem. This error occurs only in my notebook (recently that I migrate to linux and it does not already). Please, someone have any idea what the fuck is happening? Regards, Igor Escobar systems analyst interface designer www . igorescobar . com
Re: [PHP] formulate nested select
On 31 Mar 2009 at 9:08, PJ wrote: I must be doing something wrong. Can't figure it out even though I've been searching the manuals tutorials, it still does not work. Here is the exact code that I have tried; the first version is commented out and obviously does not work either (the spelling, the table names and column names are correct): $books = array(); /*$SQL = SELECT * FROM book b JOIN book_author c ON b.id = c.bookID JOIN author a ON a.id = c.authID WHERE LEFT(a.last_name,1) = $Auth ORDER BY $sort $dir LIMIT $offset, $records_per_page; */ $SQL = SELECT * FROM book b INNER JOIN book_author c ON b.id = c.bookID WHERE c.authID = (SELECT id FROM author a WHERE LEFT(a.last_name, 1 ) = $Auth ) Hi, I think this should be '$Auth' as MySQL will be expecting a string. ORDER BY $sort $dir LIMIT $offset, $records_per_page; if ( ( $results = mysql_query($SQL, $db) ) !== false ) { while ( $row = mysql_fetch_assoc($results) ) { $books[$row['id']] = $row; } } echo auth = :, $Auth ; --- returns auth = :A (my quotes) var_dump($results); --- returns boolean false (my quotes) Now, this: $SQL = select * from book b inner join book_author c on (b.id = c.bookID) inner join author a on (a.id = c.authID) where left(a.last_name, 1 ) = $Auth; if ( ( $results = mysql_query($SQL, $db) ) !== false ) { while ( $row = mysql_fetch_assoc($results) ) { $books[$row['id']] = $row; --- returns Parse error: syntax error, unexpected '[', expecting ']' in this line There seems to be something odd in the query... and yet, it all three look right to me... could there be some inconsistency in the tables, like skipped records or a record in a column that is non-existent in a corresponding column? Looks like there is a double quote ( ) missing from the end of the $SQL variable. When building complex SQL queries for use in PHP I usually test them in the mysql command line client or a gui such as HeidiSQL first to make sure I am getting the expected results. Also you could try printing the SQL statement to the web page to make sure it looks as expected. You can try checking for a MySQL error within PHP by using these functions: mysql_errno() mysql_error() Regards Ian -- Jim Lucas wrote: Chris wrote: PJ wrote: I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID b.id = c.bookID snip Not really a php question :P You don't need a subquery for this. You can join all of the tables together and just use the where clause to cut down your results, but I'll give an example of both. select * from books b inner join book_authors c on (b.id=c.bookId) inner join authors a on (a.id=c.authorId) where left(a.last_name = 'A'); correct me if I'm wrong, but did you use the left() function in-correctly? The documentation shows a different way to use it then you describe. Something more like the following: WHERE LEFT(a.last_name, 1) = 'A'; But that would be case-sensitive... So, something like this would work better IMHO WHERE UPPER(LEFT(a.last_name, 1)) = 'A'; or WHERE a.last_name ILIKE 'A%'; would do the trick or select * from books b inner join book_authors c on (b.id=c.bookId) where c.authorId in ( select id from authors where left(last_name='A') Again... SELECT id FROM authors WHERE LEFT(last_name, 1) = 'A') but yet again, case-sensitive... SELECT id FROM authors WHERE UPPER(LEFT(last_name, 1)) = 'A') or SELECT id FROM authors WHERE last_name ILIKE 'A%' would do the trick ); -- unheralded genius: A clean desk is the sign of a dull mind. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with header();
The output buffer on or off does not matter. If there is nothing sent, there is nothing sent. If you have just a space, a new line, in one of included files and before ?php ... that will be considered an header sent (the default one, usually) every echo before the header will be considered an header sent. output after, and headers before, should usually be the last thing ever to send to the client, in any case (let's say tomorrow the same page should generate a PDF rather than HTML, you overwrite headers? bad practice and problems with some version of IE quite for sure) The only thing I could think about, common empty spaces problem a part, is a prepended file or a forced header for every request. To test this you simply need to create a file like this: ?php header('Content-Type: text/javascript'); echo 'alert(ok)'; ? If that page generates an header you could have UTF-8 BOM problems, a prepended file in the Apache configuration which is broken/bugged/crap, or something truly bad in the configuration. Date: Tue, 31 Mar 2009 10:20:24 -0300 From: titiolin...@gmail.com To: phps...@gmail.com CC: php-general@lists.php.net Subject: Re: [PHP] Problem with header(); I don't had the oportunity to test it yet, but today i will. Today i will make two tests: - Save the files without BOM. - If i dont have success i will disable the output buffering. Thanks to everybody for all support. Regards, Igor Escobar systems analyst interface designer www . igorescobar . com On Tue, Mar 31, 2009 at 12:39 AM, Phpster phps...@gmail.com wrote: Output buffering turned off? Bastien Sent from my iPod On Mar 30, 2009, at 15:03, Igor Escobar titiolin...@gmail.com wrote: Hi guys, probably everybody goes think: its the same problem ever HTML before header() functions ... but it is not. I has working on a project and this are a running in Windows (shame on me). Recently i migrate to *Ubuntu *and some problems occurred and that specifically i can't understand WHY this rappening Warning: Cannot modify *header* information - headers already sent by On my web server on the internet it's OK On my local web server on my work it's OK On my loca web server on my notebook it's the problem. This error occurs only in my notebook (recently that I migrate to linux and it does not already). Please, someone have any idea what the fuck is happening? Regards, Igor Escobar systems analyst interface designer www . igorescobar . com _ Drag n’ drop—Get easy photo sharing with Windows Live™ Photos. http://www.microsoft.com/windows/windowslive/products/photos.aspx
Re: [PHP] formulate nested select
Ian wrote: On 31 Mar 2009 at 9:08, PJ wrote: I must be doing something wrong. Can't figure it out even though I've been searching the manuals tutorials, it still does not work. Here is the exact code that I have tried; the first version is commented out and obviously does not work either (the spelling, the table names and column names are correct): $books = array(); /*$SQL = SELECT * FROM book b JOIN book_author c ON b.id = c.bookID JOIN author a ON a.id = c.authID WHERE LEFT(a.last_name,1) = $Auth ORDER BY $sort $dir LIMIT $offset, $records_per_page; */ $SQL = SELECT * FROM book b INNER JOIN book_author c ON b.id = c.bookID WHERE c.authID = (SELECT id FROM author a WHERE LEFT(a.last_name, 1 ) = $Auth ) Hi, I think this should be '$Auth' as MySQL will be expecting a string. Hmmm That was it. I'm not clear on this... what was MySQL getting? if not a string... sorry for my ignorance... ORDER BY $sort $dir LIMIT $offset, $records_per_page; if ( ( $results = mysql_query($SQL, $db) ) !== false ) { while ( $row = mysql_fetch_assoc($results) ) { $books[$row['id']] = $row; } } echo auth = :, $Auth ; --- returns auth = :A (my quotes) var_dump($results); --- returns boolean false (my quotes) Now, this: $SQL = select * from book b inner join book_author c on (b.id = c.bookID) inner join author a on (a.id = c.authID) where left(a.last_name, 1 ) = $Auth; if ( ( $results = mysql_query($SQL, $db) ) !== false ) { while ( $row = mysql_fetch_assoc($results) ) { $books[$row['id']] = $row; --- returns Parse error: syntax error, unexpected '[', expecting ']' in this line There seems to be something odd in the query... and yet, it all three look right to me... could there be some inconsistency in the tables, like skipped records or a record in a column that is non-existent in a corresponding column? Looks like there is a double quote ( ) missing from the end of the $SQL variable. When building complex SQL queries for use in PHP I usually test them in the mysql command line client or a gui such as HeidiSQL first to make sure I am getting the expected results. Also you could try printing the SQL statement to the web page to make sure it looks as expected. You can try checking for a MySQL error within PHP by using these functions: mysql_errno() mysql_error() Regards Ian -- unheralded genius: A clean desk is the sign of a dull mind. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] thread question
Hi all, Another question: If a script starts to perform an operation and the user browses away will that terminate the thread perfoming the operation eg. the operation is aborted ? Mvh Toke the script is aborted as soon as server gets no response from the browser when it sent output to the browser. virgil http://www.jampmark.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formulate nested select
Gentlemen all others, The problem was partly fixed with ' ' around $Auth... but... somehow, I see that the results do not work with the rest of the script. The results give a an array within an array - so this mucks up all the rest which is set up to deal with only the book table. The count() is off as it shows the results_per_page setting and the pagination is off - it shows 10 books but only displays 5 entries (from 5 arrays which, I suppose is the reason for the coun() showing 10. The first page shows 5, but the second indicates 7 books but displays only 6... Now, I suppose that there are 2 ways to fix things: 1. Redo the rest of the script (a royal pain, I suspect) or 2. SELECT only the books that are attributed to the targeted authors - which is what I wanted to do in the first place. Something like: $SQL = SELECT * FROM book b WHERE b.id = (SELECT book_author.bookID WHERE book_author.authID = (SELECT author.id WHERE LEFT(author.last_name, 1 ) = '$Auth'); I want to avoid joins as that seems to screw up the rest of the code which is in an include page that needs to be repeated as long as there are letters in the alphabet. I'll try to figure something out, but as somebody not too optimistic once said: it sure don't look too good (American, I believe...) :-) Jim Lucas wrote: Chris wrote: PJ wrote: I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID b.id = c.bookID snip Not really a php question :P You don't need a subquery for this. You can join all of the tables together and just use the where clause to cut down your results, but I'll give an example of both. select * from books b inner join book_authors c on (b.id=c.bookId) inner join authors a on (a.id=c.authorId) where left(a.last_name = 'A'); correct me if I'm wrong, but did you use the left() function in-correctly? The documentation shows a different way to use it then you describe. Something more like the following: WHERE LEFT(a.last_name, 1) = 'A'; But that would be case-sensitive... So, something like this would work better IMHO WHERE UPPER(LEFT(a.last_name, 1)) = 'A'; or WHERE a.last_name ILIKE 'A%'; would do the trick or select * from books b inner join book_authors c on (b.id=c.bookId) where c.authorId in ( select id from authors where left(last_name='A') Again... SELECT id FROM authors WHERE LEFT(last_name, 1) = 'A') but yet again, case-sensitive... SELECT id FROM authors WHERE UPPER(LEFT(last_name, 1)) = 'A') or SELECT id FROM authors WHERE last_name ILIKE 'A%' would do the trick ); Thank you for the suggestions, gentlemen. As to the case sensitivity, since the authors' names must be written with the first letter in uppercase, even Anonymous or Unknown I assume I don't need to specify uppercase. Or does it really make a difference? Glad to learn of the option, though. I'm just starting on the listing of the books by author and just realized that the sorting should be by author (last name). Can I foresee a problem in that since the last_name is in associative tables and not in the book table? Or does the JOIN incorporate the last_name in the results? -- unheralded genius: A clean desk is the sign of a dull mind. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] formulate nested select
What about using IN, something like: SELECT * FROM book WHERE id IN (SELECT bookID FROM book_authors WHERE authID IN (SELECT author.id FROM authors WHERE last_name LIKE $Auth%)); You could use LEFT instead of LIKE, too. -Original Message- From: PJ [mailto:af.gour...@videotron.ca] Sent: Tuesday, March 31, 2009 2:06 PM To: Jim Lucas Cc: Chris; php-general@lists.php.net Subject: Re: [PHP] formulate nested select Gentlemen all others, The problem was partly fixed with ' ' around $Auth... but... somehow, I see that the results do not work with the rest of the script. The results give a an array within an array - so this mucks up all the rest which is set up to deal with only the book table. The count() is off as it shows the results_per_page setting and the pagination is off - it shows 10 books but only displays 5 entries (from 5 arrays which, I suppose is the reason for the coun() showing 10. The first page shows 5, but the second indicates 7 books but displays only 6... Now, I suppose that there are 2 ways to fix things: 1. Redo the rest of the script (a royal pain, I suspect) or 2. SELECT only the books that are attributed to the targeted authors - which is what I wanted to do in the first place. Something like: $SQL = SELECT * FROM book b WHERE b.id = (SELECT book_author.bookID WHERE book_author.authID = (SELECT author.id WHERE LEFT(author.last_name, 1 ) = '$Auth'); I want to avoid joins as that seems to screw up the rest of the code which is in an include page that needs to be repeated as long as there are letters in the alphabet. I'll try to figure something out, but as somebody not too optimistic once said: it sure don't look too good (American, I believe...) :-) Jim Lucas wrote: Chris wrote: PJ wrote: I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID b.id = c.bookID snip Not really a php question :P You don't need a subquery for this. You can join all of the tables together and just use the where clause to cut down your results, but I'll give an example of both. select * from books b inner join book_authors c on (b.id=c.bookId) inner join authors a on (a.id=c.authorId) where left(a.last_name = 'A'); correct me if I'm wrong, but did you use the left() function in-correctly? The documentation shows a different way to use it then you describe. Something more like the following: WHERE LEFT(a.last_name, 1) = 'A'; But that would be case-sensitive... So, something like this would work better IMHO WHERE UPPER(LEFT(a.last_name, 1)) = 'A'; or WHERE a.last_name ILIKE 'A%'; would do the trick or select * from books b inner join book_authors c on (b.id=c.bookId) where c.authorId in ( select id from authors where left(last_name='A') Again... SELECT id FROM authors WHERE LEFT(last_name, 1) = 'A') but yet again, case-sensitive... SELECT id FROM authors WHERE UPPER(LEFT(last_name, 1)) = 'A') or SELECT id FROM authors WHERE last_name ILIKE 'A%' would do the trick ); Thank you for the suggestions, gentlemen. As to the case sensitivity, since the authors' names must be written with the first letter in uppercase, even Anonymous or Unknown I assume I don't need to specify uppercase. Or does it really make a difference? Glad to learn of the option, though. I'm just starting on the listing of the books by author and just realized that the sorting should be by author (last name). Can I foresee a problem in that since the last_name is in associative tables and not in the book table? Or does the JOIN incorporate the last_name in the results? -- unheralded genius: A clean desk is the sign of a dull mind. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Workflow app for software
Ladies/Gents... Hi. Trying to get some input to a web based app for dealing with managing software apps/scripts. Basically, i'm envisioning a system where people register/signup, and then check in/out apps for development/testing/production... I need a way of dealing with users, assigning/accepting roles for the users, and to manage the flow of the file as it moves through the basic development/testing/production process. i'd like to have a database backend, combines with some kind of source/file reqpository... I've seen things like knowledgetree, owl, etc... but figured I'd get input from here. So, any thoughts to open source apps that you guys have actual experience using?? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP task manager
We've got a homebrew ToDo list (task project) manager / mailer that we're thinking about replacing with something a little more robust. Any suggestions? I saw TaskFreak! on Google but I am curious if there are any personal recommendations out there. Thanks! G
Re: [PHP] formulate nested select
kyle.smith wrote: What about using IN, something like: SELECT * FROM book WHERE id IN (SELECT bookID FROM book_authors WHERE authID IN (SELECT author.id FROM authors WHERE last_name LIKE $Auth%)); You could use LEFT instead of LIKE, too. Well, I learned something here... but that also revealed another, hidden, problem which I had not considered - the order by clause which I had stupidly not included in my example: $SQL = SELECT * FROM book WHERE id IN (SELECT bookID FROM book_author WHERE authID IN (SELECT author.id FROM author WHERE LEFT(last_name, 1 ) = '$Auth')) ORDER BY $sort $dir LIMIT $offset, $records_per_page ; I now realize that to keep things as simple as possible in the rest of the code, I must join 1 column to the query result and that is last_name from the author table. the spelling, column and table names are spelled correctly. Without the ORDER BY I get the right results. I'll try to JOIN the author table ??? But I see that I may be trying to do too much - I thought of showing how many books were listed under each letter of the alphabet but I don't see how it can be done in any simiple way as it would mean that I would have to do the select once with the ORDER BY and a second time without it just to get the number of listing. If there are a lot of books, like thousands, it might slow down things. I suppose I could live with ORDER BY title as that does not require another effort. Any thoughts or suggestions? -Original Message- From: PJ [mailto:af.gour...@videotron.ca] Sent: Tuesday, March 31, 2009 2:06 PM To: Jim Lucas Cc: Chris; php-general@lists.php.net Subject: Re: [PHP] formulate nested select Gentlemen all others, The problem was partly fixed with ' ' around $Auth... but... somehow, I see that the results do not work with the rest of the script. The results give a an array within an array - so this mucks up all the rest which is set up to deal with only the book table. The count() is off as it shows the results_per_page setting and the pagination is off - it shows 10 books but only displays 5 entries (from 5 arrays which, I suppose is the reason for the coun() showing 10. The first page shows 5, but the second indicates 7 books but displays only 6... Now, I suppose that there are 2 ways to fix things: 1. Redo the rest of the script (a royal pain, I suspect) or 2. SELECT only the books that are attributed to the targeted authors - which is what I wanted to do in the first place. Something like: $SQL = SELECT * FROM book b WHERE b.id = (SELECT book_author.bookID WHERE book_author.authID = (SELECT author.id WHERE LEFT(author.last_name, 1 ) = '$Auth'); I want to avoid joins as that seems to screw up the rest of the code which is in an include page that needs to be repeated as long as there are letters in the alphabet. I'll try to figure something out, but as somebody not too optimistic once said: it sure don't look too good (American, I believe...) :-) Jim Lucas wrote: Chris wrote: PJ wrote: I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID b.id = c.bookID snip Not really a php question :P You don't need a subquery for this. You can join all of the tables together and just use the where clause to cut down your results, but I'll give an example of both. select * from books b inner join book_authors c on (b.id=c.bookId) inner join authors a on (a.id=c.authorId) where left(a.last_name = 'A'); correct me if I'm wrong, but did you use the left() function in-correctly? The documentation shows a different way to use it then you describe. Something more like the following: WHERE LEFT(a.last_name, 1) = 'A'; But that would be case-sensitive... So, something like this would work better IMHO WHERE UPPER(LEFT(a.last_name, 1)) = 'A'; or WHERE a.last_name ILIKE 'A%'; would do the trick or select * from books b inner join book_authors c on (b.id=c.bookId) where c.authorId in ( select id from authors where left(last_name='A') Again... SELECT id FROM authors WHERE LEFT(last_name, 1) = 'A') but yet again, case-sensitive... SELECT id FROM authors WHERE UPPER(LEFT(last_name, 1)) = 'A') or SELECT id FROM authors WHERE last_name ILIKE 'A%' would do the trick ); Thank you for the suggestions, gentlemen. As to the case sensitivity, since the authors' names must be written with the first letter in uppercase, even Anonymous or Unknown I assume I don't need to specify
Re: [PHP] Workflow app for software
On Tue, Mar 31, 2009 at 1:47 PM, bruce bedoug...@earthlink.net wrote: Ladies/Gents... Hi. Trying to get some input to a web based app for dealing with managing software apps/scripts. Basically, i'm envisioning a system where people register/signup, and then check in/out apps for development/testing/production... I need a way of dealing with users, assigning/accepting roles for the users, and to manage the flow of the file as it moves through the basic development/testing/production process. i'd like to have a database backend, combines with some kind of source/file reqpository... I've seen things like knowledgetree, owl, etc... but figured I'd get input from here. So, any thoughts to open source apps that you guys have actual experience using?? This sounds like something Subversion (SVN) is suited for. Three repositories in the same realm: dev, test, prod. Slap a web front-end on it like Polarion's svn-web (for JSP/Tomcat) and you're in business. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP task manager
On Tue, Mar 31, 2009 at 2:31 PM, George Larson george.g.lar...@gmail.com wrote: We've got a homebrew ToDo list (task project) manager / mailer that we're thinking about replacing with something a little more robust. Any suggestions? I saw TaskFreak! on Google but I am curious if there are any personal recommendations out there. There are plenty of open source ticket systems out there... just take the time to look. http://www.lmgtfy.com/?q=open+source+ticket+system Here's the top of that list: http://otrs.org/ http://osticket.com/ http://www.simpleticket.net/ http://www.opensourcehelpdesklist.com/ http://www.eticketsupport.com/ -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formulate nested select
On Tue, Mar 31, 2009 at 5:15 PM, PJ af.gour...@videotron.ca wrote: kyle.smith wrote: What about using IN, something like: SELECT * FROM book WHERE id IN (SELECT bookID FROM book_authors WHERE authID IN (SELECT author.id FROM authors WHERE last_name LIKE $Auth%)); You could use LEFT instead of LIKE, too. Well, I learned something here... but that also revealed another, hidden, problem which I had not considered - the order by clause which I had stupidly not included in my example: $SQL = SELECT * FROM book WHERE id IN (SELECT bookID FROM book_author WHERE authID IN (SELECT author.id FROM author WHERE LEFT(last_name, 1 ) = '$Auth')) ORDER BY $sort $dir LIMIT $offset, $records_per_page ; I now realize that to keep things as simple as possible in the rest of the code, I must join 1 column to the query result and that is last_name from the author table. the spelling, column and table names are spelled correctly. Without the ORDER BY I get the right results. I'll try to JOIN the author table ??? But I see that I may be trying to do too much - I thought of showing how many books were listed under each letter of the alphabet but I don't see how it can be done in any simiple way as it would mean that I would have to do the select once with the ORDER BY and a second time without it just to get the number of listing. If there are a lot of books, like thousands, it might slow down things. I suppose I could live with ORDER BY title as that does not require another effort. Any thoughts or suggestions? -Original Message- From: PJ [mailto:af.gour...@videotron.ca] Sent: Tuesday, March 31, 2009 2:06 PM To: Jim Lucas Cc: Chris; php-general@lists.php.net Subject: Re: [PHP] formulate nested select Gentlemen all others, The problem was partly fixed with ' ' around $Auth... but... somehow, I see that the results do not work with the rest of the script. The results give a an array within an array - so this mucks up all the rest which is set up to deal with only the book table. The count() is off as it shows the results_per_page setting and the pagination is off - it shows 10 books but only displays 5 entries (from 5 arrays which, I suppose is the reason for the coun() showing 10. The first page shows 5, but the second indicates 7 books but displays only 6... Now, I suppose that there are 2 ways to fix things: 1. Redo the rest of the script (a royal pain, I suspect) or 2. SELECT only the books that are attributed to the targeted authors - which is what I wanted to do in the first place. Something like: $SQL = SELECT * FROM book b WHERE b.id = (SELECT book_author.bookID WHERE book_author.authID = (SELECT author.id WHERE LEFT(author.last_name, 1 ) = '$Auth'); I want to avoid joins as that seems to screw up the rest of the code which is in an include page that needs to be repeated as long as there are letters in the alphabet. I'll try to figure something out, but as somebody not too optimistic once said: it sure don't look too good (American, I believe...) :-) Jim Lucas wrote: Chris wrote: PJ wrote: I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID b.id = c.bookID snip Not really a php question :P You don't need a subquery for this. You can join all of the tables together and just use the where clause to cut down your results, but I'll give an example of both. select * from books b inner join book_authors c on (b.id=c.bookId) inner join authors a on (a.id=c.authorId) where left(a.last_name = 'A'); correct me if I'm wrong, but did you use the left() function in-correctly? The documentation shows a different way to use it then you describe. Something more like the following: WHERE LEFT(a.last_name, 1) = 'A'; But that would be case-sensitive... So, something like this would work better IMHO WHERE UPPER(LEFT(a.last_name, 1)) = 'A'; or WHERE a.last_name ILIKE 'A%'; would do the trick or select * from books b inner join book_authors c on (b.id=c.bookId) where c.authorId in ( select id from authors where left(last_name='A') Again... SELECT id FROM authors WHERE LEFT(last_name, 1) = 'A') but yet again, case-sensitive... SELECT id FROM authors WHERE UPPER(LEFT(last_name, 1)) = 'A') or SELECT id FROM authors WHERE last_name ILIKE 'A%' would do the trick ); Thank you for the suggestions, gentlemen. As to the case sensitivity, since the authors' names must be written with the
Re: [PHP] 5.2.9 changes - phpwiki
On Mon, 30 Mar 2009, Michael A. Peters wrote: Charles Sprickman wrote: Hello all, Recently I upgraded a box running phpwiki from php 5.2.8 to 5.2.9. After the upgrade, phpwiki (1.3.14) started spitting out the following two errors, both of which are basically leaving the wiki dead in the water: [30-Mar-2009 22:01:23] PHP Parse error: syntax error, unexpected T_CLONE, expecting T_STRING in /usr/local/www/data/wikisvn/lib/config.php(500) : eval()'d code on line 2 [30-Mar-2009 22:01:23] PHP Fatal error: Class 'WikiDB_backend_PearDB_PearDB' not found in /usr/local/www/data/wikisvn/lib/WikiDB/SQL.php on line 25 first error is in this block: /** * safe php4 definition for clone. * php5 copies objects by reference, but we need to clone deep copy in some places. * (BlockParser) * We need to eval it as workaround for the php5 parser. * See http://www.acko.net/node/54 */ if (!check_php_version(5)) { eval(' function clone($object) { return $object; } '); } I know nothing about phpwiki - but it looks like check_php_version() is a function they have defined? Because reading the code, if check_php_version(5) is support to return true for php 5 then the eval should only be triggered if the version of php is not 5 - in which case, where phpwiki is broken is in the check_php_version() function. What happens when you run ?php if (check_php_version(5)) { echo php 5; } else { echo not php 5; } ? of course you'll need to copy their check_php version() function into your page. Well, I fixed it... Two things: -Since I'm running php5 and I know it, I removed the version check above. That got me past one error. -Next I started getting bizarre errors everywher preg_match() was called. That stumped me for a bit then I found that between 5.2.8 and 5.2.9 my saved compile options changed and I had NOT used the built-in PCRE library. Switching to the built-in one fixed the preg_match() errors, which in turn let config.php build the right path to the PEAR includes... Thanks! Charles -- 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] Workflow app for software
hey todd... just toook a look at the polarion svn-web app i thought that was closed source... i see that it's open!!! -Original Message- From: haliphax [mailto:halip...@gmail.com] Sent: Tuesday, March 31, 2009 2:18 PM To: bruce; php-general@lists.php.net Subject: Re: [PHP] Workflow app for software On Tue, Mar 31, 2009 at 1:47 PM, bruce bedoug...@earthlink.net wrote: Ladies/Gents... Hi. Trying to get some input to a web based app for dealing with managing software apps/scripts. Basically, i'm envisioning a system where people register/signup, and then check in/out apps for development/testing/production... I need a way of dealing with users, assigning/accepting roles for the users, and to manage the flow of the file as it moves through the basic development/testing/production process. i'd like to have a database backend, combines with some kind of source/file reqpository... I've seen things like knowledgetree, owl, etc... but figured I'd get input from here. So, any thoughts to open source apps that you guys have actual experience using?? This sounds like something Subversion (SVN) is suited for. Three repositories in the same realm: dev, test, prod. Slap a web front-end on it like Polarion's svn-web (for JSP/Tomcat) and you're in business. -- // Todd -- 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] formulate nested select
PJ wrote: Ian wrote: On 31 Mar 2009 at 9:08, PJ wrote: I must be doing something wrong. Can't figure it out even though I've been searching the manuals tutorials, it still does not work. Here is the exact code that I have tried; the first version is commented out and obviously does not work either (the spelling, the table names and column names are correct): $books = array(); /*$SQL = SELECT * FROM book b JOIN book_author c ON b.id = c.bookID JOIN author a ON a.id = c.authID WHERE LEFT(a.last_name,1) = $Auth ORDER BY $sort $dir LIMIT $offset, $records_per_page; */ $SQL = SELECT * FROM book b INNER JOIN book_author c ON b.id = c.bookID WHERE c.authID = (SELECT id FROM author a WHERE LEFT(a.last_name, 1 ) = $Auth ) Hi, I think this should be '$Auth' as MySQL will be expecting a string. Hmmm That was it. I'm not clear on this... what was MySQL getting? if not a string... sorry for my ignorance... You have to quote strings in sql, only numbers (and booleans) don't have quotes. ie $sql = .. where left(a.last_name, 1) = ' . mysql_real_escape_string($Auth) . '; single quotes around the value and it's properly escaped. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formulate nested select
haliphax wrote: On Tue, Mar 31, 2009 at 5:15 PM, PJ af.gour...@videotron.ca wrote: kyle.smith wrote: What about using IN, something like: SELECT * FROM book WHERE id IN (SELECT bookID FROM book_authors WHERE authID IN (SELECT author.id FROM authors WHERE last_name LIKE $Auth%)); You could use LEFT instead of LIKE, too. Well, I learned something here... but that also revealed another, hidden, problem which I had not considered - the order by clause which I had stupidly not included in my example: $SQL = SELECT * FROM book     WHERE id IN (SELECT bookID     FROM book_author WHERE authID IN (SELECT author.id     FROM author WHERE LEFT(last_name, 1 ) = '$Auth'))     ORDER BY $sort $dir     LIMIT $offset, $records_per_page ; I now realize that to keep things as simple as possible in the rest of the code, I must join 1 column to the query result and that is last_name from the author table. the spelling, column and table names are spelled correctly. Without the ORDER BY I get the right results. I'll try to JOIN the author table ??? But I see that I may be trying to do too much - I thought of showing how many books were listed under each letter of the alphabet but I don't see how it can be done in any simiple way as it would mean that I would have to do the select once with the ORDER BY and a second time without it just to get the number of listing. If there are a lot of books, like thousands, it might slow down things. I suppose I could live with ORDER BY title as that does not require another effort. Any thoughts or suggestions? -Original Message- From: PJ [mailto:af.gour...@videotron.ca] Sent: Tuesday, March 31, 2009 2:06 PM To: Jim Lucas Cc: Chris; php-general@lists.php.net Subject: Re: [PHP] formulate nested select Gentlemen all others, The problem was partly fixed with ' ' around $Auth... but... somehow, I see that the results do not work with the rest of the script. The results give a an array within an array - so this mucks up all the rest which is set up to deal with only the book table. The count() is off as it shows the results_per_page setting and the pagination is off - it shows 10 books but only displays 5 entries (from 5 arrays which, I suppose is the reason for the coun() showing 10. The first page shows 5, but the second indicates 7 books but displays only 6... Now, I suppose that there are 2 ways to fix things: 1. Redo the rest of the script (a royal pain, I suspect) or 2. SELECT only the books that are attributed to the targeted authors - which is what I wanted to do in the first place. Something like: $SQL = SELECT * FROM book b WHERE b.id = (SELECT book_author.bookID WHERE book_author.authID = (SELECT author.id WHERE LEFT(author.last_name, 1 ) = '$Auth'); I want to avoid joins as that seems to screw up the rest of the code which is in an include page that needs to be repeated as long as there are letters in the alphabet. I'll try to figure something out, but as somebody not too optimistic once said: it sure don't look too good (American, I believe...) :-) Jim Lucas wrote: Chris wrote: PJ wrote: I cannot find anything on google or the manuals/tutorials that gives some kin of clear explanation of how to so nested selects with where or whatever. I have three tables: books, authors and book-authors. I need to retrieve only those books whose author's names begin with A. I have tried several maniipulations of where and select with select subqueries and I cannot get results from the queries. For example SELECT * FROM book b, book_authors c (SELECT id FROM author WHERE LEFT(author.last_name = $Auth )) as a WHERE a.id = c.authID b.id = c.bookID snip Not really a php question :P You don't need a subquery for this. You can join all of the tables together and just use the where clause to cut down your results, but I'll give an example of both. select * from books b inner join book_authors c on (b.id=c.bookId) inner join authors a on (a.id=c.authorId) where left(a.last_name = 'A'); correct me if I'm wrong, but did you use the left() function in-correctly? The documentation shows a different way to use it then you describe. Something more like the following: WHERE LEFT(a.last_name, 1) = 'A'; But that would be case-sensitive... So, something like this would work better IMHO WHERE UPPER(LEFT(a.last_name, 1)) = 'A'; or WHERE a.last_name ILIKE 'A%'; would do the trick or select * from books b inner join book_authors c on (b.id=c.bookId) where c.authorId in ( select id from authors where left(last_name='A') Again... SELECT id FROM authors WHERE LEFT(last_name, 1) = 'A') but yet again, case-sensitive... SELECT id FROM authors WHERE UPPER(LEFT(last_name, 1)) = 'A') or SELECT id FROM authors WHERE last_name ILIKE 'A%' would do the trick ); Thank you for the suggestions, gentlemen. As to the case sensitivity, since the authors'
[PHP] Re: PHP task manager
'Twas brillig, and George Larson at 31/03/09 20:31 did gyre and gimble: We've got a homebrew ToDo list (task project) manager / mailer that we're thinking about replacing with something a little more robust. Any suggestions? I saw TaskFreak! on Google but I am curious if there are any personal recommendations out there. Well Trac is my personal favourite, but it's in Python. JotBug is a new PHP system based around the same principles as Trac, but written in the Zend Framework. http://www.jotbug.org/ It's very early days but perhaps it will be something you can get involved with? Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php exe from cli, but no web
Hi, I won't be redundant by saying I'm new to PHP, so I won't :) The following code works by doing; php file.php contents of file.php; ?php exec('/usr/bin/ssh u...@host nohup perl /perlscript'); ? * I config'd this ssh user to not need a password, copied its key. I place this file off of web root and point my browser to web root and type the file name; http://mywebroot/file.php but it doesn't exe. I'm not expecting to see a screen full, but I check to see if the perl script runs on the remote host, and it doesn't. All is well from a CLI. Any suggestions are greatly appreciated, - aurfalien -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php exe from cli, but no web
2009/3/31 aurfal...@gmail.com: Hi, I won't be redundant by saying I'm new to PHP, so I won't :) The following code works by doing; php file.php contents of file.php; ?php exec('/usr/bin/ssh u...@host nohup perl /perlscript'); ? * I config'd this ssh user to not need a password, copied its key. I place this file off of web root and point my browser to web root and type the file name; http://mywebroot/file.php but it doesn't exe. I'm not expecting to see a screen full, but I check to see if the perl script runs on the remote host, and it doesn't. All is well from a CLI. Any suggestions are greatly appreciated, PHP runs as a different user in a web server, usually nobody but it depends on how your system has been set up. Given that it should be obvious that the keys you've set up for the user you run it as from the command line will not be used from the web server. Hope that gives you enough info to solve the problem. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php exe from cli, but no web
wow, that was ez! thanks a lot. i also enabled php logging and checked my apache logs and it was as you said. very cool. my httpd process runs as apache, but I also did a whoami php script to very this. thanks again stu, you helped out hugely! - aurf On Mar 31, 2009, at 3:38 PM, Stuart wrote: 2009/3/31 aurfal...@gmail.com: Hi, I won't be redundant by saying I'm new to PHP, so I won't :) The following code works by doing; php file.php contents of file.php; ?php exec('/usr/bin/ssh u...@host nohup perl /perlscript'); ? * I config'd this ssh user to not need a password, copied its key. I place this file off of web root and point my browser to web root and type the file name; http://mywebroot/file.php but it doesn't exe. I'm not expecting to see a screen full, but I check to see if the perl script runs on the remote host, and it doesn't. All is well from a CLI. Any suggestions are greatly appreciated, PHP runs as a different user in a web server, usually nobody but it depends on how your system has been set up. Given that it should be obvious that the keys you've set up for the user you run it as from the command line will not be used from the web server. Hope that gives you enough info to solve the problem. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP task manager
Zoho's project tool looks pretty good. Www.zoho.com Bastien Sent from my iPod On Mar 31, 2009, at 18:20, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and George Larson at 31/03/09 20:31 did gyre and gimble: We've got a homebrew ToDo list (task project) manager / mailer that we're thinking about replacing with something a little more robust. Any suggestions? I saw TaskFreak! on Google but I am curious if there are any personal recommendations out there. Well Trac is my personal favourite, but it's in Python. JotBug is a new PHP system based around the same principles as Trac, but written in the Zend Framework. http://www.jotbug.org/ It's very early days but perhaps it will be something you can get involved with? Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited [http://www.tribalogic.net/] Open Source: Mandriva Linux Contributor [http://www.mandriva.com/] PulseAudio Hacker [http://www.pulseaudio.org/] Trac Hacker [http://trac.edgewall.org/] -- 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] 5.2.9 changes - phpwiki
Charles Sprickman wrote: On Mon, 30 Mar 2009, Michael A. Peters wrote: Charles Sprickman wrote: Hello all, Recently I upgraded a box running phpwiki from php 5.2.8 to 5.2.9. After the upgrade, phpwiki (1.3.14) started spitting out the following two errors, both of which are basically leaving the wiki dead in the water: [30-Mar-2009 22:01:23] PHP Parse error: syntax error, unexpected T_CLONE, expecting T_STRING in /usr/local/www/data/wikisvn/lib/config.php(500) : eval()'d code on line 2 [30-Mar-2009 22:01:23] PHP Fatal error: Class 'WikiDB_backend_PearDB_PearDB' not found in /usr/local/www/data/wikisvn/lib/WikiDB/SQL.php on line 25 first error is in this block: /** * safe php4 definition for clone. * php5 copies objects by reference, but we need to clone deep copy in some places. * (BlockParser) * We need to eval it as workaround for the php5 parser. * See http://www.acko.net/node/54 */ if (!check_php_version(5)) { eval(' function clone($object) { return $object; } '); } I know nothing about phpwiki - but it looks like check_php_version() is a function they have defined? Because reading the code, if check_php_version(5) is support to return true for php 5 then the eval should only be triggered if the version of php is not 5 - in which case, where phpwiki is broken is in the check_php_version() function. What happens when you run ?php if (check_php_version(5)) { echo php 5; } else { echo not php 5; } ? of course you'll need to copy their check_php version() function into your page. Well, I fixed it... Two things: -Since I'm running php5 and I know it, I removed the version check above. That got me past one error. -Next I started getting bizarre errors everywher preg_match() was called. That stumped me for a bit then I found that between 5.2.8 and 5.2.9 my saved compile options changed and I had NOT used the built-in PCRE library. Switching to the built-in one fixed the preg_match() errors, which in turn let config.php build the right path to the PEAR includes... Thanks! I have to wonder if the preg_match issue is what broke their check_php_version() function causing it to return false when it should have returned true. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php