Re: [PHP] mysqli_embedded_server_start
Kyohere Luke wrote: Has anyone tried to use this function? Does php actually support mysql embedded server or is this just a stub for future use? I'm trying to convert a mysql-based web app to a desktop app and rather than refactor everything to use sqlite, It would be interesting if I could use mysql embedded server. Alternatively, you could just run mysql locally on your desktop. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqli_embedded_server_start
On Fri, 2008-02-01 at 09:13 +0100, Per Jessen wrote: Kyohere Luke wrote: Has anyone tried to use this function? Does php actually support mysql embedded server or is this just a stub for future use? I'm trying to convert a mysql-based web app to a desktop app and rather than refactor everything to use sqlite, It would be interesting if I could use mysql embedded server. Alternatively, you could just run mysql locally on your desktop. Not so convenient for distribution :/ 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] mysqli_embedded_server_start
Robert Cummings wrote: On Fri, 2008-02-01 at 09:13 +0100, Per Jessen wrote: Kyohere Luke wrote: Has anyone tried to use this function? Does php actually support mysql embedded server or is this just a stub for future use? I'm trying to convert a mysql-based web app to a desktop app and rather than refactor everything to use sqlite, It would be interesting if I could use mysql embedded server. Alternatively, you could just run mysql locally on your desktop. Not so convenient for distribution :/ Very true - but maybe Luke is already distributing PHP, a webserver etc? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR website and MSIE 6
2008. 01. 31, csütörtök keltezéssel 12.47-kor Robert Cummings ezt írta: On Thu, 2008-01-31 at 18:18 +0100, Jochem Maas wrote: Eric Butera schreef: On Jan 31, 2008 12:02 PM, Jochem Maas [EMAIL PROTECTED] wrote: Robert Cummings schreef: On Thu, 2008-01-31 at 17:14 +0100, Jochem Maas wrote: let's not forget that nobody outside of IT actually uses Opera Please back up that st-ass-tistic please. Methinks you reached around and pulled it out of your lightless nether regions. given that you can prove anything with statistics, I'd say that's where all stats come from - well not all from my ass but always someone's ;-) let me guess you use Opera ... and you work in IT right? :-P Cheers, Rob. My wife uses Opera and she doesn't know much about computers. I installed IE7, FF, Opera, Safari for Windows and she picked Opera on her own. I can't really get into it though. I guess the shitty interface is appealing to people with more taste than us :-) Steve Job's would be annoyed though - which is funny in and of itself :-P I dunno, Opera comes with a built in flag for disabling that wretching thing called tabbed browsing. Firefox requires you to install a plugin. ahh the Great Browser Holy War :) I must join in... I never wanted to turn tabbed browsing off (in fact I find it useful and convenient), so it is not a real concern Also, I find the configurability of Opera's interface to be superior to what I last used for Firefox. okay, then how do you stop Opera caching? I tried to turn it off everywhere but it keeps on creating local files while I browse. (ubuntu linux/opera 9.25) aside from that, opera is quite good but for development I find FF much more convenient. IE just plain sucks, but I have to test my stuff with it also so I have it installed, but I would never think about using it for anything else... greets Zoltán Németh 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] PEAR website and MSIE 6
On Fri, 2008-02-01 at 10:11 +0100, Zoltán Németh wrote: 2008. 01. 31, csütörtök keltezéssel 12.47-kor Robert Cummings ezt írta: On Thu, 2008-01-31 at 18:18 +0100, Jochem Maas wrote: Eric Butera schreef: On Jan 31, 2008 12:02 PM, Jochem Maas [EMAIL PROTECTED] wrote: Robert Cummings schreef: On Thu, 2008-01-31 at 17:14 +0100, Jochem Maas wrote: let's not forget that nobody outside of IT actually uses Opera Please back up that st-ass-tistic please. Methinks you reached around and pulled it out of your lightless nether regions. given that you can prove anything with statistics, I'd say that's where all stats come from - well not all from my ass but always someone's ;-) let me guess you use Opera ... and you work in IT right? :-P Cheers, Rob. My wife uses Opera and she doesn't know much about computers. I installed IE7, FF, Opera, Safari for Windows and she picked Opera on her own. I can't really get into it though. I guess the shitty interface is appealing to people with more taste than us :-) Steve Job's would be annoyed though - which is funny in and of itself :-P I dunno, Opera comes with a built in flag for disabling that wretching thing called tabbed browsing. Firefox requires you to install a plugin. ahh the Great Browser Holy War :) I must join in... I never wanted to turn tabbed browsing off (in fact I find it useful and convenient), so it is not a real concern Also, I find the configurability of Opera's interface to be superior to what I last used for Firefox. okay, then how do you stop Opera caching? I tried to turn it off everywhere but it keeps on creating local files while I browse. (ubuntu linux/opera 9.25) I never noticed that before... with a little ingenuity though I found the following to be successful: cd ~/.opera sudo chown root:root cache4 sudo chmod 000 cache4 ;) 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] how dod you get to do multiple mysql queries concurrently?
2008. 02. 1, péntek keltezéssel 03.40-kor Jochem Maas ezt írta: Per Jessen schreef: Richard Lynch wrote: OK, what is a 'geometry column' and what is a 'spatial index' ? Imagine a single column combining both longitude and latitude. Now imagine an index that knows about long/lat, and keeps geographically close objects sorted in the index for you. Including knowing about the 180 - -180 degree wrap-around. (Or 360 === 0 wrap-around in the other geo-system.) So when you ask for theme parks near Zurich your DB can answer in milliseconds instead of minutes. Thanks Richard - I thought Nathan was talking about an abstract concept, not something real. So, back the Nathans suggestion: Back on the mysql side of things, try using geometry columns rather than numerical primary keys, with spatial indexes.. it's a MASSIVE performance upgrade (I've cut 5 second queries down to 0.005 by using geo columns) Is this worth a try? Have others tried this? I for one would really like to see a concrete example of this kind of use of geometry columns and spacial indexes as an alternative to the stand integer based primary keys. me too greets Zoltán Németh /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how dod you get to do multiple mysql queries concurrently?
2008. 02. 1, péntek keltezéssel 11.55-kor Paul Scott ezt írta: Did anyone actually get this mail? More concrete example? What would you like to see? I suspect that some of my mail is getting dropped :( sure I got it but answered before I reached it in reading. sorry for the noise. as for the GEOS stuff I think I'll do some research on it, it sounds very interesting greets Zoltán Németh --Paul On Fri, 2008-02-01 at 06:33 +0200, Paul Scott wrote: On Fri, 2008-02-01 at 03:40 +0100, Jochem Maas wrote: I for one would really like to see a concrete example of this kind of use of geometry columns and spacial indexes as an alternative to the stand integer based primary keys. On one of my local postGIS tables: CREATE INDEX k1 ON kanagawa USING gist (the_geom); A gist index is a GEOS based spatial index. You will need GEOS to create one. When loading spatial data, your geometry column looks like so: 01050001000102000C0011ECE564CF7561404A8999CCDABC4140E5C0981ACE75614012901CD641BD4140603C8386BE756140E525611B40BD41405BF216D3BD756140151DC9E53FBD414054DC1A4DBD756140760B997A3FBD414012219BD1BC756140D20823E33EBD41407AB2884EBC7561400F2110243EBD41404571B4D0BB756140CC0C6A213DBD4140F707192ABB7561405DF2A1803CBD4140F0F11CA4BA756140C3D1B7413CBD4140E89CB2ADB97561406F046D233CBD414017D4B7CCA97561406D47AD7F39BD4140 Which is WKB (Well Known Binary) data or WKT (Well Known Text) data. The gist index simply indexes this as opposed to the regular gid (which you still use btree indexes on anyways) --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how dod you get to do multiple mysql queries concurrently?
Did anyone actually get this mail? More concrete example? What would you like to see? I suspect that some of my mail is getting dropped :( --Paul On Fri, 2008-02-01 at 06:33 +0200, Paul Scott wrote: On Fri, 2008-02-01 at 03:40 +0100, Jochem Maas wrote: I for one would really like to see a concrete example of this kind of use of geometry columns and spacial indexes as an alternative to the stand integer based primary keys. On one of my local postGIS tables: CREATE INDEX k1 ON kanagawa USING gist (the_geom); A gist index is a GEOS based spatial index. You will need GEOS to create one. When loading spatial data, your geometry column looks like so: 01050001000102000C0011ECE564CF7561404A8999CCDABC4140E5C0981ACE75614012901CD641BD4140603C8386BE756140E525611B40BD41405BF216D3BD756140151DC9E53FBD414054DC1A4DBD756140760B997A3FBD414012219BD1BC756140D20823E33EBD41407AB2884EBC7561400F2110243EBD41404571B4D0BB756140CC0C6A213DBD4140F707192ABB7561405DF2A1803CBD4140F0F11CA4BA756140C3D1B7413CBD4140E89CB2ADB97561406F046D233CBD414017D4B7CCA97561406D47AD7F39BD4140 Which is WKB (Well Known Binary) data or WKT (Well Known Text) data. The gist index simply indexes this as opposed to the regular gid (which you still use btree indexes on anyways) --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- . | Chisimba PHP5 Framework - http://avoir.uwc.ac.za | :: All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: how do you get to do multiple mysql queries concurrently?
Richard Lynch wrote: I think you are mis-remembering, yes. When your fork() call returns, you have two separate processes, your child process being an exact copy of your parent process. (mostly, see copy-on-write). The only thing they share at this point are open file descriptors which have also been copied, so they obviously point the the same file(s). So they could easily corrupt the file by making assumptions about it. Actually only if they make incorrect assumptions :-) More importantly, if you build and initialize some data structures before you fork, and if they each assume they have exclusive access to said data structures, your program ends up not being thread-safe I'm sorry, you're wrong. You don't seem to quite understand what fork() does. After the fork(), both processes will each have a copy of those data structures, and they can both do whatever they like to them without interfering with each other. Anyway, enough of this. I'm done. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [Slightly OT] Apple MacBook MAMP and Logic
Brady Mitchell wrote: I don't use a mac myself but a colleague does. He seems to have apache and PHP installed on the machine but he generally uses the Xampp package. I don't know if this is the official home page or but but start here: http://www.apachefriends.org/en/xampp-macosx.html Thanks Colin, That's what I use on PC so it will probably do me fine on Mac too. I've been using XAMPP on Windows for a few years, so when I bought a MBP in December I was happy to find that they have a version for OS X as well. The one thing I didn't like about it is that on OS X you have to type in your password every time you want to start or stop anything. So I wrote some simple applescripts that I use instead of the included control panel that handle the authentication for me. If anyone is interested, just contact me off-list and I'll gladly share these simple scripts. That's just how sudo works tho' right? You can configure sudo to not require a password for certain commands run by certain users. Not sure how it works on the mac as there may be some kind of wrapper but I'm sure there would be a way to allow your user to not enter a password for loading xampp It's a mac. It's like *nix. It's tweakable ;) Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [Slightly OT] Apple MacBook MAMP and Logic
On Fri, 2008-02-01 at 10:58 +, Colin Guthrie wrote: That's just how sudo works tho' right? You can configure sudo to not require a password for certain commands run by certain users. Not sure how it works on the mac as there may be some kind of wrapper but I'm sure there would be a way to allow your user to not enter a password for loading xampp It's a mac. It's like *nix. It's tweakable ;) For sure! Although not recommended, I change that behaviour as soon as I finish installing my system (generally Ubuntu). I really *hate* typing my password on my own system! What I do is create a root login by using sudo passwd root which asks for my password (one last time) then I get to have a root pass. --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR website and MSIE 6
Daevid Vincent wrote: I will be very sad in 15 days when M$ FORCES everyone to it. WT? -- Richard Heyes http://www.websupportsolutions.co.uk Knowledge Base and Helpdesk software for £299pa hosted for you - no installation, no maintenance, new features automatic and free -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysqli_embedded_server_start
Providing an embedded web-server and php package, so embedded mysql would be nice too. There is absolutely no documentation regarding this function - isn't anyone curious? :-) On Feb 1, 2008 11:48 AM, Per Jessen [EMAIL PROTECTED] wrote: Robert Cummings wrote: On Fri, 2008-02-01 at 09:13 +0100, Per Jessen wrote: Kyohere Luke wrote: Has anyone tried to use this function? Does php actually support mysql embedded server or is this just a stub for future use? I'm trying to convert a mysql-based web app to a desktop app and rather than refactor everything to use sqlite, It would be interesting if I could use mysql embedded server. Alternatively, you could just run mysql locally on your desktop. Not so convenient for distribution :/ Very true - but maybe Luke is already distributing PHP, a webserver etc? /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- -- Luke Kyohere -- /dev/null
[PHP] Search function not working...
So I said in another thread that I would be asking another question about functions... So here it goes, I am attempting to write a function to search the database, which used to work just fine when I wrote it without using a function (Would that be considered static?) Now that I am attempting to rewrite my stuff so I can reuse the code, now it's not working... Here is what I used to do and it worked just fine: $qstring = SELECT * FROM .$table. WHERE FName like '%$search%' or LName like '%$search%' or Add1 like '%$search%' or Add2 like '%$search %' or City like '%$search%' or State like '%$search%' or Zip like '% $search%' or XCode like '%$search%'; if ($_SESSION['search'] != NULL){ echo The search string is: strong$search/strong.BR; $qrow[]= mysql_query($qstring) or die(mysql_error()); $qresult = $qrow[0]; $num_rows = mysql_num_rows($qresult); //display search form echo form action='search.php' method='GET' labelSearch: input type='text' name='search' id='search' / /label input type='submit' value='Go!' / /form; echo HTML a href='index.php'Return to database/A PTotal Records found: {$num_rows}/P A href='excelexport.php'Export selection to excel/A form method='GET' action='edit.php' table border='1' tr tha href='?order=a'First Name/A/th thA href='?order=b'Last Name/A/th thA href='?order=c'Address Line 1/A/th THA href='?order=d'Address Line 2/A/th THA href='?order=e'City/A/th thA href='?order=f'State/A/th thA href='?order=g'Zip/A/th THA href='?order=h'Code/A/th thA href='?order=i'ID #/A/th THEdit/th thDelete/th /tr HTML; echo Just testing: .$_SESSION['search']; while($qrow = mysql_fetch_assoc($qresult)) { //Display the search results using heredoc syntax echo HTML tr td{$qrow['FName']}/td td{$qrow['LName']}/td td{$qrow['Add1']}/td td{$qrow['Add2']}/td td{$qrow['City']}/td td{$qrow['State']}/td td{$qrow['Zip']}/td td{$qrow['XCode']}/td td{$qrow['Record']}/td tda href='edit.php?Record={$qrow['Record']}'Edit/a/td tda href='delete.php?Record={$qrow['Record']}'Delete/a/td /tr /form HTML; Now, here is what I have as a function and is not working: ?PHP $FName =; $LName =; $Add1 = ; $Add2 = ; // $_SESSION['search'] = $_GET['search']; function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2) { $qstring = SELECT * FROM .$table. WHERE FName like '%$searchvar%' or LName like '%$searchvar%' or Add1 like '%$searchvar%' or Add2 like '%$searchvar%' or City like '%$searchvar%' or State like '%$searchvar %' or Zip like '%$searchvar%' or XCode like '%$searchvar%'; $qrow[]= mysql_query($qstring) or die(mysql_error()); $qresult = $qrow[0]; $num_rows = mysql_num_rows($qresult); //while($qrow = mysql_fetch_assoc($qresult)) { $FName = $qrow['FName']; $LName = $qrow['LName']; $Add1 = $qrow['Add1']; $Add2 = $qrow['Add2']; return; } ? And what happens, is first of all it displays the entire database on the search page, which I'm kind of okay with... But when you search, it updates the variables, and echo's out the right search term, but it doesn't update the database to only show the search results... I think it might be tied to it displaying the entire database at page load... But I'm not sure.. Anyone have an idea of what I did wrong other then everything? :) Oh, and as far as calling the function I do this: search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2); -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED]
Re: [PHP] array iteration vs. ArrayIterator
Nathan Nobbe schreef: all, as ive been researching SPL lately ive read several times that spl will store only the current element of the underlying collection in memory during iteration. articles that mention this will say that using these iterators should afford savings when traversing large collections. well having found nothing empirical i decided to run some tests myself. and for the hell of it, i also decided to throw the array-by-reference construct in there (thats the name im giving to the syntax which lets you alter the array youre iterating over from within the array). mainly because ive heard people say it will save memory. however, based upon some things ive read, ive been skeptical of that info. so here is a quick little report i whipped up, which has the script i used for the test, and the results in a graphical format so you can get a quick feel for them. http://nathan.moxune.com/arrayVsArrayIteratorReport.php at this point i must retract some of the statements i made during the conversation about ruby yesterday. it turns out, spl iteration is not twice as fast as standard array iteration, in fact it quite a bit slower! that makes sense - your creating objects and wrapping the original data in order to iterate over it - that can only mean overhead in terms of memory and performance. I stick with arrays and foreach (I agree with the carpal tunnel syndrome statement) also, it takes up more memory, and lastly, whoever said that using the array-by-reference syntax saves memory is dead wrong ;) -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pass Variable Names to a Function
On Feb 1, 2008 10:49 AM, Bill Guion [EMAIL PROTECTED] wrote: I would like to use a function to check to see if a session variable is set and return the session variable if it is set, and return blank if not. Something like function set_var($var) { echo var = $var \n; echo \$var = $var\n; // :) if (isset($_SESSION['$var'])) $_SESSION[$var] { return $_SESSION['$var']; $_SESSION[$var] } else { return ; return ''; } } And I would call the function with set_var($name) or set_var($phone). The problem is getting the function to use $var as a variable name, rather than a value. What am I missing, please? means interpolate the contents. '' means use the literal content. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pass Variable Names to a Function
I would like to use a function to check to see if a session variable is set and return the session variable if it is set, and return blank if not. Something like function set_var($var) { echo var = $var \n; if (isset($_SESSION['$var'])) { return $_SESSION['$var']; } else { return ; } } And I would call the function with set_var($name) or set_var($phone). The problem is getting the function to use $var as a variable name, rather than a value. What am I missing, please? -= Bill =- -- Diplomacy - telling your boss he has an open mind instead of saying he has a hole in his head. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array iteration vs. ArrayIterator
On Jan 31, 2008 10:09 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: http://nathan.moxune.com/arrayVsArrayIteratorReport.php at this point i must retract some of the statements i made during the conversation about ruby yesterday. it turns out, spl iteration is not twice as fast as standard array iteration, in fact it quite a bit slower! also, it takes up more memory, and lastly, whoever said that using the array-by-reference syntax saves memory is dead wrong ;) Thanks for the benchmark. Makes me feel better having previously dismissed SPL for wordy, java-like syntax only. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR website and MSIE 6
On Jan 31, 2008 7:04 AM, Eric Butera [EMAIL PROTECTED] wrote: IE8 passes Acid2. :) They make a salve for that I heard. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pass Variable Names to a Function
Bill Guion wrote: I would like to use a function to check to see if a session variable is set and return the session variable if it is set, and return blank if not. Something like You really don't need a function for this: // Could use null instead of false $variable = isset($_SESSION[$name]) ? $_SESSION[$name] : false; -- Richard Heyes http://www.websupportsolutions.co.uk Knowledge Base and Helpdesk software for £299pa hosted for you - no installation, no maintenance, new features automatic and free -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array iteration vs. ArrayIterator
On Fri, 2008-02-01 at 11:11 -0600, Greg Donald wrote: Thanks for the benchmark. Yes, thanks! It has just confirmed what I have been experiencing as well. I am busy converting a static site to a Chisimba CMS based site at the moment with 43 000 odd static, frontpage generated HTML pages. I have cut down processing times and regex times on the content from around 15 minutes to a few seconds (well waaay less than a minute anyway). During the course of all of this, I have managed to create quite a few SPL based classes that extend various aspects of the iterators especially, which I will share soon if anyone is interested. --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Search function not working...
On 2/1/08, Jason Pruim [EMAIL PROTECTED] wrote: So I said in another thread that I would be asking another question about functions... So here it goes, I am attempting to write a function to search the database, which used to work just fine when I wrote it without using a function (Would that be considered static?) Now that I am attempting to rewrite my stuff so I can reuse the code, now it's not working... Here is what I used to do and it worked just fine: $qstring = SELECT * FROM .$table. WHERE FName like '%$search%' or LName like '%$search%' or Add1 like '%$search%' or Add2 like '%$search %' or City like '%$search%' or State like '%$search%' or Zip like '% $search%' or XCode like '%$search%'; if ($_SESSION['search'] != NULL){ echo The search string is: strong$search/strong.BR; $qrow[]= mysql_query($qstring) or die(mysql_error()); $qresult = $qrow[0]; $num_rows = mysql_num_rows($qresult); //display search form echo form action='search.php' method='GET' labelSearch: input type='text' name='search' id='search' / /label input type='submit' value='Go!' / /form; echo HTML a href='index.php'Return to database/A PTotal Records found: {$num_rows}/P A href='excelexport.php'Export selection to excel/A form method='GET' action='edit.php' table border='1' tr tha href='?order=a'First Name/A/th thA href='?order=b'Last Name/A/th thA href='?order=c'Address Line 1/A/th THA href='?order=d'Address Line 2/A/th THA href='?order=e'City/A/th thA href='?order=f'State/A/th thA href='?order=g'Zip/A/th THA href='?order=h'Code/A/th thA href='?order=i'ID #/A/th THEdit/th thDelete/th /tr HTML; echo Just testing: .$_SESSION['search']; while($qrow = mysql_fetch_assoc($qresult)) { //Display the search results using heredoc syntax echo HTML tr td{$qrow['FName']}/td td{$qrow['LName']}/td td{$qrow['Add1']}/td td{$qrow['Add2']}/td td{$qrow['City']}/td td{$qrow['State']}/td td{$qrow['Zip']}/td td{$qrow['XCode']}/td td{$qrow['Record']}/td tda href='edit.php ?Record={$qrow['Record']}'Edit/a/td tda href='delete.php ?Record={$qrow['Record']}'Delete/a/td /tr /form HTML; Now, here is what I have as a function and is not working: ?PHP $FName =; $LName =; $Add1 = ; $Add2 = ; // $_SESSION['search'] = $_GET['search']; function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2) { $qstring = SELECT * FROM .$table. WHERE FName like '%$searchvar%' or LName like '%$searchvar%' or Add1 like '%$searchvar%' or Add2 like '%$searchvar%' or City like '%$searchvar%' or State like '%$searchvar%' or Zip like '%$searchvar%' or XCode like '%$searchvar%'; $qrow[]= mysql_query($qstring) or die(mysql_error()); $qresult = $qrow[0]; $num_rows = mysql_num_rows($qresult); while($qrow = mysql_fetch_assoc($qresult)) { $FName = $qrow['FName']; $LName = $qrow['LName']; $Add1 = $qrow['Add1']; $Add2 = $qrow['Add2']; } // what do you want to return...? return; } ? $returnedSomething = search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2); Jason, 1. You're missing a closing brace at the end of the while loop. 2. You're not returning anything from the function. The input parameters are pretty clear but what were you expecting to accomplish within the function? All the data returned from the query only have scope within the function, so unless you return something, like an array or a string, use references, or write to a global variable, you're not doing anything with the data from the db. David
Re: [PHP] Search function not working...
On Feb 1, 2008, at 2:20 PM, David Giragosian wrote: On 2/1/08, Jason Pruim [EMAIL PROTECTED] wrote: [snip long explanation of problem] function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2) { $qstring = SELECT * FROM .$table. WHERE FName like '% $searchvar%' or LName like '%$searchvar%' or Add1 like '% $searchvar%' or Add2 like '%$searchvar%' or City like '%$searchvar%' or State like '%$searchvar%' or Zip like '%$searchvar%' or XCode like '% $searchvar%'; $qrow[]= mysql_query($qstring) or die(mysql_error()); $qresult = $qrow[0]; $num_rows = mysql_num_rows($qresult); while($qrow = mysql_fetch_assoc($qresult)) { $FName = $qrow['FName']; $LName = $qrow['LName']; $Add1 = $qrow['Add1']; $Add2 = $qrow['Add2']; } // what do you want to return...? return; } ? $returnedSomething = search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2); Jason, 1. You're missing a closing brace at the end of the while loop. 2. You're not returning anything from the function. The input parameters are pretty clear but what were you expecting to accomplish within the function? All the data returned from the query only have scope within the function, so unless you return something, like an array or a string, use references, or write to a global variable, you're not doing anything with the data from the db. David Hi David, Thanks for looking. I'm just starting to learn about functions, and obviously making a few mistakes along the road... Basically what I am trying to do is allow my customer the ability to search the database, display it on the website, and then export it to excel if they wish... the missing closing brace was a bad copy/paste job. I have tried to add $searchReturn = search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2); and then do a vardump on it and it's not returning any thing. I've also changed the return line to return $searchReturn['FName']; but it's still not showing through... I think functions will be the death of me... at least until I understand how to use them :) I think I'm off to google some more and see if I can get any more info... Thanks again for your help! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED]
Re: [PHP] Search function not working...
On 2/1/08, Jason Pruim [EMAIL PROTECTED] wrote: On Feb 1, 2008, at 2:20 PM, David Giragosian wrote: On 2/1/08, Jason Pruim [EMAIL PROTECTED] wrote: [snip long explanation of problem] function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2) { $qstring = SELECT * FROM .$table. WHERE FName like '%$searchvar%' or LName like '%$searchvar%' or Add1 like '%$searchvar%' or Add2 like '%$searchvar%' or City like '%$searchvar%' or State like '%$searchvar%' or Zip like '%$searchvar%' or XCode like '%$searchvar%'; $qrow[]= mysql_query($qstring) or die(mysql_error()); $qresult = $qrow[0]; $num_rows = mysql_num_rows($qresult); while($qrow = mysql_fetch_assoc($qresult)) { $FName = $qrow['FName']; $LName = $qrow['LName']; $Add1 = $qrow['Add1']; $Add2 = $qrow['Add2']; } // what do you want to return...? return; } ? $returnedSomething = search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2); Jason, 1. You're missing a closing brace at the end of the while loop. 2. You're not returning anything from the function. The input parameters are pretty clear but what were you expecting to accomplish within the function? All the data returned from the query only have scope within the function, so unless you return something, like an array or a string, use references, or write to a global variable, you're not doing anything with the data from the db. David Hi David, Thanks for looking. I'm just starting to learn about functions, and obviously making a few mistakes along the road... Basically what I am trying to do is allow my customer the ability to search the database, display it on the website, and then export it to excel if they wish... the missing closing brace was a bad copy/paste job. I have tried to add $searchReturn = search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2); and then do a vardump on it and it's not returning any thing. I've also changed the return line to return $searchReturn['FName']; but it's still not showing through... I think functions will be the death of me... at least until I understand how to use them :) I think I'm off to google some more and see if I can get any more info... Thanks again for your help! Jason, Untested, but try this... function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2) { $qstring = SELECT * FROM .$table. WHERE FName like '%$searchvar%' or LName like '%$searchvar%' or Add1 like '%$searchvar%' or Add2 like '%$searchvar%' or City like '%$searchvar%' or State like '%$searchvar%' or Zip like '%$searchvar%' or XCode like '%$searchvar%'; $qrow = mysql_query($qstring) or die(mysql_error()); $qresult = $qrow; $num_rows = mysql_num_rows($qresult); $outputStr = table; while($qrow = mysql_fetch_assoc($qresult)) { $FName = $qrow['FName']; $LName = $qrow['LName']; $Add1 = $qrow['Add1']; $Add2 = $qrow['Add2']; $outputStr .= trtd$FName/tdtd$LName/tdtd$ADD1/tdtd$ADD2/td/tr\n; } $outputStr .= /table; return $outputStr; } $searchReturn = search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2); echo $searchReturn; David
Re: [PHP] Search function not working...
Jason, Untested, but try this... function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2) { $qstring = SELECT * FROM .$table. WHERE FName like '%$searchvar%' or LName like '%$searchvar%' or Add1 like '%$searchvar%' or Add2 like '%$searchvar%' or City like '%$searchvar%' or State like '%$searchvar%' or Zip like '%$searchvar%' or XCode like '%$searchvar%'; $qrow = mysql_query($qstring) or die(mysql_error()); $qresult = $qrow; $num_rows = mysql_num_rows($qresult); $outputStr = table; while($qrow = mysql_fetch_assoc($qresult)) { $FName = $qrow['FName']; $LName = $qrow['LName']; $Add1 = $qrow['Add1']; $Add2 = $qrow['Add2']; $outputStr .= trtd$FName/tdtd$LName/tdtd$ADD1/tdtd$ADD2/td/tr\n; } $outputStr .= /table; return $outputStr; } $searchReturn = search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2); echo $searchReturn; David Hold on a moment... function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2) { $qstring = SELECT * FROM .$table. WHERE FName like '%$searchvar%' or LName like '%$searchvar%' or Add1 like '%$searchvar%' or Add2 like '%$searchvar%' or City like '%$searchvar%' or State like '%$searchvar%' or Zip like '%$searchvar%' or XCode like '%$searchvar%'; $qresult = mysql_query($qstring) or die(mysql_error()); //$qresult = $qrow; // this line is the problem ! $num_rows = mysql_num_rows($qresult); $outputStr = table; while($qrow = mysql_fetch_assoc($qresult)) { $FName = $qrow['FName']; $LName = $qrow['LName']; $Add1 = $qrow['Add1']; $Add2 = $qrow['Add2']; $outputStr .= trtd$FName/tdtd$LName/tdtd$ADD1/tdtd$ADD2/td/tr\n; } $outputStr .= /table; return $outputStr; } $searchReturn = search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2); echo $searchReturn; That should work, assuming the query returns at least one row.. David
Re: [PHP] Search function not working...
Jason Pruim wrote: So I said in another thread that I would be asking another question about functions... So here it goes, I am attempting to write a function to search the database, which used to work just fine when I wrote it without using a function (Would that be considered static?) Now that I am attempting to rewrite my stuff so I can reuse the code, now it's not working... Here is what I used to do and it worked just fine: $qstring = SELECT * FROM .$table. WHERE FName like '%$search%' or LName like '%$search%' or Add1 like '%$search%' or Add2 like '%$search%' or City like '%$search%' or State like '%$search%' or Zip like '%$search%' or XCode like '%$search%'; if ($_SESSION['search'] != NULL){ echo The search string is: strong$search/strong.BR; $qrow[]= mysql_query($qstring) or die(mysql_error()); $qresult = $qrow[0]; $num_rows = mysql_num_rows($qresult); //display search form echo form action='search.php' method='GET' labelSearch: input type='text' name='search' id='search' / /label input type='submit' value='Go!' / /form; echo HTML a href='index.php'Return to database/A PTotal Records found: {$num_rows}/P A href='excelexport.php'Export selection to excel/A form method='GET' action='edit.php' table border='1' tr tha href='?order=a'First Name/A/th thA href='?order=b'Last Name/A/th thA href='?order=c'Address Line 1/A/th THA href='?order=d'Address Line 2/A/th THA href='?order=e'City/A/th thA href='?order=f'State/A/th thA href='?order=g'Zip/A/th THA href='?order=h'Code/A/th thA href='?order=i'ID #/A/th THEdit/th thDelete/th /tr HTML; echo Just testing: .$_SESSION['search']; while($qrow = mysql_fetch_assoc($qresult)) { //Display the search results using heredoc syntax echo HTML tr td{$qrow['FName']}/td td{$qrow['LName']}/td td{$qrow['Add1']}/td td{$qrow['Add2']}/td td{$qrow['City']}/td td{$qrow['State']}/td td{$qrow['Zip']}/td td{$qrow['XCode']}/td td{$qrow['Record']}/td tda href='edit.php?Record={$qrow['Record']}'Edit/a/td tda href='delete.php?Record={$qrow['Record']}'Delete/a/td /tr /form HTML; Now, here is what I have as a function and is not working: ?PHP $FName =; $LName =; $Add1 = ; $Add2 = ; //$_SESSION['search'] = $_GET['search']; function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2) { $qstring = SELECT * FROM .$table. WHERE FName like '%$searchvar%' or LName like '%$searchvar%' or Add1 like '%$searchvar%' or Add2 like '%$searchvar%' or City like '%$searchvar%' or State like '%$searchvar%' or Zip like '%$searchvar%' or XCode like '%$searchvar%'; $qrow[]= mysql_query($qstring) or die(mysql_error()); $qresult = $qrow[0]; $num_rows = mysql_num_rows($qresult); //while($qrow = mysql_fetch_assoc($qresult)) { $FName = $qrow['FName']; $LName = $qrow['LName']; $Add1 = $qrow['Add1']; $Add2 = $qrow['Add2']; return; } ? And what happens, is first of all it displays the entire database on the search page, which I'm kind of okay with... But when you search, it updates the variables, and echo's out the right search term, but it doesn't update the database to only show the search results... I think it might be tied to it displaying the entire database at page load... But I'm not sure.. Anyone have an idea of what I did wrong other then everything? :) Oh, and as far as calling the function I do this: search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2); -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] Ok, here would be my rendition of this function. ?php function search($searchvar, $table) { // Since we want to ensure that we have good data before we run our // query, we want to clear our search data before we use it $clean_searchvar = mysql_real_escape_string($searchvar); // Build our SQL statement $SQL = SELECT * FROM{$table} WHERE FName LIKE '%{$clean_searchvar}%' OR LName LIKE '%{$clean_searchvar}%' OR Add1LIKE '%{$clean_searchvar}%' OR Add2LIKE '%{$clean_searchvar}%' OR CityLIKE '%{$clean_searchvar}%' OR State LIKE '%{$clean_searchvar}%' OR Zip LIKE '%{$clean_searchvar}%' OR XCode LIKE '%{$clean_searchvar}%'; // Process SQL statement, continue on success or display error $res = mysql_query($SQL) or die(mysql_error());
[PHP] Calling All Opinionated ******** ....
hi people, I'm in the market for a new framework/toolkit/whatever-you-want-to-call-it. I've been taking a good hard look at the Zend Framework - if nothing else the docs are very impressive. I'd like to hear from people who have or are using ZF with regard to their experiences, dislikes, likes, problems, new found fame and fortune, etc ... but only if it concerns ZF. I don't need to hear stuff like 'use XYZ it's great' - finding php frameworks/CMS/etc is easy ... figuring out which are best of breed is another matter, if only because it involves reading zillions of lines of code and documentation. besides I find that you only ever get bitten in the ass by short-comings and bugs when your 80% into the project that needs to be online yesterday and you knee deep in a nightmare requirements change or tackling some PITA performance issue. so people, roll out your ZF love stories and nightmares - spare no details - share the knowledge. or something :-) tia, Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Posting Summary for Week Ending 1 February, 2008: php-general@lists.php.net
Posting Summary for PHP-General List Week Ending: Friday, 1 February, 2008 Messages| Bytes | Sender ++-- 403 (100%) 717988 (100%) EVERYONE 54 (13.4%) 61663 (8.6%) Nathan Nobbe quickshiftin at gmail dot com 38 (9.4%) 56548 (7.9%) Richard Lynch ceo at l-i-e dot com 37 (9.2%) 62959 (8.8%) Jochem Maas jochem at iamjochem dot com 34 (8.4%) 30253 (4.2%) Per Jessen per at computer dot org 24 (6%)44984 (6.3%) Robert Cummings robert at interjinn dot com 18 (4.5%) 29650 (4.1%) Eric Butera eric dot butera at gmail dot com 17 (4.2%) 21616 (3%)Greg Donald gdonald at gmail dot com 13 (3.2%) 29709 (4.1%) Jim Lucas lists at cmsws dot com 12 (3%)23082 (3.2%) Jason Pruim japruim at raoset dot com 12 (3%)15590 (2.2%) Paul Scott pscott at uwc dot ac dot za 12 (3%)18692 (2.6%) Stut stuttle at gmail dot com 12 (3%)29611 (4.1%) Zoltán Németh znemeth at alterationx dot hu 8 (2%)5256(0.7%) Richard Heyes richardh at phpguru dot org 7 (1.7%) 10847 (1.5%) Tom Chubb tomchubb at gmail dot com 7 (1.7%) 8182(1.1%) Nathan Rixham nrixham at gmail dot com 6 (1.5%) 7308(1%)Chris dmagick at gmail dot com 4 (1%)10478 (1.5%) Janet N janet9k at gmail dot com 4 (1%)8541(1.2%) Michael Fischer michi dot fischer at gmx dot net 4 (1%)4864(0.7%) Andrew Ballard aballard at gmail dot com 3 (0.7%) 11368 (1.6%) David Giragosian dgiragosian at gmail dot com 3 (0.7%) 6707(0.9%) Mr Webber captain_webber at hotmail dot com 3 (0.7%) 4189(0.6%) Anup Shukla anup dot shkl at gmail dot com 3 (0.7%) 7737(1.1%) Mike Morton mike at webtraxx dot com 3 (0.7%) 5654(0.8%) nihilism machine nihilismmachine at gmail dot com 3 (0.7%) 29192 (4.1%) Umar unix dot co at gmail dot com 3 (0.7%) 20380 (2.8%) Andrés Robinet agrobinet at bestplace dot biz 3 (0.7%) 9477(1.3%) Michael Fischer michi dot fischer at gmx dot net 2 (0.5%) 73397 (10.2%) philip spy_c_xamaican at rogers dot com 2 (0.5%) 1637(0.2%) jekillen jekillen at prodigy dot net 2 (0.5%) 1816(0.3%) Casey heavyccasey at gmail dot com 2 (0.5%) 2105(0.3%) Colin Guthrie gmane at colin dot guthr dot ie 2 (0.5%) 974 (0.1%) M dot Sokolewicz tularis at php dot net 2 (0.5%) 1021(0.1%) Mike Yrabedra lists at 323inc dot com 2 (0.5%) 1824(0.3%) Kyohere Luke pr0f3t at gmail dot com 2 (0.5%) 3617(0.5%) Daevid Vincent daevid at daevid dot com 1 (0.2%) 611 (0.1%) Peter Jackson tasmaniac at iprimus dot com dot au 1 (0.2%) 2975(0.4%) PHP Employer resumes at worldnetjobs dot com 1 (0.2%) 1824(0.3%) Gaudett Kacerski stoutening at contracostatimes dot com 1 (0.2%) 625 (0.1%) Christoph Boget christoph dot boget at gmail dot com 1 (0.2%) 1816(0.3%) Lagrow Cordaro loyalists at abgender dot com 1 (0.2%) 1782(0.2%) Dax Solomon Umaming knightlust at gmail dot com 1 (0.2%) 769 (0.1%) Bill Guion bguion at comcast dot net 1 (0.2%) 1009(0.1%) mike mike503 at gmail dot com 1 (0.2%) 441 (0.1%) Floor Terra floort at gmail dot com 1 (0.2%) 708 (0.1%) Isaac Gouy igouy2 at yahoo dot com 1 (0.2%) 520 (0.1%) jeffry s paragasu at gmail dot com 1 (0.2%) 5682(0.8%) Michael McGlothlin michaelm at swplumb dot com 1 (0.2%) 841 (0.1%) Manuel Lemos mlemos at acm dot org 1 (0.2%) 983 (0.1%) Brady Mitchell mydarb at gmail dot com 1 (0.2%) 1361(0.2%) Bastien Koert bastien_k at hotmail dot com 1 (0.2%) 820 (0.1%) Zbigniew Szalbot zszalbot at gmail dot com 1 (0.2%) 1229(0.2%) greenCountry adityavit at gmail dot com 1 (0.2%) 1147(0.2%) resumes at worldnetjobs dot com 1 (0.2%) 584
RE: [PHP] Calling All Opinionated ******** ....
These things are all on the bleeding edge, and if I'm not mistaken, Zend may be one of the newest, no? Extrapolate (Bleeding Edge = painful development) Warren Vail -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Friday, February 01, 2008 1:18 PM To: [php] PHP General List Subject: [PHP] Calling All Opinionated hi people, I'm in the market for a new framework/toolkit/whatever-you-want-to-call- it. I've been taking a good hard look at the Zend Framework - if nothing else the docs are very impressive. I'd like to hear from people who have or are using ZF with regard to their experiences, dislikes, likes, problems, new found fame and fortune, etc ... but only if it concerns ZF. I don't need to hear stuff like 'use XYZ it's great' - finding php frameworks/CMS/etc is easy ... figuring out which are best of breed is another matter, if only because it involves reading zillions of lines of code and documentation. besides I find that you only ever get bitten in the ass by short-comings and bugs when your 80% into the project that needs to be online yesterday and you knee deep in a nightmare requirements change or tackling some PITA performance issue. so people, roll out your ZF love stories and nightmares - spare no details - share the knowledge. or something :-) tia, Jochem -- 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] Calling All Opinionated ******** ....
On Feb 1, 2008 4:18 PM, Jochem Maas [EMAIL PROTECTED] wrote: hi people, I'm in the market for a new framework/toolkit/whatever-you-want-to-call-it. I've been taking a good hard look at the Zend Framework - if nothing else the docs are very impressive. I'd like to hear from people who have or are using ZF with regard to their experiences, dislikes, likes, problems, new found fame and fortune, etc ... but only if it concerns ZF. I don't need to hear stuff like 'use XYZ it's great' - finding php frameworks/CMS/etc is easy ... figuring out which are best of breed is another matter, if only because it involves reading zillions of lines of code and documentation. besides I find that you only ever get bitten in the ass by short-comings and bugs when your 80% into the project that needs to be online yesterday and you knee deep in a nightmare requirements change or tackling some PITA performance issue. so people, roll out your ZF love stories and nightmares - spare no details - share the knowledge. or something :-) tia, Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php So far I've only used the Zend_Mail functionality and it beats everything else I've tried as far as extensibility and performance are concerned. I've tried out several different packages and it just wins. The docs are great, it has unit tests on all parts of it, and there are lots of eyes looking over it, it's a no brainer! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling All Opinionated ******** ....
On 2/1/08, Jochem Maas [EMAIL PROTECTED] wrote: I'm in the market for a new framework/toolkit/whatever-you-want-to-call-it. I've been taking a good hard look at the Zend Framework - if nothing else the docs are very impressive. I'd like to hear from people who have or are using ZF with regard to their experiences, dislikes, likes, problems, new found fame and fortune, etc ... but only if it concerns ZF. I don't need to hear stuff like 'use XYZ it's great' - finding php frameworks/CMS/etc is easy ... figuring out which are best of breed is another matter, if only because it involves reading zillions of lines of code and documentation. besides I find that you only ever get bitten in the ass by short-comings and bugs when your 80% into the project that needs to be online yesterday and you knee deep in a nightmare requirements change or tackling some PITA performance issue. so people, roll out your ZF love stories and nightmares - spare no details - share the knowledge. or something :-) Hilarious. I'm in the market for a new framework, but please only tell me about ZF because I don't want to spend my own time researching stuff for myself. Since when is learning something new a crime? Why are you even a programmer? ZF works fine if you don't mind all the bloated OO PHP. Use it or don't. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Calling All Opinionated ******** ....
My thoughts, exactly. I had to count to 10 to keep myself from replying to His Rudeness. -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED] Sent: Friday, February 01, 2008 5:17 PM To: php-general@lists.php.net Subject: Re: [PHP] Calling All Opinionated On 2/1/08, Jochem Maas [EMAIL PROTECTED] wrote: I'm in the market for a new framework/toolkit/whatever-you-want-to-call-it. I've been taking a good hard look at the Zend Framework - if nothing else the docs are very impressive. I'd like to hear from people who have or are using ZF with regard to their experiences, dislikes, likes, problems, new found fame and fortune, etc .. but only if it concerns ZF. I don't need to hear stuff like 'use XYZ it's great' - finding php frameworks/CMS/etc is easy ... figuring out which are best of breed is another matter, if only because it involves reading zillions of lines of code and documentation. besides I find that you only ever get bitten in the ass by short-comings and bugs when your 80% into the project that needs to be online yesterday and you knee deep in a nightmare requirements change or tackling some PITA performance issue. so people, roll out your ZF love stories and nightmares - spare no details - share the knowledge. or something :-) Hilarious. I'm in the market for a new framework, but please only tell me about ZF because I don't want to spend my own time researching stuff for myself. Since when is learning something new a crime? Why are you even a programmer? ZF works fine if you don't mind all the bloated OO PHP. Use it or don't. -- Greg Donald http://destiney.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] Calling All Opinionated ******** ....
Greg Donald schreef: On 2/1/08, Jochem Maas [EMAIL PROTECTED] wrote: I'm in the market for a new framework/toolkit/whatever-you-want-to-call-it. I've been taking a good hard look at the Zend Framework - if nothing else the docs are very impressive. I'd like to hear from people who have or are using ZF with regard to their experiences, dislikes, likes, problems, new found fame and fortune, etc ... but only if it concerns ZF. I don't need to hear stuff like 'use XYZ it's great' - finding php frameworks/CMS/etc is easy ... figuring out which are best of breed is another matter, if only because it involves reading zillions of lines of code and documentation. besides I find that you only ever get bitten in the ass by short-comings and bugs when your 80% into the project that needs to be online yesterday and you knee deep in a nightmare requirements change or tackling some PITA performance issue. so people, roll out your ZF love stories and nightmares - spare no details - share the knowledge. or something :-) Hilarious. I'm in the market for a new framework, but please only tell me about ZF because I don't want to spend my own time researching stuff for myself. you need some glasses? I've just spent 4 hours reading ZF documentation and code ... today - I've played with it in the past but it was still beta at that time. I'm starting to take another look, but no ammount of playing with it or reading documentation will tell me if I'm going to have major regrets about choosing ZF for a large project when I'm 400 hours into it and stuck with a deadline and an impossible situation. funnily enough I'm not capable of researching inside someone else's head when it comes to *their opinion*, more specifically people who you are familiar with to soome degree, whereby you able to gauge to a better extent how relevant the opinion/experience offered is to one's own situation. Since when is learning something new a crime? and where do you go to learn someone else's opinion? Why are you even a programmer? something bothering you? got out of the wrong side of bed today? ZF works fine if you don't mind all the bloated OO PHP. Use it or don't. brilliant advice, you we're on better form yesterday my friend. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Timeout while waiting for a server-client transfer to start (large files)
On Thu, 31 Jan 2008 07:13:55 -, Per Jessen [EMAIL PROTECTED] wrote: Richard Lynch wrote: Your script is reading the whole file, 64 measly bytes at a time, into a monstrous string $tmp. Then, finally, when you've loaded the whole [bleep] file into RAM in $tmp, you just echo it out, right? Don't do that. :-) while (!feof($fp)){ echo fread($fp, 2048); } And if the OP is opening the file anyway, he might as well use readfile() instead. /Per Jessen, Zürich Well I got it to work, much thanks to Richard Lynch, but now everytime I download a file, it is corrupt. For example, when I download small .rar file, just to test, it is always corrupt ('Unexpected end of archive'). I also cleared my browser cache just to be sure, but same problem. Here is the code as it stands. I just can't get my head around why it wouldn't be working as it is... ?php //ob_start(); //ob_end_flush(); //ob_implicit_flush(TRUE); $rslogin = ''; $rspass = ''; $link = addslashes(trim($_POST['link'])); function cut_str($str, $left, $right) { $str = substr(stristr($str, $left), strlen($left)); $leftLen = strlen(stristr($str, $right)); $leftLen = $leftLen ? -($leftLen) : strlen($str); $str = substr($str, 0, $leftLen); return $str; } // Get the full premium link, and store it in $full_link after the redirect. *Surely* there is an easier way to get redirections? if(strlen($link)0) { $url = @parse_url($link); $fp = @fsockopen($url['host'], 80, $errno, $errstr); if (!$fp) { $errormsg = Error: b$errstr/b, please try again later.; echo $errormsg; exit; } $vars = dl.start=PREMIUMuri={$url['path']}directstart=1; $out = POST {$url['path']} HTTP/1.1\r\n; $out .= Host: {$url['host']}\r\n; $out .= User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n; $out .= Authorization: Basic .base64_encode({$rslogin}:{$rspass}).\r\n; $out .= Content-Type: application/x-www-form-urlencoded\r\n; $out .= Content-Length: .strlen($vars).\r\n; $out .= Connection: Close\r\n\r\n; fwrite($fp, $out); fwrite($fp, $out.$vars); while (!feof($fp)) { $string .= fgets($fp, 256); } //Tell us what data is returned //print($string); @fclose($fp); if (stristr($string, Location:)) { $redirect = trim(cut_str($string, Location:, \n)); $full_link = addslashes(trim($redirect)); } //print($string); //print(htmlbodyh1.$full_link./h1); if ($full_link) { // Get info about the file we want to download: $furl = parse_url($full_link); $fvars = dl.start=PREMIUMuri={$furl['path']}directstart=1; $head = Host: {$furl['host']}\r\n; $head .= User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n; $head .= Authorization: Basic .base64_encode({$rslogin}:{$rspass}).\r\n; $head .= Content-Type: application/x-www-form-urlencoded\r\n; $head .= Content-Length: .strlen($fvars).\r\n; $head .= Connection: close\r\n\r\n; $fp = @fsockopen($furl['host'], 80, $errno, $errstr); if (!$fp) { echo The script says b$errstr/b, please try again later.; exit; } fwrite($fp, POST {$furl['path']} HTTP/1.1\r\n); fwrite($fp, $head.$fvars); while (!feof($fp)) { //Keep reading the info until we get the filename and size from the returned Header - is there no easy way //of doing this? I also don't like the way I have to 'find' the redirected link (above).?? $tmp .= fgets($fp, 256); $d = explode(\r\n\r\n, $tmp); // I tried changing this to if ($d), { etc.., (instead of $d[1]) and the download of the rar file *wasn't* corrupt, it just had a filetype of x-rar-compressed instead of //application/octet-stream, and the filesize was 'unknown' - now this is just confusing me...! So i think (and guess) the problem of the file corruption is here, //because it must add some data to the filestream which corrupts it. Darn. if($d[1]) { preg_match(#filename=(.+?)\n#, $tmp, $fname); preg_match(#Content-Length: (.+?)\n#, $tmp, $fsize); $h['filename'] = $fname[1] != ? $fname[1] : basename($furl['path']); $h['fsize'] = $fsize[1]; break; }
Re: [PHP] Timeout while waiting for a server-client transfer to start (large files)
On Feb 1, 2008, at 5:45 PM, szalinski [EMAIL PROTECTED] wrote: On Thu, 31 Jan 2008 07:13:55 -, Per Jessen [EMAIL PROTECTED] wrote: Richard Lynch wrote: Your script is reading the whole file, 64 measly bytes at a time, into a monstrous string $tmp. Then, finally, when you've loaded the whole [bleep] file into RAM in $tmp, you just echo it out, right? Don't do that. :-) while (!feof($fp)){ echo fread($fp, 2048); } And if the OP is opening the file anyway, he might as well use readfile() instead. /Per Jessen, Zürich Well I got it to work, much thanks to Richard Lynch, but now everytime I download a file, it is corrupt. For example, when I download small .rar file, just to test, it is always corrupt ('Unexpected end of archive'). I also cleared my browser cache just to be sure, but same problem. Here is the code as it stands. I just can't get my head around why it wouldn't be working as it is... ?php //ob_start(); //ob_end_flush(); //ob_implicit_flush(TRUE); $rslogin = ''; $rspass = ''; $link = addslashes(trim($_POST['link'])); function cut_str($str, $left, $right) { $str = substr(stristr($str, $left), strlen($left)); $leftLen = strlen(stristr($str, $right)); $leftLen = $leftLen ? -($leftLen) : strlen($str); $str = substr($str, 0, $leftLen); return $str; } // Get the full premium link, and store it in $full_link after the redirect. *Surely* there is an easier way to get redirections? if(strlen($link)0) { $url = @parse_url($link); $fp = @fsockopen($url['host'], 80, $errno, $errstr); if (!$fp) { $errormsg = Error: b$errstr/b, please try again later.; echo $errormsg; exit; } $vars = dl.start=PREMIUMuri={$url['path']} directstart=1; $out = POST {$url['path']} HTTP/1.1\r\n; $out .= Host: {$url['host']}\r\n; $out .= User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n; $out .= Authorization: Basic .base64_encode({$rslogin}: {$rspass}).\r\n; $out .= Content-Type: application/x-www-form-urlencoded\r \n; $out .= Content-Length: .strlen($vars).\r\n; $out .= Connection: Close\r\n\r\n; fwrite($fp, $out); fwrite($fp, $out.$vars); while (!feof($fp)) { $string .= fgets($fp, 256); } //Tell us what data is returned //print($string); @fclose($fp); if (stristr($string, Location:)) { $redirect = trim(cut_str($string, Location:, \n)); $full_link = addslashes(trim($redirect)); } //print($string); //print(htmlbodyh1.$full_link./h1); if ($full_link) { //Get info about the file we want to download: $furl = parse_url($full_link); $fvars = dl.start=PREMIUMuri={$furl['path']}directstart=1; $head = Host: {$furl['host']}\r\n; $head .= User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n; $head .= Authorization: Basic .base64_encode({$rslogin}: {$rspass}).\r\n; $head .= Content-Type: application/x-www-form-urlencoded\r\n; $head .= Content-Length: .strlen($fvars).\r\n; $head .= Connection: close\r\n\r\n; $fp = @fsockopen($furl['host'], 80, $errno, $errstr); if (!$fp) { echo The script says b$errstr/b, please try again later.; exit; } fwrite($fp, POST {$furl['path']} HTTP/1.1\r\n); fwrite($fp, $head.$fvars); while (!feof($fp)) { //Keep reading the info until we get the filename and size from the returned Header - is there no easy way //of doing this? I also don't like the way I have to 'find' the redirected link (above).?? $tmp .= fgets($fp, 256); $d = explode(\r\n\r\n, $tmp); // I tried changing this to if ($d), { etc.., (instead of $d[1]) and the download of the rar file *wasn't* corrupt, it just had a filetype of x-rar-compressed instead of //application/octet-stream, and the filesize was 'unknown' - now this is just confusing me...! So i think (and guess) the problem of the file corruption is here, //because it must add some data to the filestream which corrupts it. Darn. if($d[1]) { preg_match(#filename=(.+?)\n#, $tmp, $fname); preg_match(#Content-Length: (.+?)\n#, $tmp, $fsize); $h['filename'] = $fname[1] != ? $fname[1] : basename($furl['path']); $h['fsize'] = $fsize[1]; break; } } @fclose($fp); $filename = $h['filename']; $fsize = $h['fsize']; //Now automatically download the file: @header(Cache-Control:); @header(Cache-Control: public); @header(Content-Type: application/octet-stream); @header(Content-Disposition: attachment;
RE: [PHP] PEAR website and MSIE 6 (M$ forcing IE7)
-Original Message- From: Richard Heyes [mailto:[EMAIL PROTECTED] Sent: Friday, February 01, 2008 3:43 AM To: Daevid Vincent Cc: 'PHP General List' Subject: Re: [PHP] PEAR website and MSIE 6 Daevid Vincent wrote: I will be very sad in 15 days when M$ FORCES everyone to it. WT? Feb 12th is D-day. http://www.google.com/search?sourceid=navclientie=UTF-8rls=GGLG,GGLG:2005- 28,GGLG:enq=microsoft+forcing+ie7 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Redirecting STDERR to a file?
Hi, I was trying to write a script in PHP that takes a program name as an argument and invoke it as a daemon. PHP provides fork(pcntl_fork), setsid(posix_setsid) and umask, so it was easy. However, I couldn't find a way to redirect STDERR a file. I like to have the daemon write its log to its own logfile, like apache and mysql do. So is there any way to accomplish that? Any pointers, suggestions would be greatly appreciated. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling All Opinionated ******** ....
On Fri, 2008-02-01 at 22:18 +0100, Jochem Maas wrote: I'd like to hear from people who have or are using ZF with regard to their experiences, dislikes, likes, problems, new found fame and fortune, etc ... but only if it concerns ZF. I have integrated a few ZF components into the Chisimba framework - search_lucene, Http_request, and a few others so far, and they are OK. I find some of the bits really slow, but solid, others perform well. My biggest gripe with ZF components is that the Exception handler Zend_Exception, is sometimes tricky to override with the native Chisimba customException handler (which produces pretty output as opposed to an ugly call stack, and logs the ugly things (user wise) to a log file). Sometimes it takes a few more minutes of time. Basically, I would say evaluate each component on its own merit. If you would like to use one, check the code and run some performance tests on it - sometimes you will be able to roll your own in less time and with simpler code. --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR website and MSIE 6 (M$ forcing IE7)
On 2/1/08, Daevid Vincent [EMAIL PROTECTED] wrote: Feb 12th is D-day. http://www.google.com/search?sourceid=navclientie=UTF-8rls=GGLG,GGLG:2005- 28,GGLG:enq=microsoft+forcing+ie7 Actually... http://blog.wired.com/monkeybites/2008/01/microsofts-ie-7.html The short story is that you won't wake up February 12 and find your beloved IE 6 has been replaced with IE 7. It's not a for sure thing, it depends on your setup it looks like. WSUS definately needs assistance. It looks a bit confusing according to microsoft's website whether a normal user's XP will be upgraded. Of course, you can just not upgrade your system, or selectively install the updates (which I suggest anyhow) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php