Re: [PHP] Re: Multithreading for OOP PHP
On 31/10/2012 13:46, Alex Nikitin wrote: Hey guys (and/or gals), I have heard this question entirely too many times, I think at some point Rasmus just stopped responding to it. The real reason that PHP is not threaded has nothing to do with PHP internal or extension thread safety, the reason is more to the extent that it doesn't make sense to add threading to PHP, it will only increase code and model complexity and create more points of failure, but again the reason is not this, the reason is that it doesn't make sense in PHP's native environment to add threading in the first place. Natively PHP is summoned by a web server, yes you can call PHP in CLI, but that's not it's point market, PHP is first and foremost a server-side language for the web and it is ran by a web server such as Apache or Nginx or IIS(i wouldn't know why you would use IIS, but it could be). All of these web servers (maybe with exception of IIS, i wouldn't know) work pretty much on the same principal, you have the main process that spawns a bunch of worker threads (this is adjustable in configuration, but is typically 1 per cpu thread). These threads are what actually process the requests and call PHP, meaning that if multiple threads are processing multiple requests, multiple instances of PHP will be called. This is why adding threading to PHP makes absolutely no sense, why would you spawn threads in something that is already being called by a thread? Don't get me wrong, threads spawning other threads is a solution, but it is a solution on massively parallel architectures, such as the GPGPUs that can handle over a thousand threads, and it is a solution for an entirely different problem, namely costly conditional statements; PHP on the other hand runs on a general purpose processor that already cache thrashes and runs into issues with instruction pipelines in parallel execution, adding more threads to it would do nothing for performance (or make it worse), make for more complex code and introduce new issues, like for example how do you test threaded code, debugging, messaging, etc, which will introduce new places where php apps fail, new security concerns, etc, and I think we are far from having current issues fixed... Want to parallelize your PHP execution? Learn to love curl_multi :) In this case, fix the program, not the programming language. Just my $0.02 -- Alex -- The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. ~Seymour Cray You're very wrong. Adding threading doesn't increase complexity at all, the fact is, that people are coming up with horrible ways to execute what they should be executing in threads. It's 2012, my mobile phone has a dual core processor !! All that adding threading does is allow those people bending over backwards - using horrible hacks just to do two things at once - to do things properly. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Threading on Windows
On 14/09/2012 04:42, tamouse mailing lists wrote: On Thu, Sep 13, 2012 at 9:32 PM, admin ad...@buskirkgraphics.com wrote: It has been suggested: That because php does not support PCNTL threading on Windows that multiple services of php are an alternative. I am interested in this theory, if anyone is currently working on a project that (forks) processes off to another instance or service of PHP on windows please let me know. In some of my latest development I have some rather large processes that consume the single instance of PHP, threading these off would be ideal. Example: $tmpsrv=win32_query =win32_create_service(array( 'params' = __FILE__. install, 'service' = 'Name_of_the_service', 'display' = 'Name of service to be displayed in the service list' )); Any windows php developers have ideas, comments on this suggestion? I'm interested in the answer to this as well. https://github.com/krakjoe/pthreads Windows Download on downloads page, it's a couple of days behind. Keep watching ... enough to get you started ... Sorry if this gets sent twice, the news server or my internet connection dropped out ... Enjoy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Threading on Windows
On 14/09/2012 04:42, tamouse mailing lists wrote: On Thu, Sep 13, 2012 at 9:32 PM, admin ad...@buskirkgraphics.com wrote: It has been suggested: That because php does not support PCNTL threading on Windows that multiple services of php are an alternative. I am interested in this theory, if anyone is currently working on a project that (forks) processes off to another instance or service of PHP on windows please let me know. In some of my latest development I have some rather large processes that consume the single instance of PHP, threading these off would be ideal. Example: $tmpsrv=win32_query =win32_create_service(array( 'params' = __FILE__. install, 'service' = 'Name_of_the_service', 'display' = 'Name of service to be displayed in the service list' )); Any windows php developers have ideas, comments on this suggestion? I'm interested in the answer to this as well. https://github.com/krakjoe/pthreads Windows Download on downloads page, it's a couple of days behind. Keep watching ... enough to get you started ... Sorry if this gets sent twice, the news server or my internet connection dropped out ... Enjoy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php-cli-shebang
why not using php.exe instead of php-cgi.exe as a parser ? On Wed, Jun 8, 2011 at 7:42 AM, Lists li...@euca.us wrote: Lists wrote: Windows Server 2003 PHP fastcgi 5.2 O.K. '-q' is quiet mode (no header info), which works better when not using the -f flag when calling the script (it appears). anyway, I solved my issues with a work around, so no worries. Donovan -- dbrooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Powered By Francis™. Welcome to my website: http://www.francistm.com Rewrite to francis...@gmail.com please.
Re: [PHP] Help needed with php.ini
I remember that there's 2 php.ini in Fedora, one is for SAPI like apache or other CGIServer, and another is for CLI. Can you confirm that you edited a right config file? On Mon, Jun 6, 2011 at 4:55 AM, Camilo Sperberg unrea...@gmail.com wrote: On 05-06-2011, at 10:31, Adam Tong adam.to...@gmail.com wrote: Hi, I can't set correctly the error display and reporting properties. I don't know what i'm doing wrong. Here is the section that i modified in php.ini: - display_errors = On ; Default Value: On ; Development Value: On ; Production Value: Off display_startup_errors = On ; Default Value: Off ; Development Value: On ; Production Value: Off error_reporting = E_ALL | E_STRICT ; Default Value: E_ALL ~E_NOTICE ; Development Value: E_ALL | E_STRICT ; Production Value: E_ALL ~E_DEPRECATED And here is the output of phpinfo(): - display_errorsOffOff display_startup_errorsOffOff doc_rootno valueno value docref_extno valueno value docref_rootno valueno value enable_dlOffOff error_append_stringno valueno value error_logno valueno value error_prepend_stringno valueno value error_reporting22527 22527 - I'm using a default installation (using yum) of php on Fedora14. This is my development environment, and want to see all the errors on standard output. Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Have you modified the example values instead of the ones mid-way php.ini? If so, scroll down to check. The latest settings should override the previous one. Have you restarted apache with service httpd restart or /etc/init.d/httpd restart? (or apachectl restart) In your php script or htaccess file, do you override those values? Sent from my iPhone 5 Beta [Confidential use only] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Powered By Francis™. Welcome to my website: http://www.francistm.com Rewrite to francis...@gmail.com please.
[PHP] a shortcut to set variable
eh, I just want to get a shortcut like $id = isset($_GET['id']) ? $_GET['id'] : 0; BTW, I'm using PHP5.3+, thanks bros. -- Powered By Francis™. Welcome to my website: http://www.francistm.com Rewrite to francis...@gmail.com please.
Re: [PHP] PHP Email Question
Hi I am trying the following snippet as Bostjan suggested, and an email is getting sent when I submit the form however in the body of the email I am getting none of the form data in the body of the email. All I am getting is the letter 'z' ? Also in the from field of the email this is showing as my email address and not the email address of the user who has sent the form Any ideas on where I am going wrong with this snippet? Any advice would be much appreciated $msgContent = Name: . $values['name'] .\n; $msgContent .= Address: . $values['address'] .\n; $msgContent .= Telephone: . $values['telephone'] .\n; $msgContent .= Email Address: . $values['emailaddress'] .\n; $msgContent .= Message: . $values['message'] .\n; function ProcessForm($values) { mail('myemail:domain.com', 'Website Enquiry', $msgContent, From: \{$values['name']}\ {$values['emailaddress']}); // Replace with actual page or redirect :P echo htmlheadtitleThank you!/title/headbodyThank you!/body/html;
[PHP] PHP Email Question
Hi Sorry for the simple question but I am trying to get my head around PHP. I have a sample PHP script that I am trying to use to send a php powered email message. The snippet of code is shown below mail('em...@address.com', 'Subject', $values['message'], From: \{$values['name']}\ {$values['emailaddress']}); This works fine, but how can I add in other fields to the email that is recieved? For example in the form there are fields called, 'emailaddress', 'telephone', 'address' and 'name' which I need to add into the form along with the message field Also with the formatting how can I change the format of the email to Name: $values['name'], Address: etc Message: TIA
[PHP] Error in Building an XML File
Hello, I am using PHP to build an XML file, but I keep on getting an XML error when open the file in Google Chrome. - This page contains the following errors: error on line 30 at column 318: Entity 'iuml' not defined Below is a rendering of the page up to the first error. is this something to do with document encoding? I am using these as headers for the script header(content-type:text/xml;charset=utf-8); header(Content-Disposition:attachment;filename=google_feed.xml); Thanks Joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error in Building an XML File
On Mon, Mar 9, 2009 at 9:53 AM, Bob McConnell r...@cbord.com wrote: From: Joe Harman I am using PHP to build an XML file, but I keep on getting an XML error when open the file in Google Chrome. - This page contains the following errors: error on line 30 at column 318: Entity 'iuml' not defined Below is a rendering of the page up to the first error. Okay, Thanks... appears the problem is that I have foreign language entities in my HTML... Ugh I am sure this is not really the most efficient way to do this, but I tried using the following to get rid of these, but it appears that it just converts them to this i¿½... $search = explode(,,ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,e,i,ø,u); $replace = explode(,,c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,e,i,o,u); $decode_string = str_replace($search, $replace, html_entity_decode($row_rsFeed['full_desc'])) I am going to read up some more on sanitizing HTML Joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML RSS installation
I previously had my web page hosted on a shared Apache server. The web hosts installed the PEAR modules on the system for me. I have now decided to go to Godaddy who have a shared Linux server. They do not install PEAR modules and I have to do myself. I found the go-pear.php program and managed to get it to install PEAR, but the XML_RSS was not included. I scratched around further and found there is a file called XML_RSS-0.9.10.tar which I have downloaded to my PC. I can upload it to my web site with FTP but I don't know where to put it or what to do with it. I have been at this for 3 days now and need some help, what must I do now to get the RSS working. Yours truly, Joe
[PHP] operators as callbacks?
Is it possible to use a PHP operator as a callback? Suppose I want to add two arrays elementwise, I want to be able to do something like this: array_map('+', $array1, $array2) but this doesn't work as + is an operator and not a function. I can use the BC library's math functions instead: array_map('bcadd', $array1, $array2) but that is an ugly hack that might break if the library is not available. I can create an anonymous function: array_map(create_function('$a, $b', 'return $a + $b;'), $array1, $array2) but that seems really unnecessarily verbose. Is there any simple clean way to do it? Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive Directory Listing
I would say to do that with CSS, not building it into the output. That's actually how I've got things set up now -- I just rarely trust the house-of-cards that is nested lists in CSS (and I've gone and complicated things with first-child selectors all over the place)! Thanks, all, for the great help! --joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive Directory Listing
Joe, Here is a simplified recursive version of your above statement. ?php $dir = '.'; function displayDir($dir='.') { $show = FALSE; $results = glob($dir.'/*'); foreach ( $results AS $entry ) { if ( is_dir($entry) !in_array($entry, array('.', '..')) ) { $dirs[] = $entry; $show = TRUE; } } if ( $show ) { echo 'ul'; foreach ( $dirs AS $entry ) { echo 'li', basename($entry); displayDir($entry); echo '/li'; } echo '/ul'; } } displayDir($dir); ? Hope this helps -- Jim Lucas Excellent, Jim. Thanks very much for your help. At the risk of straying too far from the original subject/call-for-help, is there a way to flag the *first* time the function runs through a ul creation? Though my design doesn't call for it now, I could see the value of styling the first level separately than the sub-directories. Again, thanks very much! --joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive Directory Listing
Thanks, all, for pointing me to the SPL iterators. i've been hunting around and i've managed to come up with a working script. I know it could be better, though. I know this is terribly inefficient -- a lot of manual repetition and no recursion. Here's what I've got, commenting my concerns: ?php // start from the current directory $dirs = new DirectoryIterator('./'); //open master ul echo 'ul'; foreach ( $dirs as $dir ) { // only get dirs, exclude . and .. // seems like this should be a function... if (($dir-isDir()) AND ($dir != '.') AND ($dir != '..')) { // begin each qualifying dir with an li echo 'li' . $dir; // don't close the li, check again, one level deeper // here's where i'm missing recursion, i think... $subDirs = new DirectoryIterator('./' . $dir .'/'); if ($subDirs-valid()) { // second verse, same as the first... echo 'ul'; foreach ($subDirs as $subDir) { if (($subDir-isDir()) AND ($subDir != '.') AND ($subDir !='..')) { // i could manually add another level check, i guess...? echo 'li'. $subDir . '/li'; } } // close second list echo '/ul'; } //close first-level item echo '/li'; } } //close master ul echo '/ul'; ? this will work for me, but it's bloated, i know. and it's rendering unnecessary ul / in the code wherever there isn't a subdirectory (i can't get a hasChildren() check to work properly. I'd appreciate any feedback. I've been referring to the SPL documentation in the manual off php.net, and the examples at phpro.org. if there are any others out there, i'd be happy to keep digging! On 10/30/08, Jochem Maas [EMAIL PROTECTED] wrote: Joe Schaeffer schreef: Well, that makes things much easier (and that should teach me to rely on a 5-year-old O'Reilly book...)! Thanks for the help! I'm able to display all the contents of the correct dirs and subdirs, but I'm struggling with my implementation. Since I'm trying to nest unordered lists, I can't seem to 'catch' sub-directories to nest it within their parent li tags (and then close the corresponding ul when necessary. Before I spend time trying to figure out how to chain the iterators or mine the returned arrays, is it fair to ask if this approach is even possible? sure, RecursiveIteratorIterator or DirectoryTreeIterator both have a getDepth() method which might come in useful. alternatively you could subclass either and define the beginChildren() and endChildren() methods to output the open/close UL tags. have a hunt around here: http://www.php.net/~helly/php/ext/spl/ Again, thanks for the point in the right direction! On Thu, Oct 30, 2008 at 1:30 PM, Jochem Maas [EMAIL PROTECTED] wrote: Joe Schaeffer schreef: New to PHP development, new to the list; searched the archives but didn't find an answer (or at least nothing i could successfully adapt). I have a (readable) directory structure like so: ../navigation /cats /dogs /beagles /collies /some/other/dirs/ /horses I need to display those directories in nested html lists (marked up with css). Using PHP on the above, I'd like to produce the following HTML: ul licats/li lidogs ul libeagles/li licollies ullisome.../li/ul /li /ul /li lihorses/li /ul I'm able to display one level deep (cats, dogs, horses), but not nest the lists accordingly. Since this is for a navigation structure, obviously I'll have anchors in the li/li lines. They'll be formatted like so href=index.php?section=dogschapter=colliesverse=some . Some details about my environment: 1) no files will be in the /navigation (or sub) dirs, but i'd (ideally) like to define a depth, to prevent 3-4 levels of navigation. 2) I can successfully exclude dirs (. and .. and anything else I define) 3) the actual PHP script probably won't be in the /navigation directory, so I'll need a defined starting path (ie, $root = /site/docs/includes/navigation/ or somesuch...). 4) no database access (otherwise this whole contraption wouldn't be an issue...) Any help is greatly appreciated
[PHP] Recursive Directory Listing
New to PHP development, new to the list; searched the archives but didn't find an answer (or at least nothing i could successfully adapt). I have a (readable) directory structure like so: ../navigation /cats /dogs /beagles /collies /some/other/dirs/ /horses I need to display those directories in nested html lists (marked up with css). Using PHP on the above, I'd like to produce the following HTML: ul licats/li lidogs ul libeagles/li licollies ullisome.../li/ul /li /ul /li lihorses/li /ul I'm able to display one level deep (cats, dogs, horses), but not nest the lists accordingly. Since this is for a navigation structure, obviously I'll have anchors in the li/li lines. They'll be formatted like so href=index.php?section=dogschapter=colliesverse=some . Some details about my environment: 1) no files will be in the /navigation (or sub) dirs, but i'd (ideally) like to define a depth, to prevent 3-4 levels of navigation. 2) I can successfully exclude dirs (. and .. and anything else I define) 3) the actual PHP script probably won't be in the /navigation directory, so I'll need a defined starting path (ie, $root = /site/docs/includes/navigation/ or somesuch...). 4) no database access (otherwise this whole contraption wouldn't be an issue...) Any help is greatly appreciated, thank you in advance. --joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursive Directory Listing
Well, that makes things much easier (and that should teach me to rely on a 5-year-old O'Reilly book...)! Thanks for the help! I'm able to display all the contents of the correct dirs and subdirs, but I'm struggling with my implementation. Since I'm trying to nest unordered lists, I can't seem to 'catch' sub-directories to nest it within their parent li tags (and then close the corresponding ul when necessary. Before I spend time trying to figure out how to chain the iterators or mine the returned arrays, is it fair to ask if this approach is even possible? Again, thanks for the point in the right direction! On Thu, Oct 30, 2008 at 1:30 PM, Jochem Maas [EMAIL PROTECTED] wrote: Joe Schaeffer schreef: New to PHP development, new to the list; searched the archives but didn't find an answer (or at least nothing i could successfully adapt). I have a (readable) directory structure like so: ../navigation /cats /dogs /beagles /collies /some/other/dirs/ /horses I need to display those directories in nested html lists (marked up with css). Using PHP on the above, I'd like to produce the following HTML: ul licats/li lidogs ul libeagles/li licollies ullisome.../li/ul /li /ul /li lihorses/li /ul I'm able to display one level deep (cats, dogs, horses), but not nest the lists accordingly. Since this is for a navigation structure, obviously I'll have anchors in the li/li lines. They'll be formatted like so href=index.php?section=dogschapter=colliesverse=some . Some details about my environment: 1) no files will be in the /navigation (or sub) dirs, but i'd (ideally) like to define a depth, to prevent 3-4 levels of navigation. 2) I can successfully exclude dirs (. and .. and anything else I define) 3) the actual PHP script probably won't be in the /navigation directory, so I'll need a defined starting path (ie, $root = /site/docs/includes/navigation/ or somesuch...). 4) no database access (otherwise this whole contraption wouldn't be an issue...) Any help is greatly appreciated, thank you in advance. RecurisiveDirectoryIterator and FilterIterator classes from SPL is something that will get you home. the archives and the intertubes offer examples (etc) on how to use these. --joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Action on 'Require' Fatal Error
Hello, is there a way to call a function or do a header(Location: page.php) when a fatal error is detected from using a the require statement Thanks Joe Harman
[PHP] Retrive a ID or Class value from a form input field
Hello, is there any way to get more field information other than just the value of a field when a form is submitted??? ex: input name=email type=text id=email size=30 maxlength=120 class=theClass value= / type, size, class, etc. Thanks Joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrive a ID or Class value from a form input field
I was just writing a form validation script... I know that there is ton of them out there... and i know that there are some different methods of doing it... but i want to assign class names to each field like class=req:email... not sure if that is the right way to do it, but i thought it would make thing neat and tidy Thanks for all your input Joe On Mon, Jun 9, 2008 at 3:09 PM, Jim Lucas [EMAIL PROTECTED] wrote: Jim Lucas wrote: Jim Lucas wrote: Joe Harman wrote: Hello, is there any way to get more field information other than just the value of a field when a form is submitted??? ex: input name=email type=text id=email size=30 maxlength=120 class=theClass value= / type, size, class, etc. Thanks Joe Yes, but that would be a Javascript question. Google for a javascript method called getAttribute() Man, what a day. I should have said it like this. No, but in javascript, before the form is submitted, you can. then Let me ask this. Why would you want to do this? -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- Joe Harman SCP Performance Parts Warehouse 3475 High Ridge Blvd High Ridge, MO 63049 Office : (636) 677-1320 Cell : (269) 277-0717 http://www.scpracingparts.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Web Apps OpenID
Yeah, after reading some about it yesterday and using it on some sites, I like that it sort of simplifies some things for the end user... it really fits sites like social networking stuff well.. I am considering using this for our ecommerce site, it only becomes useful though for repeat visitors though... which is what I want to make it easy convienent for those repeat customers thanks for your input guys Joe On Wed, May 7, 2008 at 4:04 AM, Colin Guthrie [EMAIL PROTECTED] wrote: Joe Harman wrote: I am curious here if any of you are considering or already using OpenID or Windows CardSpace? Does anyone see this being a big deal??? from a users stand point it seems like a big hassle to get started with it and I'm not sure if it would scare people away or not? any thoughts I've been looking at some PHP scripts out there for OpenID... does anyone have one to recommend??? With a bit of an upcoming rewrite of some of our user handling code, I fully intend to support OpenID. I really like the idea and want to promote it as much as possible. Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Joe Harman SCP Performance Parts Warehouse 3475 High Ridge Blvd High Ridge, MO 63049 Office : (636) 677-1320 Cell : (269) 277-0717 http://www.scpracingparts.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Web Apps OpenID
Hey Ya'll! I am curious here if any of you are considering or already using OpenID or Windows CardSpace? Does anyone see this being a big deal??? from a users stand point it seems like a big hassle to get started with it and I'm not sure if it would scare people away or not? any thoughts I've been looking at some PHP scripts out there for OpenID... does anyone have one to recommend??? -- Joe Harman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with preg_match_all regex for alt tags
Hey y'all ... i am having alittle trouble with this regex for finding ALT tags for images... Here is my statement preg_match_all('alt[^]*?.*?[^]'si, $output, $alt_tags); Evaluating [other html code]... img src=images/race-parts_wheels-tires.jpg vspace=2 border=0 alt=Wheel Tire Acc / ...[other html code] I am currently getting alt=Wheel Tire Acc / I want this result alt=Shopping Cart Thanks for your help -- Joe Harman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect slowness
Hi Waynn! have you ever tried using 1. sql_cache SELECT SQL_CACHE * FROM table .. I use this alot... although you have to have mysql cache enable in the sql config file... your webhost can tell you if it is on or not 2. make indexes for your tables here is a good article http://www.databasejournal.com/features/mysql/article.php/1382791 a great admin program to use is Navicat... it's very easy to make your indexes there... Hopefully those 2 suggestions speed up things a little! :o) let us know if it works Joe On Mon, Apr 28, 2008 at 12:14 AM, Waynn Lue [EMAIL PROTECTED] wrote: Our site has been slowing down dramatically in the last few days, so I've been trying to figure out why. I ran some profiling scripts on our site and saw that we're spending between 3-9 seconds on mysql_connect. Then I connected to our db and saw that there were over 100 connections at the time, most of them sleeping. Is this because we don't close mysql connections until the end of script execution? How do people generally structure their code to minimize the time they keep mysql connections open? Currently all db connections go through one file, which gets included at the top of the file. One other question, is it better to open one connection, then re-use it later, or just continually open and close per db call? Thanks, Waynn -- 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] Making an array from delimited data
I have some data that I pull from a database that is in the following format: - Gauge Style: Auto Meter Pro-Comp Tachometer Usage: Standard Gauge Series: Analog Gauge Range: 0-11,000 rpm Gauge Diameter (in): 5 in. Gauge Diameter (mm): 127.00mm Sweep: Full sweep - I want the array to end up like this -- $data['Gauge Style'] = Auto Meter Pro-Comp $data['Tachometer Usage'] = Standard $data['Gauge Series'] = 0-11,000 rpm I know I can use explode on on set of data... but up do you do it line by line? Thanks for your help -- Joe Harman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Making an array from delimited data
this is the complete data that was initially submitted through a textarea field. On Mon, Apr 28, 2008 at 2:56 PM, Shawn McKenzie [EMAIL PROTECTED] wrote: Joe Harman wrote: I have some data that I pull from a database that is in the following format: - Gauge Style: Auto Meter Pro-Comp Tachometer Usage: Standard Gauge Series: Analog Gauge Range: 0-11,000 rpm Gauge Diameter (in): 5 in. Gauge Diameter (mm): 127.00mm Sweep: Full sweep - I want the array to end up like this -- $data['Gauge Style'] = Auto Meter Pro-Comp $data['Tachometer Usage'] = Standard $data['Gauge Series'] = 0-11,000 rpm I know I can use explode on on set of data... but up do you do it line by line? Thanks for your help The following is one field from the db, or each line is a field or what? Gauge Style: Auto Meter Pro-Comp Tachometer Usage: Standard Gauge Series: Analog Gauge Range: 0-11,000 rpm Gauge Diameter (in): 5 in. Gauge Diameter (mm): 127.00mm Sweep: Full sweep -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Joe Harman SCP Performance Parts Warehouse 3475 High Ridge Blvd High Ridge, MO 63049 Office : (636) 677-1320 Cell : (269) 277-0717 http://www.scpracingparts.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Making an array from delimited data
Thanks guys... that help me out a lot... i was thinking too hard on ... LOL have a great day! Joe On Mon, Apr 28, 2008 at 3:01 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: On Mon, Apr 28, 2008 at 1:58 PM, Joe Harman [EMAIL PROTECTED] wrote: this is the complete data that was initially submitted through a textarea field. just to clarify my example assumes $dbData is a single string. if the info you posted is getting stored in a single field it should work just fine. -nathan -- Joe Harman SCP Performance Parts Warehouse 3475 High Ridge Blvd High Ridge, MO 63049 Office : (636) 677-1320 Cell : (269) 277-0717 http://www.scpracingparts.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Confused about handling bytes
While I'm sure this is a stupid question and the solution will be obvious to everyone here, this is confusing me. I'm trying to control a device over a serial port using a PHP script, and one of the things I need to do is read a 26-byte string from an EEPROM, using a command that returns two bytes at a time, and write similar strings using a similar command. For example, to read the first two bytes of one such string beginning at address 0x484, I would send: 04 84 00 00 BB Here's the code I've written so far: $string = 1; //which of 200 strings I want to read $base = pack(H*,dechex((($string-1)*hexdec(0x1a))+hexdec(0x484))); //calculate the base address of the string (the first starts at 0x484) for($i=0;$i 13;$i++) { //iterate 13 times (26 bytes / 2 bytes at a time) dio_write($serial,$base.\x00\x00\xbb,5); //send the command $output[] = dio_read($serial,1); // read first byte $output[] = dio_read($serial,1); // read second byte $base = pack(H*,dechex(hexdec(bin2hex($base))+2)); //increment address } There are two things wrong with this. First, the final line isn't doing what it's supposed to. Instead of adding 2 to the value of $base each time, It's producing a pattern like this: 0x484, 0x486, 0x73, 0x73, 0x73, 0x488, 0x48a, 0x48c, 0x48e, 0x490, 0x74, 0x74, 0x74 Second, the format of $base doesn't seem to be handled correctly in line 4 of the above code. Given a value of 0x484, this line should write the bytes 04 84, but it is obviously not doing so, given the response I get from the device (it sends FF FF instead of the expected value at that address, which I get when I remove the variable and manually specify the address). What are the solutions to these problems? Thanks, -Joe Veldhuis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form verification
Captcha http://en.wikipedia.org/wiki/Captcha On 11/1/06, Ron Piggott (PHP) [EMAIL PROTECTED] wrote: I am wondering if any of you know what it is called when letters come up for the user to key in for form entry verification. Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Query question
Agreed, this should go to a MySQL list. But in the spirit of helping I think the following should give you a good starting point. SELECT `year`, COUNT(`year`) AS `count` FROM `tbl` GROUP BY `year` ASC On 10/28/06, Ed Lazor [EMAIL PROTECTED] wrote: Use the mysql list :) On Oct 28, 2006, at 3:01 PM, Beauford wrote: Hi, I have a MySQL database with a date field and a bunch of other fields. The date field is in the format - 01/01/2006. What I want to do is query the database and create a table that shows just the year and how many instances of the year there is. I have been taxing my brain for a simple solution, but just not getting it. Any suggestions? Thanks Example output. Year Count 2002 5 2003 8 2004 9 2005 15 2006 22 ps - I get this information sent to me and I can't change any of the data. I just enter it in the db and then hopefully do the query on it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Query question
Look into the MySQL YEAR() function to extract the year from a specific date. Start here: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html On 10/28/06, Beauford [EMAIL PROTECTED] wrote: I posted this here as I figured I would need to manipulate this using PHP. The code below doesn't quite work because the date is in the format of 05/05/2006. So I am getting totals for each date, not each year. I need the totals for each year, regardless of the day or month. This is why I figured I'd need to use PHP to maybe put it in an array first or something. Thanks -Original Message- From: Joe Wollard [mailto:[EMAIL PROTECTED] Sent: October 28, 2006 10:30 PM To: Ed Lazor Cc: Beauford; PHP Subject: Re: [PHP] Query question Agreed, this should go to a MySQL list. But in the spirit of helping I think the following should give you a good starting point. SELECT `year`, COUNT(`year`) AS `count` FROM `tbl` GROUP BY `year` ASC On 10/28/06, Ed Lazor [EMAIL PROTECTED] wrote: Use the mysql list :) On Oct 28, 2006, at 3:01 PM, Beauford wrote: Hi, I have a MySQL database with a date field and a bunch of other fields. The date field is in the format - 01/01/2006. What I want to do is query the database and create a table that shows just the year and how many instances of the year there is. I have been taxing my brain for a simple solution, but just not getting it. Any suggestions? Thanks Example output. Year Count 2002 5 2003 8 2004 9 2005 15 2006 22 ps - I get this information sent to me and I can't change any of the data. I just enter it in the db and then hopefully do the query on it. -- 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: Re: [PHP] OPTION
...and if you wanted to go an extra step you could try an alternate syntax of the exact same code: ?php foreach (range(1, 31) as $day) print 'option value=' . $day . '' . ($selected_day_of_month == $day ? ' selected' : '') . '' . $day . '/option'; ? Either way, Stut is correct. Don't type this out 31 times unless you really really really like to type. ;-) - Joe On 10/25/06, Stut [EMAIL PROTECTED] wrote: Ron Piggott (PHP) wrote: I am creating a form right now. I am using the html SELECT tag. SELECT NAME=day_of_month The most number of days in a month is 31 I want the output to be OPTION SELECTED## based on the value of $selected_day_of_month variable. For the days of the month where the number is not selected the output I am desiring is OPTION1 OPTION2 etc. to be generated through PHP code I already have a value the user submitted in a variable named $selected_day_of_month from being stored in a mySQL table Does anyone know how to do this in a few commands? I am wanting to simplify ? if ( $selected_day_of_month == 1 ) } OPTION SELECTED1 } ELSE { OPTION1 } if ( $selected_day_of_month == 2 ) } OPTION SELECTED2 } ELSE { OPTION2 } ? etc. Dang that's painful!! Try this... ?php foreach (range(1, 31) as $day) { print 'option value='.$day.''; if ($selected_day_of_month == $day) print ' selected'; print ''.$day.'/option'; } ? I added a value to the options (you knew that was missing right?). Obviously you need to output the select ... and /select outside this loop. -Stut -- 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] RE:[PHP] Client Computer Registration
Hey Rahul... I have seen this also... It's sort of neat and annoying all at the same time... I am just wondering if it's just a false sense of security to get more people to use there online banking... although I did read through their FAQs about this and they are saying they have been required by the FFIEC (Federal Financial Institutions Examination Council) to increase security... although computer registration remains optional... i would guess this is probably just a cookie... i am not sure about this, but will firefow run activex stuff??? if it won't I think you could eliminate the activex possiblity i do know that this site uses JSP as it's scripting language. Have a great day, hope i was able to help in atleast a little way Joe On 10/3/06, Wesley Acheson [EMAIL PROTECTED] wrote: They could also be doing something like giving the client an SSH key to download, I've heard of this situation in a bank before. Though it does seem more likely that their just using cookie based authentication - From: Rahul S. Johari [EMAIL PROTECTED] To: PHP php-general@lists.php.net Date: Mon, 02 Oct 2006 08:07:35 -0400 Subject: [PHP] Client Computer Registration Ave, I saw this at the Key.Com website for Keybank Customers. When you go to their website to login to view your account, they ask you to register your computer for the first time. Once your computer is registered, you can access the account using that computer. You can choose to Not register that computer and you won¹t be able to access the account using that computer in future. What exactly are they doing? Can PHP record the MAC Address of the NIC in the computer? Or are they just recording the IP and creating an IP based filteration? I¹m looking to implement a similar security system for one of my applications. Any advice? Rahul S. Johari Supervisor, Internet Administration Informed Marketing Services Inc. 500 Federal Street, Suite 201 Troy NY 12180 Tel: (518) 687-6700 x154 Fax: (518) 687-6799 Email: [EMAIL PROTECTED] http://www.informed-sources.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Joe Harman - Subscribe to my FRIENDS email list by sending an email to [EMAIL PROTECTED] with subject line of Subscribe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQLDump and master/slave Behavior
1. mysqldump will only keep the connection open for as long as it needs it. Once your calling script is allowed to continue mysqldump has either exited successfully or with an error, but either way the connection should no longer be active. 2. I don't think that would be a good idea. 30 minutes should buy you enough time, but if the system is getting slammed or some other unforeseeable event happens that makes the system slow down to a crawl then you run the risk of breaking your backup process. The bulk of the execution time in your script is almost certainly with your tar command. The 'j' option is telling it to use the bzip2 algorithm for compression, which is a very high compression level, but takes a long time to obtain compared to other compression algorithms. In short, I don't think anything that you're doing is going to cause any data loss as long as mysqldump isn't locking the slave database for a huge amount of time. As an aside, this isn't really PHP related so much as it is MySQL or even *nix shell commands related, you might try a MySQL list for verification. On Oct 3, 2006, at 10:29 AM, David Giragosian wrote: Howdy Guys, I have a PHP backup script running as a cronjob that has an exec (mysqldump) line followed a bit later by an exec(tar -cjf) line. The backup script runs against a slave db in the wee hours, and the master gets a continuous stream of inputs at the rate of about 18,720 per day. Obviously as the database grows in size, the script takes longer and longer to run. Right now, after about 15 months of operation, it's taking about 40 minutes to complete. But I did a test yesterday, and the mysqldump part only takes about 2 minutes to finish. Even though I've never lost data, my concern is that since master- slave syncing is blocked while the script runs, I just might lose something if there's a buffer overrun or something like that. So, Question 1 is: does mysqldump's connection to the slave db exist for the entire script execution time, or just for the length of time of its own execution? I imagine if I used mysql_connect() in the script that it would be for the entire length of the script execution, but mysqldump makes its own connection, so I'm just not sure about this. Question 2: Should I, just to be on the safe side, break out the mysqldump code into its own scipt, and run it, say, 30 minutes before the tar script? Thanks for your time, David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 object construct
http://us2.php.net/class On 9/22/06, Chris Boget [EMAIL PROTECTED] wrote: I read about a feature of PHP5 OOP that is something like this in a book or a magazine a while back. But now I don't remember exactly how this works and I can't find any reference to it in the online docs. The basic idea is something along these lines: class MyClass { private $bob; public $Bob { set( $var ) { $this-bob = $var; } get() { return $this-bob; } } } Could someone point me to the relevant section of the docs that discusses this? thnx, Chris -- 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: Re: [PHP] PHP5 object construct
well, perhaps I'm not seeing what it is that you're looking for. The page I sent you is a basic introduction to classes and OOP in PHP, which based on the example that you've provided seemed like what you wanted. It seems obvious that you want to learn more about OOP, but are you trying to find a specific 'bob' example or would you just like some help understanding OOP? What is the end result you're hoping to get out of the list?.Google also provided these results, which might help you if a specific example is what you're looking for: http://pear.php.net/reference/PhpDocumentor-1.2.0beta2/phpDocumentor/tutorial_phpDocumentor.howto.pkg.html http://us3.php.net/get_object_vars http://us3.php.net/spl Feel free to help us help you ;-) On 9/22/06, Chris Boget [EMAIL PROTECTED] wrote: I read about a feature of PHP5 OOP that is something like this in a book or a magazine a while back. But now I don't remember exactly how this works and I can't find any reference to it in the online docs. The basic idea is something along these lines: class MyClass { private $bob; public $Bob { set( $var ) { $this-bob = $var; } get() { return $this-bob; } } } Could someone point me to the relevant section of the docs that discusses this? http://us2.php.net/class Any particular place on that page I should be looking? I've read it several times and didn't see anything like the above. The closest thing I saw were actual methods called setBob() and getBob(), which isn't exactly what I'm looking for... thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: Re: [PHP] PHP5 object construct
ok, so if we were talking Java, perhaps you are looking for information that allows you to build 'accessor' and 'mutator' methods? If so, then your example should work (syntax aside). Here's another 'test' example that I just whipped up and tested that shows you can use any method name you wish. ?php class test { private $thing; function setThing($val) { $this-thing = $val; } function getThing() { return $this-thing; } } $t = new test; // Show that thing is empty print $t-getThing() . \n; // Set thing to 'Thing' $t-setThing('Thing'); // show that thing contains 'Thing' print $t-getThing() . \n; ? If I'm still on the wrong path I apologize. I probably shouldn't be trying to provide advice on cold medicine ;-) On 9/22/06, Chris Boget [EMAIL PROTECTED] wrote: well, perhaps I'm not seeing what it is that you're looking for. No, I'm not sure you are. Take a look at my sample code again. Pay particular attention to how both $bob and $Bob are defined. class MyClass { private $bob; public $Bob { set( $var ) { $this-bob = $var; } get() { return $this-bob; } } } thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error: Cannot load /usr/local/apache2/modules/libphp4.so into server: /usr/local/apache2/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied
Since Fedora is popular, can I assume that's what you're running? Even if it's not I'll bet it's a Linux distro that's employing SELinux. 11,500 web pages agree ;-) http://www.google.com/search?q=%22reloc:+Permission+denied%22 On 9/20/06, Kelly McCoy [EMAIL PROTECTED] wrote: I am getting the error Cannot load /usr/local/apache2/modules/libphp4.so into server: /usr/local/apache2/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied When I try to load Apache. Running PHP 4.4.4, Apache 2.0.59, and mysql 4.1.21 All installations have gone smoothly; I just have not been able to start apache because of the error. Thanks for any help. Kelly -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Just say hello
Hi AraDaen, and welcome to the list ;-) On Sep 15, 2006, at 7:32 AM, AraDaen wrote: Hi from Spain. This is my first post and im sure it wont be last :) AraDaen -- 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 to skip browser's Warning?
Easiest way: change your search form's method to GET instead of POST - I'm sure you're not passing enough parameters to the search results page to actually need to use POST. On Sep 13, 2006, at 11:44 AM, [EMAIL PROTECTED] wrote: Hi, Could somebody explain to me what to do to skip this message I'm getting after I search for some products on my page, got the list of products, selected a detailed view of the product and click on the Back button of the browser to see again list of found products (result page): The Page you are trying to view contains POSTDATA that has expired from cache. If you resend the data, any action the form carried out such as a search or online purchase) will be repeated. To resend the data, click OK. Otherwise, click Cancel. Thanks for any help. -afan -- 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] Accessing .mdb Ms Access file from Linux without ODBC
I think kOffice can read mdb files on Linux - maybe that would be a good starting point for research. Perhaps they have built a kind of API to allow other programs to do the same..then again, maybe not - but like I said, it's some place to start. On Sep 7, 2006, at 7:57 AM, Fourat Zouari wrote: it's a PHP question : how can we access Ms Access mdb files without ODBC ? On 9/7/06, Angelo Zanetti [EMAIL PROTECTED] wrote: Fourat Zouari wrote: Hello all, I need to create a script that can open a connection to a given .mdb file (Microsoft Access) and do some light selects on it, anyway ... The problem that i wont create an ODBC instance, i wont and cant install ODBC support on the server for the unique purpose of doing that on the mdb file. I'm seeking how to do such thing on a Linux env (no COM) and without ODBC, googling, i found that AdoDB doesnt do it (?) and PDO didnt got a support for that (?) Any helpers around ? thanks what does this have to do with PHP? -- - --- Angelo Zanetti Systems developer - --- *Telephone:* +27 (021) 469 1052 *Mobile:* +27 (0) 72 441 3355 *Fax:*+27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse text file
Benjamin, Use the file() function, it will read a file then return each line as a new element in an array. http://php.net/file - Joe On 7/23/06, Benjamin Adams [EMAIL PROTECTED] wrote: how would I read a file one line at a time: ?php if($lines $alllines){ $newline .= $lines; } ? something like that, I'm cofused on if I use fread, something which will do one line at a time? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
To refine that a bit, you may want to give them some code that has been intentionally broken (simple things for the entry level position, such as missing semicolons or curly braces etc) and watch to see how they go about discovering the parse errors. To me, it would be better to hire someone that can solve problems quickly, not someone who can simply tell you what a piece of code is doing. Just a thought though - good luck! -Joe On Jul 20, 2006, at 7:20 AM, Finner, Doug wrote: My advice, give the candidates problems and see how they solve them. Even if they don't finish, you get an idea of how they think. tedd I like this idea! Do you expect them to be able to work with code written by others? If so, hand them some of your existing code (good examples and not so good) and ask them to figure out what it does and recommend changes. I really really like the 'give them a problem and have them solve it' idea... Doug __ _ This e-mail message has been sent by Kollsman, Inc. and is for the use of the intended recipients only. The message may contain privileged or confidential information. If you are not the intended recipient you are hereby notified that any use, distribution or copying of this communication is strictly prohibited, and you are requested to delete the e-mail and any attachments and notify the sender immediately. -- 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] PHP LDAP - Single Sign On
well, I'm sure that if you really wanted to try to write your own auth module in PHP you could theoretically do so - but in lieu of that there is an open source apache module that you might want to look into called mod_ntlm http://modntlm.sourceforge.net/ keep in mind that all this does is ask the browser for the current users creds after a handshake. IE is the only one that I know of that will gleefully hand out that info without asking the user - all the other browsers that I've tested ask you if that's ok with you first (as it should be) On Jun 28, 2006, at 8:07 AM, Jay Blanchard wrote: [snip] thanks for the response, i can see how this works (i think) for basic authentication with user input,but what i really need is to actually retrieve the logged on user name after a user has logged into windows. i.e. the user name that the http client passes to the apache mod has been captured not from user input, but from say a piece of code that picks up the user name when the user logs in. Probably less to do with php now that i come to think of it, but thanks anyway. [/snip] Ah...I see now. Several have asked this question, let me rephrase and see if this makes better sense How can one capture the login user name from a Windows logon? ASP can do it, but can it be done with PHP as one would do with PHP_AUTH_USER? IIRC I don't think that it is possible with 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] New install platform
For a simple OS X install you can either modify the existing Apache/PHP install and add MySQL or use entropy's package from http://www.entropy.ch/software/macosx/php/ On 6/25/06, Grae Wolfe - PHP [EMAIL PROTECTED] wrote: It has become evident that I need some form of local testing environment so that I can figure out what is wrong with one of my $sql statements. Can anyone tell me what the easiest platform is to set up a PHP/MySQL system? I have a PC and a Mac on OS X, and with the use of VirtualPC I have the ability to load most flavors of Linux as well. I hate to have to go through this to test a single error, but if anyone can help with this, I would truly appreciate it. -- 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] templating
IMHO I would go with Smarty as it has excellent documentation and would fit almost anything that the project would require. I also think it would be a cleaner way of templating than using str_replace () over and over again. For what it's worth, I use Smarty on almost all of my projects, large and small. I find that once you learn it you can use it to develop new sites rather quickly. ...and it's not like using a nuke to kill a fly - Smarty only loads the files it needs as it needs them instead of loading everything - so it's quite fast really. - Joe On Jun 22, 2006, at 7:10 AM, Ryan A wrote: Hi, A pal of mine needed some help on his project, he is using a header and footer file to template his project... but its gotten a bit complicated as he has a few dynamic parts in the header and footer files, so I told him to go with a proper templating method of templating the whole page rather than includ()ing the top and bottom. After having a better look at his scripts, I am just not sure if something big (like SMARTY for instance) would be good for him. He just needs maybe 5 template pages, same pages, different color. Searching google I see literally hundreds of templating solutions can anyone recommend a simple one or should I tell him to just use str_replace() for tags like: {{menu_here}} {{header_here} etc? Something like SMARTY would be like using a nuke to kill a fly (IMHO) esp since this project will not expand to anything much bigger or complicated. Thanks! Ryan -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Processing HTML in mail form
(sorry for the duplicate response Parathaban, forgot to reply to the list) Look at example 4 from http://us3.php.net/function.mail $headers = 'MIME-Version: 1.0' . \r\n; $headers .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; That should get you started. On Jun 20, 2006, at 9:41 PM, Prathaban Mookiah wrote: Jonas: I am not sure if I understood your problem correct. But the way I understood it, you want the mail to be displayed as: F-namn: J L-namn: R Birth: 12 Address: 34 Zip: 56 City: 78 Phone: 90 Mail: [EMAIL PROTECTED] Desc: N Hair: hair Make: makeup Am I correct? If that is the case, I guess you should use '\n' instead of 'BR'. Cheers, Prathap -- Original Message --- From: Jonas Rosling [EMAIL PROTECTED] To: PHP Lists php-general@lists.php.net Sent: Tue, 20 Jun 2006 23:56:47 +0200 Subject: [PHP] Processing HTML in mail form I've done the following code bellow for an e-mail form. But it handles the HTML tags as text. Is there anyway to get the HTML tags processed to form the mail? ?php @extract($_POST); $subject = 'Intresseanmalan'; $forname = stripslashes($forname); $lastname = stripslashes($lastname); $date_of_birth = stripslashes($date_of_birth); $post_address = stripslashes($post_address); $zip_code = stripslashes($zip_code); $city = stripslashes($city); $phone = stripslashes($phone); $mail = stripslashes($mail); $description = stripslashes($description); $hairdresser = stripslashes($hairdresser); $makeup = stripslashes($makeup); $text = 'F-name: '.$forname.'br'. 'L-name: '.$lastname.'br'. 'Birth: '.$date_of_birth.'br'. 'Address: '.$post_address.'br'. 'Zip: '.$zip_code.'br'. 'City: '.$city.'br'. 'Phone: '.$phone.'br'. 'Mail: '.$mail.'br'. 'Desc: '.$description.'br'. 'Hair: '.$hairdresser.'br'. 'Make: '.$makeup; mail('[EMAIL PROTECTED]',$subject,$text,From: $forname $lastname $mail); ? The mail looks like this when recived: F-namn: JbrL-namn: RbrBirth: 12brAddress: 34brZip: 56brCity: 78brPhone: 90brMail: [EMAIL PROTECTED]brDesc: NbrHair: hairbrMake: makeup Thanks in advance // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MYSQL_CONNECT vs MYSQL_PCONNECT
If you're not sure you should probably stick with mysql_connect() - otherwise you could end up bogging down mysql with way more connections than you need if you're not careful. On Jun 20, 2006, at 12:34 PM, Juanjo Pascual wrote: How can i know which of both is better to use each time? -- 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] ldap_connect allways returns true even if logically it shouldn't?
I believe the manual says that ldap_connect doesn't actually make the connection but rather it just simply sets up the connection parameters. The actual connection doesn't happen until ldap_bind is executed. - or so I recall reading some where ;-) On Jun 19, 2006, at 9:06 AM, Steve Turnbull wrote: Hi I have this code (PHP5) as part of a class to do some LDAP stuff... public function connect() { $this-ds = @ldap_connect( $this-server, $this-port ); ### This seems to return true no matter waht if ( $this-ds ) { // A successful connection was made $this-message .= 'A successful connection was made to the LDAP server: b' . $this-server . /bbr /br / \n; } else { // The connection was not successful $this-message .= 'It was not possible to connect to the LDAP server: b' . $this-server . /bbr / \n; $this-message .= 'LDAP Error Message: ' . ldap_error( $this-ds ) . br / \n; $this-message .= 'LDAP Error Number: ' . ldap_errno( $this-ds ) . br / \n; } } As you can see, I am expecting a return value of true only if the ldap_connect makes a successful connection. However, even if I pass values which should make a false, it gives a true. What am I missing out on here - could any one tell me why true is always returned? Cheers Steve -- Steve Turnbull Digital Content Developer YHGfL Foundation e [EMAIL PROTECTED] t 01724 275030 The YHGfL Foundation Disclaimer can be found at: http://www.yhgfl.net/foundation-services/yhgfl-email-disclaimer/ -- 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] HTTP HEADERS
(sorry for the dup kartikay, forgot to hit reply to all;-) So is the file going from server to server or from a client machine to the server? It sounds like server to server - which if that's the case you can use headers_list() to see what your server is going to be sending out to the other server ( http://www.php.net/manual/en/function.headers-list.php) - otherwise you can use the get_headers() function (http://www.php.net/manual/en/function.get-headers.php) see what headers the client sent you along with the file. -Joe On 6/3/06, kartikay malhotra [EMAIL PROTECTED] wrote: Hi all! I use HTTP POST to upload a file. I've a PHP script running on the server. Are HTTP headers passed with this request? How can I see the headers passed to the server? Thanks KM
Re: [PHP] .htaccess - change index.php to index.abc
If you don't want to change the names of the files themselve from .php to .abc then you'd need to use something like mod_rewrite for apache's HTTPD. I'm not entirely certain as to how you'd do this, but I've included what I normally use to hide index.php in the url. If possible I'd put this in httpd.conf instead of .htaccess - there are performance concerns that may be involved there. Anyway, I hope this gets you started or sparks an idea from another list member. Directory /var/www/html/ RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] /Directory On 6/3/06, Labunski [EMAIL PROTECTED] wrote: Hello, What should I change in .htaccess, so that visitors will see index.abc instead of index.php. I just wanna hide file's extension. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Paged Results Set in MySQL DB with one result
On Friday 12 May 2006 12:01 pm, tedd wrote: It shouldn't be blank. There should be a Next/Previous button -- isn't there? If so, then click Next If not, please tell me. Works: Suse Linux 10.x/Firefox 1.0.7 Windows XP/Firefox 1.5.0.3 Mac OS 10.4.6/Safari 2.0.3 Works sort of: Suse Linux 10.x/Konquerer 3.4.2 = (first page loads but next/previous buttons produce no results) Windows XP/Internet Explorer 6.0.x = (first page loads but next/previous buttons produce no results) Blank: none that I tested Don't have Firefox on the Mac box. I just clicked the next/previous buttons a few times, so take it for what's it's worth. Thanks to you Tedd. Made me realize I should upgrade my Linux Firefox. HTHs. -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] remove html tags in text?
On Thursday 11 May 2006 9:51 am, Bing Du wrote: Any functions that can help remove all the HTML tags in it? What about just removing selected tags, like b/b? Looks like strip_tags() will do the trick for you: http://us3.php.net/manual/en/function.strip-tags.php -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] BDC to ASCII Conversion
On Thursday 11 May 2006 10:08 am, Jim Moseby wrote: In dog we trust Am partial to Dog is my co-pilot -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about using temporary named pipe in the string for system
On Wednesday 10 May 2006 4:02 pm, Ginger Cheng wrote: Hello, PHP gurus, I have a command that I want to run using system function. The command exploits temporary named pipes in the place of temporary files. my command is paste (cut -f1 file1) (cut -f2 file2) final_file It works perfectly well if I just type it in my interactive shell. But if I do a ?php $cmd = paste (cut -f1 file1) (cut -f2 file2) final_file; system($cmd); ? I got the syntax error msg as sh: -c: line 1: syntax error near unexpected token `('. I have tried to 'escapeshellcmd' the command and run it in system, then I got paste: invalid option -- f Try `paste --help' for more information. Also tried exec. I really want to take advantage of the temporary named pipes so I don't have to worry about the temporary files generated. I've been googling around without much help. Could anyone plz give me some hint? Thanks a lot ginger Think you might want the shell_exec() command instead. http://us2.php.net/manual/en/function.shell-exec.php HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] WINNER
On Monday 08 May 2006 12:52 pm, Ryan A wrote: Ok, the last time this happened I think it was either Jay B or John Holmes (the dude!) who claimed the prize...this time, hands off, its mine... 615,960.00. I'm rich bearch! Think we should split it equally among all PHP-general subscribers. That would be, like, a latte or beer each. Yippee! -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] List of sessions
If you store your sessions in a database then your could gain a little mode control over your session, but I think what you're asking is if there's a way to tell if a user has closed the browser thus killing the session on their side. If that's what you're asking then the answer is not going to lie strictly with PHP as the server has no way to ping a user's browser. A quick hack off the top of my head might be to find a creative way of using the onBeforePageUnload() (or w/e it is) javascript function along with frames. Anyway, you can check out php.net for more details on how to use a database for session storage: http://www.php.net/manual/en/function.session-set-save-handler.php Cheers, - Joe On 5/4/06, Tony Aldrich [EMAIL PROTECTED] wrote: Well, I mean visitors of site. They can open it in several windows or in several browsers. I understand that each browser on a machine will be a session (in simple explanation). And for all of them I create some info in database. Then they close browser. I must clean up unused info. That's why I want to query alive sessions. Or query their death time (timeout). I thought of something like $sess=get_session_list(); or $isalive=is_session_alive($session_id); Thanks. On 5/4/06, Gerry D [EMAIL PROTECTED] wrote: Can you have more than 1 session? On 5/2/06, Tony Aldrich [EMAIL PROTECTED] wrote: Good day, Does anybody know how to get a list of current sessions? I need to clear some database rows that where associated with some SID. Can it be done without probing of maxlifetime?
Re: [PHP] Sanity checker?
On Tuesday 02 May 2006 6:14 pm, Ezra Nugroho wrote: Does anyone know of any tools to test the sanity of your php code? This sounds an awful lot like the Halting Problem to me, which isn't solvable. http://en.wikipedia.org/wiki/Halting_Problem -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL query to array?
Will, Seems to me like you've just done it! Here's another way of doing it that will utilize mysql_fetch_assoc() to allow your query to dictate the elements of the array. Keep in mind, I haven't tested this, but since I'm not entirely sure what you are asking the list, I'll offer it anyway ;-) ?php /*...do connection stuff here...*/ $sql = SELECT sortteri,jouk_id,jouk_nimi FROM x_table ORDER BY sortteri ASC; $result = mysql_query($sql); $num = mysql_num_rows($result); $Team = null; //We'll fill this up later - gotta love PHP ;-) // loop over each row in the result set for($i=0; $i$num; $i++){ $tmp = mysql_fetch_assoc($result); // loop over each column in the current row while(list($key, $val) = each($tmp)) $Team[$key][$i] = $val; } // display the contents of the $Team array print_r($Team); ? On 4/26/06, William Stokes [EMAIL PROTECTED] wrote: Hello, Can someone please help me to put the results of a query to an array. Never done this before: $sql = SELECT sortteri,jouk_id,jouk_nimi FROM x_table ORDER BY sortteri ASC; $result = mysql_query($sql); $num = mysql_num_rows($result); $cur = 1; //create empty array that contains an array before loop $arr = array(Team = array()); while ($num = $cur) { $row = mysql_fetch_array($result); $id = $row[jouk_id]; $srt = $row[sortteri]; $nimi = $row[jouk_nimi]; //append values to the array $arr = array(Team$cur = array(0 = $id, 1 = $srt, 2 = $nimi)); $cur++; } Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php function to Set focus On A form Field
PHP can't do that for you but Javascript can. Here's roughly 3 million (no joke) examples of what you'd like to accomplish: http://www.google.com/search?q=javascript+focus+first+input On 4/26/06, marvin hunkin [EMAIL PROTECTED] wrote: Hi. is there any php or java script function, where i can embed into my php or html file, to set focus on to the first form field, like a text box, to go to that field first, and not to go to the link or button first. if there are any tips, tricks, or links or code examples, how to fix this problem. let me know. cheers Marvin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using linkDisplayFields of FormBuilder
On Tuesday 25 April 2006 4:36 pm, Tom wrote: instead we recommend emailing [EMAIL PROTECTED] where you are more likely to get answer. You found the PHP-general list instead of the Pear-general list. Here's a link to the Pear mailing list page: http://pear.php.net/support/lists.php HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CMS for Auto Parts
I could be off here, but I think he's talking about using XML to transfer data back and forth between the flash app and the PHP app. That's just me reading between the lines though. Maybe I'm taking too much from PHP/XML should be used with a client-side Web GUI to upload images, part no., descriptions and inv[...] Even so, I can't really offer anything that specifically does what's needed. I'd think the easiest way to go about it (aside from building it yourself) would be to pick an existing AJAX + PHP framework and modify it to work with FLASH as the front end instead of JavaScript. - Just a thought. /shrug On 4/23/06, John Hicks [EMAIL PROTECTED] wrote: CK wrote: Hi, On Apr 22, 2006, at 1:26 PM, John Hicks wrote: CK wrote: Hi, I've been commissioned to design a web application for auto parts sales. The Flash Front end will communicate with a MySQL DB via PHP. In addition, PHP/XML should be used with a client-side Web GUI to upload images, part no., descriptions and inventory into the DB; a Product Management System. I am curious as to how you plan to using XML for the client's back end? (I don't see any reason to use it.) Using XML to keep an inventory dynamically, was the thought. The XML file would be updated with each entry, then could be imported into a spreadsheet. If you are storing your inventory in an XML document, then what are you using the MySQL database for? After Googling the returned queries have been slim, any leads on more specific examples? What specifically are you looking for and how are you googling for it? --John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preg_match() regex
On Friday 21 April 2006 9:44 am, Jeff wrote: Regex pattern question here. I need to match on Foo-F00, Foo-foo, foo-Foo. I know in perl you can use the /i to specify case insensitive matching. Is there any such switch that can be used in preg_match() in PHP? http://us3.php.net/manual/en/reference.pcre.pattern.syntax.php -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange php url
I believe Kevin is on the right track there. To expand a bit, you can use $_SERVER['PATH_INFO'] with these urls instead of $_GET to make use of the data it contains example for url http://www.example.com/index.php/foo/bar ?php echo $_SERVER['PATH_INFO']; ? produces: /foo/bar You can then parse this string, (generally by using the '/' character as a deliminator) and extract the data. MediaWiki even provides information (can't think of where at the moment) on how to use Apache's mod_rewrite to hide index.php thus making the url even cleaner: http://www.example.com/foo/bar Cheers! - Joe On 4/21/06, Kevin Kinsey [EMAIL PROTECTED] wrote: Hi, could anyone tell me why the following url doesn't generate a page not found ? http://www.php.net/manual/en/function.checkdnsrr.php/manual/ you can try with a longer url after the last .php. I tried with ../manual instead of manual and this produces a 404. I checked with www.php.net because my own site does the same and I wanted to be sure it didn't come from my config. thanks Nicolas Figaro [EMAIL PROTECTED] wrote: The other thing that could happen is they could be using something like the Apache mod_rewrite (some info at http://www.modrewrite.com/ among others) which can dynamically change the requested URL to a more standard URL before sending back to the user. Something like this: http://www.testserver.com/tgryffyn/homepage/middlesection Could be turned into something like: http://www.testserver.com/userpage.php?user=tgryffynpage=home#middleanchor But to the user requesting the page, it'll always look like the first URL. Forgive me if I got any syntax or capability of mod_rewrite wrong, never used it myself just know that's the general sort of thing that it does. Pretty good thoughts, there. Some years ago, Tim Perdue (of PHPBuilder and SourceForge fame) had a popular article on Search Engine Friendly URL's (or some such), in which he described use of the Apache ForceLocal directive to make a site just One Big Script, parsing the slashed portions of the query string as variables (instead of GET, a la ?section=manterm=foo) so that the browser appears to be accessing documents in subfolders, but it's really just telling the server to grab a page with certain values defined in the URI. It sure looks like a possibility of this or similar magic in this case. Of course, I could be way off my tree... Kevin Kinsey -- Byte your tongue. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange php url
No arguments here ;-). For what it's worth, I've used this technique just to simply clean up the url's a bit. With that in mind, I usually don't need to do a terrible amount of scrubbing because I'm using the variables in the url more for navigation. So http://www.example.com/index.php/edit/customer/1234simply tells my script to display a form that will allow the user to edit customer 1234, if the first sections of $_SERVER['PATH_INFO'] isn't exactly what I'm expecting then I moce on to whatever the default action is (except of course for the customer id at the end). Really this isn't any different than http://www.example.com/index.php?action=edittype=customerid=1234 in terms of security. If I'm wrong someone please let me know as I do use this technique quite a bit. - Joe On 4/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: You could do that... a poor man's mod_rewrite might involve something like this and making the main PHP parsing script your 404 page.. so no matter where you went on a page, the 404 redirect to your PHP script would parse the request (or would you get the post-redirected URL? in which case you'd have to get the 'referrer' maybe? not sure..). Sounds like it could have some security issues though..giving too much power to the user and what they enter in the URL being used as variable data.. definitely would want to scrub that input hard. -TG = = = Original message = = = I believe Kevin is on the right track there. To expand a bit, you can use $_SERVER['PATH_INFO'] with these urls instead of $_GET to make use of the data it contains example for url http://www.example.com/index.php/foo/bar ?php echo $_SERVER['PATH_INFO']; ? produces: /foo/bar You can then parse this string, (generally by using the '/' character as a deliminator) and extract the data. MediaWiki even provides information (can't think of where at the moment) on how to use Apache's mod_rewrite to hide index.php thus making the url even cleaner: http://www.example.com/foo/bar Cheers! - Joe ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: no offense to Rasmus... are you kidding me
On Thursday 20 April 2006 1:18 am, Richard Lynch wrote: Is 5 longer than 4? Size doesn't matter. At least that's what I've been told. ;) -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pushing PHP Into The Web 2.0 Generation
On Tuesday 18 April 2006 10:50 am, Jay Blanchard wrote: [snip] .. [/snip] And his mailing list name is James Crane, he signs of as M.T. which stands for Matt Todd. I call shenanigans. My nominee for best analogy from the article: Much like the artists and writers of the early twentieth century when they realized that the weapons and machines were dehumanizing war, making it far too easy to kill, web designers and developers realized that there was a need for a social, human revolution within the sterile, synthetic arena of the web. Hence, the Web 2.0 Movement was born. Web development and war in the same sentence. Killer! -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Post forms
On Thursday 13 April 2006 8:44 pm, Stephen Johnson wrote: On 4/13/06 7:40 PM, Gary E. Terry [EMAIL PROTECTED] wrote: Quite possibly a stupid question, but here goes. I have a form that is a list of jobs. On that list is a checkbox. The form field is named 'changedate'. I also have a hidden field called 'JobID'. What I am trying to accomplish is if a checkbox is checked, when the form is submitted, I want all of the JobID's to be updated by an SQL query. But it seems to me that $_POST will only contain the last JobID in the form, no matter what. Am I correct on this? Is what I am trying to accomplish not possible with a form post? I think I remember doing something similar with Cold Fusion years ago, but I have never attempted this with PHP. Any suggestions? You need to pass the checkboxes as an array value with the JobID as the identifier. Then on the other side, you can run through the list of JobID's and see which ones need to be updated. If I'm understanding what you're asking, you have an array of checkboxes whose values you want passed to you PHP via the $_POST array. The HTML form syntax would be something like: input type=checkbox name=array[] value=... / input type=checkbox name=array[] value=... / input type=checkbox name=array[] value=... / etc. Then in your PHP script, $_POST['array'] will hold an array of the checkbox values. HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] interview
On Thursday 13 April 2006 11:13 am, Robert Cummings wrote: On Thu, 2006-04-13 at 12:56, Wolf wrote: How much wood would a wood chuck chuck if a wood chuck could chuck wood?? Canadian, American, or Other woodchuck? monty python Leave or we shall taunt you a second time! /monty python -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I am not able to download domxml for PHP5
Oz, From your command line, try: pecl install domxml You'll need to be root to do so, but as long as you have PECL/PEAR installed this should give you domxml. Remember to restart your web server after doing so. - Joe On 4/11/06, Oz [EMAIL PROTECTED] wrote: Please help, I am not able to download domxml for PHP5 I have tried this location, http://us3.php.net/manual/en/ref.domxml.php I get a message file not found. is there a mirror site. Thanks Please also mail response to [EMAIL PROTECTED] -- 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] I am not able to download domxml for PHP5
Of course you said you're running PHP5so that won't work. According to the site it would be best for you to use the DOM that comes pre compiled with PHP. http://us3.php.net/manual/en/ref.dom.php Sorry about the mix up on my part. On 4/11/06, Joe Wollard [EMAIL PROTECTED] wrote: Oz, From your command line, try: pecl install domxml You'll need to be root to do so, but as long as you have PECL/PEAR installed this should give you domxml. Remember to restart your web server after doing so. - Joe On 4/11/06, Oz [EMAIL PROTECTED] wrote: Please help, I am not able to download domxml for PHP5 I have tried this location, http://us3.php.net/manual/en/ref.domxml.php I get a message file not found. is there a mirror site. Thanks Please also mail response to [EMAIL PROTECTED] -- 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] Argument passed by reference?
On Friday 07 April 2006 5:06 pm, tedd wrote: At 1:52 PM -0500 4/6/06, Chris Boget wrote: The way I understand it, pass by reference in php is determined in the function definition and not the function call. Something like: You used to be able to pass by reference at run time. But I see that is no longer allowed... :| So I guess that makes my question moot. Thanks for your help. thnx, Chris Chris: Please forgive my ignorance, but when did that happen? tedd -- --- - http://sperling.com I'm not sure when this happened. I'm fairly new to php, myself. Maybe someone else could answer that? -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mod_rewrite q's: syntax?
Mickey, I'm not an expert on the topic by any stretch of the imagination, but I seem to recall reading that it's best to move everything into httpd.conf for performance reasons. You may want to investigate that, but otherwise I don't see anything wrong with what you're doing. On 4/10/06, Micky Hulse [EMAIL PROTECTED] wrote: Well, I added this to the end of my .htaccess: # Set the index page: RedirectMatch ^/$ http://mydomain.com/folder/folder/index.php Seems to work well, but I am still concerned about pitfalls/optimization/consolidation... er, perfection? ;) TIA, Cheers, Micky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need MySql Help Please
Marvin, As much as we try to keep this list PHP-only I think it's hard to ignore the ties between PHP and MySQL. Most of us learned both technologies simultaneously. Still, you may want to put [OT] on your future email subjects to indicate that the question is 'off topic'. On the matter of MySQL's command line: From what I can see on http://dev.mysql.com/downloads/mysql/5.0.html it looks like when you download the Windows binaries you don't get the option of just downloading the client or just downloading the server - you are downloading both (someone correct me if I'm wrong) in the 'essentials' package. I'd imagine that when you run the installer it gives you an option to install the server / client packages. As long as you told the installer to give you the server and client both then you should be in good shape. All you should need to do is make sure that A) the MySQL binary (probably C:\Program Files\MySQL\MySQL Server 5.0\bin\mysql) is in your PATH environment variable and that B) the server is running (which from the sounds of things, it is). If it's in your path you should be able to start the client shell by simply typing mysql -u marvin -p or similar. You also might check out MySQL's documentation on running MySQL from the command line in Windows http://dev.mysql.com/doc/refman/5.0/en/windows-start-command-line.html Good luck! - Joe On 4/11/06, marvin hunkin [EMAIL PROTECTED] wrote: Hi. any mysql gurus out there using a tool called EasyPHP 1-8? i am using a my sql tutorial, and says needs the command line interface, so can run my sql commands from the dos prompt. have got the PHP MYSQL ADMIM to load into the easy php 1-8, gui interface. and when i type http://localhost/mysql/ it loads the browser, but would like the command line interface for version 5.0 of the my sql databaser admin server. now if any good soul, who uses my sql, or my sql admin, or easy php, can show me how to set up the command line interface for Easy Php 1-8, then let me know. have tried looking on the net, and looking in the documentation, and folders, but cannot seem to set it up. okay if any one can help me out, let me know. cheers Marvin. ps: need this info, as doing the tutorial towards the database assignment for my course. -- 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] microtime questions
Tedd, The only way that I can even think of this as being possible is if you call microtime() instead of microtime(true). The former will return 'msec sec' separated by a space which can produce a negative number because you've essentially got two different types of measurements there. IMHO PHP should probably throw out an error when two strings are used in a mathematical way - in this case (without the TRUE arg) here is a possible equation that could be evaluated. 0.15290800 1144430717 - 0.86641600 1144430716 PHP evaluates this to -0.713508 (or 0.15290800 - 0.86641600) It's negative because we're not talking about msecs from the same second - it ignores the seconds and only pays attention to the microseconds. So if you're using microtime(true) how can this happen on your machine? Well, off the top of my head I think you should verify that your machine (or your hosting service) is running PHP5 || . IF not, and error reporting is turned off, then you'll get a negative number from time to time since the seconds are being ignored. http://php.net/microtime has an example of how to emulate microtime(true) on PHP 5 Hope that helps! -Joe On 4/7/06, Brad Bonkoski [EMAIL PROTECTED] wrote: How is the CPU not in question? Does this script run on air? It may not be YOUR CPU, but it is still a CPU bound by the sceduling algorithm of the Operating System, so the time differentials are too be expected. -B tedd wrote: At 12:24 PM -0400 4/7/06, Brad Bonkoski wrote: Interesting... as for your first question... Know that PHP/Apache does not have free reign to your CPU, so the times could be different based on the scheduling going on in the OS kernel. As for the second one... No idea why you would get a negative number, I just copied and ran from the command line and did not encounter 1 negative time for about 30 runs Do you get negative times if you run it from the command line as well? -B RE: http://www.xn--ovg.com/microtime.php Brad: Thanks for looking. My questions are with regard to what happens on the site, not via my command line. As such, my command line and my CPU are not involved. Can you answer the questions as they pertain to the site in question? Thanks. tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] microtime questions
I just realized that I could check your version, and it appears that we've found the problem. You're running PHP 4.3.10, so I'd suggest using the non PHP5 work around on php.net's site. Cheers! - Joe On 4/7/06, Joe Wollard [EMAIL PROTECTED] wrote: Tedd, The only way that I can even think of this as being possible is if you call microtime() instead of microtime(true). The former will return 'msec sec' separated by a space which can produce a negative number because you've essentially got two different types of measurements there. IMHO PHP should probably throw out an error when two strings are used in a mathematical way - in this case (without the TRUE arg) here is a possible equation that could be evaluated. 0.15290800 1144430717 - 0.86641600 1144430716 PHP evaluates this to -0.713508 (or 0.15290800 - 0.86641600) It's negative because we're not talking about msecs from the same second - it ignores the seconds and only pays attention to the microseconds. So if you're using microtime(true) how can this happen on your machine? Well, off the top of my head I think you should verify that your machine (or your hosting service) is running PHP5 || . IF not, and error reporting is turned off, then you'll get a negative number from time to time since the seconds are being ignored. http://php.net/microtime has an example of how to emulate microtime(true) on PHP 5 Hope that helps! -Joe On 4/7/06, Brad Bonkoski [EMAIL PROTECTED] wrote: How is the CPU not in question? Does this script run on air? It may not be YOUR CPU, but it is still a CPU bound by the sceduling algorithm of the Operating System, so the time differentials are too be expected. -B tedd wrote: At 12:24 PM -0400 4/7/06, Brad Bonkoski wrote: Interesting... as for your first question... Know that PHP/Apache does not have free reign to your CPU, so the times could be different based on the scheduling going on in the OS kernel. As for the second one... No idea why you would get a negative number, I just copied and ran from the command line and did not encounter 1 negative time for about 30 runs Do you get negative times if you run it from the command line as well? -B RE: http://www.xn--ovg.com/microtime.php Brad: Thanks for looking. My questions are with regard to what happens on the site, not via my command line. As such, my command line and my CPU are not involved. Can you answer the questions as they pertain to the site in question? Thanks. tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to run 'periodic'
Frank, It sounds like you need to run this as a job through crond. I'm not sure what the OSX version is (maybe they have a port of crond?) but you could set that up to execute the specific code, as root, whenever you want. As far as I can think, and maybe Chris Shifflet can confirm/deny this, you shouldn't be running into any additional security issues by executing the script as root - As long as it's running through the CLI version of PHP. Just make sure it's only executable by root and then root should be the only one allowed to create that mammoth ;-) - Joe On 4/6/06, Frank Arensmeier [EMAIL PROTECTED] wrote: Hi. I have written a script which outputs a rather large ZIP file ( 200 MB ) by collecting a large amount of PDF files and html pages. When the script is done, the available amount of free memory has decreased by about 20 - 30%. Running 'periodic' on my machine ( Apple Xserve G5 with Mac OS 10.4 server) restores the available memory to a more proper size. The question is: how can I execute 'periodic daily|weekly|monthly' from my script? Is this possible at all? I know that 'periodic' needs root. And all PHP code is executed as www user which doesn't have root privileges. Would I compromise my servers security when granting root privileges to a script that executes 'periodic' (which could be called from the script that outputs the ZIP archive)? thanks /frank -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error on SQL Insert
On Friday 07 April 2006 1:37 pm, Tom Chubb wrote: $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, Not sure if this is your problem, but those look like backticks around year instead of single quotes. Should there even be quotes there? HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parse Error on SQL Insert
On Friday 07 April 2006 1:56 pm, Chrome wrote: Backticks (`) encapsulate table or database names I was thinking maybe if the array references were encapsulated in curly braces {}: $_POST['model'] to {$_POST['model']} Of course if the field in the DB isn't numeric this would be '{$_POST['model']}' Dan --- http://chrome.me.uk -Original Message- From: Joe Henry [mailto:[EMAIL PROTECTED] Sent: 07 April 2006 20:53 To: php-general@lists.php.net; [EMAIL PROTECTED] Subject: Re: [PHP] Parse Error on SQL Insert On Friday 07 April 2006 1:37 pm, Tom Chubb wrote: $insertSQL = INSERT INTO cars (model, `year`, details, price, image1, Not sure if this is your problem, but those look like backticks around year instead of single quotes. Should there even be quotes there? HTH -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1475 (20060406) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com Good to know. Thanks. -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] microtime questions
Tedd, I think Brad was just making some observations, he wasn't trying to be rude. When he said that the time differentials are too be expected. I think he was just answering the question of why the exact same FOR loop could possibly take different amounts of time to execute under the same conditions in the script; not necessarily why it was providing negative values. On your original issue, were you able to make use of the example function on http://php.net/microtime? The documentation there along with what I posted should hopefully clear things up for you as to why microtime() is reliable, and that it doesn't return a pure float that should be used in equations. It seems as though you knew that, but as I said before the way that you're using microtime() is not valid with the version of PHP your host is using. Please let us know if you'd like more clarification on this. There are a lot of people on this list, so someone will have the answer that you need. ;-) - Joe On 4/7/06, tedd [EMAIL PROTECTED] wrote: -B At 12:51 PM -0400 4/7/06, Brad Bonkoski wrote: How is the CPU not in question? Does this script run on air? I did not say that. I said that it was not MY CPU that was involved and it isn't. It may not be YOUR CPU, but it is still a CPU bound by the sceduling algorithm of the Operating System, so the time differentials are too be expected. Negative times are expected? Incorrect times are expected? What's the point of microtime if you can't reply on it? Please explain. tedd --- previous --- -B tedd wrote: At 12:24 PM -0400 4/7/06, Brad Bonkoski wrote: Interesting... as for your first question... Know that PHP/Apache does not have free reign to your CPU, so the times could be different based on the scheduling going on in the OS kernel. As for the second one... No idea why you would get a negative number, I just copied and ran from the command line and did not encounter 1 negative time for about 30 runs Do you get negative times if you run it from the command line as well? -B RE: http://www.xn--ovg.com/microtime.php Brad: Thanks for looking. My questions are with regard to what happens on the site, not via my command line. As such, my command line and my CPU are not involved. Can you answer the questions as they pertain to the site in question? Thanks. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IF or SWITCH
On 4/5/06, Ray Hauge [EMAIL PROTECTED] wrote: Hello World! wait, not coding... (sorry, long night) Okay, I finally finished hashing out all the logic for a very complex set of rules to determine what type an application should be set to. I won't bore you with the details of it, but the question is... I have 57 if/elseif/else statements because of all the different criteria. Is it considered better programming practice to use if/elseif/else statements over a switch(true) case (true false || true || false) syntax? Basically, I'm not too happy with the readability of the code, but I'm afraid that at this point there's not much I can do... code snippet: if($numFFELP 1 count($FFELP_Lenders) 1 $numFFELP == $numTotal){ $retVal = array(TRUE, 'A'); }elseif($numFFELP 0 $enumFFELP 0 count($FFELP_Lenders) 1 $enumFFELP + $numFFELP == $numTotal){ $retVal = array(TRUE, 'A'); }elseif($numFFELP 0 $numCONS 0 count($FFELP_Lenders) 1 $numFFELP + $numCONS == $numTotal){ etc. Any suggestions? Thanks, -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Without seeing more code it's hard to say which would be better for you to use, but based on the snippet you've provided it looks like an if block is the only thing that will work for you. The main perk to using switch over if statements is speed (Google can back this up). The reason it's faster is because it's simpler by design and is able to jump directly to the case that evaluates to true, whereas an if statement needs to evaluate every if/elseif condition until it finds one that evalutates to true. In your example you're passing the $FFELP_Lenders variable through count() multiple times. One way to speed things up would be to cache the results of count($FFELP_Lenders) in a separate var so that the entire $FFELP_Lenders array isn't being counted potentially 50+ times - unless of course you're manipulating it later in the code. You can also clean up this code a bit by removing other redundancies. In the example below we're only evaluating $numFFELP one time. If it is not greater than 1 then everything inside that block that depends on $numFFELPS being 1 will be skipped - getting you one step closer to the speed of a switch statement. // Cache the number of elements in the // $FFELPS_Lenders array $numFFELP_Lenders = count($FFELP_Lenders); if($numFFELP 1) { // At this point we know $numFFELP is greater than one if ($numFFELP_Lenders 1 $numFFELP == $numTotal) $retVal = array(TRUE, 'A'); }else { // From here on out we know that $numFFELP // is greater than 0. If it's not this block of code // will be completely ignored. if($enumFFELP 0 $numFFELP_Lenders 1 $enumFFELP + $numFFELP == $numTotal){ $retVal = array(TRUE, 'A'); }elseif($numCONS 0 $numFFELP_Lenders 1 $numFFELP + $numCONS == $numTotal){ // Rob says Wh!!11!!!11one1! } } It's been a long night for me as well so I hope this makes as much sense to me in the morning as I think I does right now ;-)
Re: [PHP] IF or SWITCH
On 4/6/06, Robert Cummings [EMAIL PROTECTED] wrote: On Thu, 2006-04-06 at 02:29, Joe Wollard wrote: The main perk to using switch over if statements is speed (Google can back this up). The reason it's faster is because it's simpler by design and is able to jump directly to the case that evaluates to true, whereas an if statement needs to evaluate every if/elseif condition until it finds one that evalutates to true. I'm gonna go out on a limb here and say WRONG! Run yourself a benchmark. 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. | `' um. Did you just stick you tounge out at me? (jk) Actually, Rob brings up a good point. switch statements are not always faster. Here's an example from http://www.php.net/manual/en/control-structures.switch.php - note that it says that in certain circumstances switch may be faster than an if. In a switch statement, the condition is evaluated only once and the result is compared to each case statement. In an elseif statement, the condition is evaluated again. If your condition is more complicated than a simple compare and/or is in a tight loop, a switch may be faster. Thanks for making me research that one Rob - I learned something there, and Ray I hope that helps.
Re: [PHP] simple regex query
On Thursday 06 April 2006 6:19 am, Angelo Zanetti wrote: Hi guys Been tryin to figure out regex and have found some tutorials but some have made things clear and others have confused me. Anyway for a simple query, if I just wanted to check that a variable has only text and numeric characters would I do something like this (i want it to fail if it finds a symbol eg: + - { etc...): echo REG result: . preg_match('/[a-zA-Z0-9]*/', '{d-fg'); however this resolves to true because there are normal characters (alphabetical characters) so how do I make the expression fail because of the { and - characters in the string? You can also list which characters you DON'T want -- just use a '^' as the first symbol in a bracket expression (i.e., %[^a-zA-Z]% matches a string with a character that is not a letter between two percent signs). But that would mean that I would have to list each symbol I dont want and that would be undesireable as it would be better to list exactly what the acceptable characters are. Can anyone give me some insight as to where I'm going wrong? thanks -- Angelo I found an AJAX regex tester the other day. It'll check PCRE, Posix, and Javascript. Don't know how useful this is, but thought I'd throw it into this thread. http://rexv.org/ -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Argument passed by reference?
On Thursday 06 April 2006 12:24 pm, Chris Boget wrote: Is there a way to test to see if a function argument was passed by reference instead of by value? thnx, Chris The way I understand it, pass by reference in php is determined in the function definition and not the function call. Something like: function foo ($bar) { ... } Here's a link to that section of the php manual: http://us3.php.net/manual/en/language.references.pass.php Hope that helps. -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Download image in PHP
On Wednesday 05 April 2006 7:16 am, mbneto wrote: Hi, If all you want to do is this as a suggestion (altough not php related) you could call wget from your php script to fetch this image without having to worry with other things. Something like this exec ('/path/to/wget http://www.foo.com/bar.jpg'); Of course you'd have to check if everything went fine. On 4/5/06, Russell Jones [EMAIL PROTECTED] wrote: I have an image library on one site that I want to be able to access from another, but I actually want the image downloaded and cached to the new site (so that it doesnt keep taxing the image server). I allow the file() command to pull from other sites, can I do this with just the file('http://www.site.com/image.jpg;); - or how would i do this? Russ You might want to look at CURL, too. http://us2.php.net/manual/en/ref.curl.php -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and Frames
I agree with Richard on this one. Frames should really be avoided if for no other reason than they cause headaches like the one you have right now. ;-) If you can't avoid them, keep it simple - just store the ID in one place, like a session cookie. Doing so will make sure that if the session ID gets changed in one frame it will still be correct in all of the other frames. - Joe On 4/5/06, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, April 5, 2006 1:02 pm, Shaun wrote: I have a site that uses frames. The frameset loads another site (both on the same server) in the lower frame window. Every time the page changes in the lower frame the session id changes, how can I stop this happening? You might be able to reduce the occurence by doing start_session() in the top frame as well. However, the browser is free to fetch the two frames in parallel, and that means you could sometimes end up with different sessions in each. This is a really good reason to just abandon frames, as if there weren't enough others already... That said, in the FRAMESET page, you can do start_session() and pass it down into the FRAME URLs: ?php session_start(); $session_id = session_id(); ? FRAMESET ... FRAME SRC=...PHPSESSID=?php echo $session_id? ... FRAME SRC=...PHPSESSID=?php echo $session_id? ... /FRAMESET You will need to get the right variable name, or you may even need to do like this in the FRAME pages: ?php $session_id = $_GET['PHPSESSID']; session_id($session_id); //SET the session ID to what's passed in session_start(); ? The caveat, though, is that you are now exposing your session ID in the URLs, which is not so good for security reasons. If it's over SSL, it's fine. If it's not, and if security matters, then you either need to move to SSL or abandon frames. You should abandon frames anyway... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: mysql_fecth_array() and function call as parameter
Paul, Try TO_DAYS(curdate()) instead - if not you can't say we didn't try! ;-) If that doesn't work you may want to try a MySQL list. - Joe On 4/3/06, Paul Goepfert [EMAIL PROTECTED] wrote: I included the or die function on the end of my query statement. When I tested this on my web page I got the following error Query2 Failed: You have an error in your SQL syntax near '(curdate())' at line 1 When this code executed: $query2 = mysql_query(SELECT dayNum FROM Days WHERE dayNum = day(curdate())) ; I can't see where the error is. Can anyone see the error? The table name is correct because I have another drop down box that gets all dates in the table and outputs it with no error. I also tested the above SQL statement on a local copy of mysql (version 5.0.18-nt) and it worked with out any errors. And this code works on a different web server. Mysql client version 3.23.49. However it does not work on mysql client version 3.23.54. Also both php versions are the same. Thanks Paul On 4/3/06, Jon Drukman [EMAIL PROTECTED] wrote: Paul Goepfert wrote: function determineDay () { $return = ; $query1 = mysql_query(SELECT months FROM Month WHERE m_id = month(curdate())); $query2 = mysql_query(SELECT dayNum FROM Days WHERE dayNum = day(curdate())); $query3 = mysql_query(SELECT year FROM Year WHERE year = year(curdate())); always Always ALWAYS check the error return!!! $query1 = mysql_query(SELECT months FROM Month WHERE m_id = month(curdate())) or die(query1 failed: . mysql_error()); do this religiously on every single mysql_query. in fact, write a wrapper function to do it for you - that's what i do. If anyone can find my error please let me know. I have looked at this for about an hour and I can't figure it out. you probably could have saved an hour by checking the error code. -jsd- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] microsoft PHP ?
Just as long as everyone knows that everything I said was all in good fun. Next time I'll be sure to use sarcasam just to be sure nothing is taken the wrong way ;-) On 4/2/06, Chris Shiflett [EMAIL PROTECTED] wrote: Joe Wollard wrote: I made fun of Chris and Rasmus specifically because I know they're on this list. I appreciate being considered important enough to make fun of. Thanks! :-) Chris
Re: [PHP] microsoft PHP ?
el-oh-el. See, I forgot already. Good lookin' out Matt! On 4/2/06, Matt Richards [EMAIL PROTECTED] wrote: oops forgot the first sarcasam .. oh well! :( Matt Richards wrote: quote: Joe Wollard wrote: Just as long as everyone knows that everything I said was all in good fun./sarcasam Next time I'll be sure to use sarcasam just to be sure nothing is taken the wrong way ;-) Joe Wollard wrote: Just as long as everyone knows that everything I said was all in good fun. Next time I'll be sure to use sarcasam just to be sure nothing is taken the wrong way ;-) On 4/2/06, *Chris Shiflett* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Joe Wollard wrote: I made fun of Chris and Rasmus specifically because I know they're on this list. I appreciate being considered important enough to make fun of. Thanks! :-) Chris
Re: [PHP] microsoft PHP ?
Leave poor Zouari alone! I for one think that Microsoft buying Zend would be the best thing to happen to PHP, EVAR! This Rasmus guy didn't even mean for PHP to be what it is, he just wanted something simple and now look at it. It's WAY to complex for an unorganized bunch of hobbyists to maintain. I'm personally looking forward to the way they'll clean things up. Who knows, maybe once they've got PHP under control we won't need these security 'experts' like Chris Shifflett any more because would be hackers won't be able to see the source code, which of course means they won't be able to find vulnerabilities. You guys just need to give up on this open source hippie dream and let Microsoft change things for the better - who cares if Stephen King thinks they are working in conjunction with the Crimson King and that they might build robots that will someday take over the world and more or less 'suck the s-m-r-t' out of 50% of the worlds twins? He looks creepy anyway. - and a happy April fool's to all ;-) On 4/1/06, Matt Richards [EMAIL PROTECTED] wrote: Zouari Fourat: lol, bet you feel silly now :) Stut wrote: Zouari Fourat wrote: :) Gerry not that funny ;) I was affraid :o from the news Rule #1 on the Internet... Never trust any news without a link to an official source Rule #2 on the Internet... Never trust anything you read on April 1st -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] microsoft PHP ?
Sheesh Stut, I thought the - and a happy April fool's to all ;-) would be enough. Of course I'm joking, why would I be on this list if I didn't like open source and PHP in general? Besides, I made fun of Chris and Rasmus specifically because I know they're on this list. They both know they _rule_so_hard_! On 4/1/06, Kevin Kinsey [EMAIL PROTECTED] wrote: Stut wrote: Joe Wollard wrote: Leave poor Zouari alone! I for one think that Microsoft buying Zend would be the best thing to happen to PHP, EVAR! This Rasmus guy didn't even mean for PHP to be what it is, he just wanted something simple and now look at it. It's WAY to complex for an unorganized bunch of hobbyists to maintain. I'm personally looking forward to the way they'll clean things up. Who knows, maybe once they've got PHP under control we won't need these security 'experts' like Chris Shifflett any more because would be hackers won't be able to see the source code, which of course means they won't be able to find vulnerabilities. You guys just need to give up on this open source hippie dream and let Microsoft change things for the better - who cares if Stephen King thinks they are working in conjunction with the Crimson King and that they might build robots that will someday take over the world and more or less 'suck the s-m-r-t' out of 50% of the worlds twins? He looks creepy anyway. - and a happy April fool's to all ;-) __ Troll, I warnest thee, BEGONE!!! -- \/ \ //\ \|\___/| / \// \\ /0 0 \__ /// | \ \ / / \/_/// | \ \ @_^_@'/ \/_ //| \ \ //_^_/ \/_ // |\\ ( //) |\/// | \ \ ( / /) _|_ / ) // | \ _\ ( // /) '/,_ _ _/ ( ; -.|_ _\.-~.-~~~^-. (( / / )) ,-{_ `-.|.-~-. .~ `. (( // / )) '/\ / ~-. _ .-~ .-~^-. \ (( /// )) `. {} / \ \ (( / )) .~-.\\-' .~ \ `. \^-. ///...\ _ -~ `. ^-` ^-_ ///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~ /.-~ :-D Here's assuming that was a joke so I won't get into the factual errors. I wonder how Zend and the other core developers will feel about being referred to as an unorganized bunch of hobbyists. -Stut Well, I'm not sure about your LOCALE and cultural referents, but from where I'm sitting I could freakin' *see* the sarcasm tags on that one ... or maybe it's just my MUA. ;-) As an aside, to prevent further potential misunderstanding, there's one on my ASCII art as well :-D KDK -- Disclose classified information only when a NEED TO KNOW exists.
Re: [PHP] Can output_buffering be set in a script?
On Thursday 30 March 2006 9:02 am, Todd Cary wrote: I do not have access to the php.ini file and I need to have output_buffering turned on. Can this be done within a script? Thank you Yep. http://us2.php.net/manual/en/function.ob-start.php That link should get you started. -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] White label with PHP?
On Wednesday 29 March 2006 9:52 am, Merlin wrote: white label solution Can someone enlighten me as to what this means? Thanks. -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering
if you really want to mess with them.. only show the user with the NULL IP address all the spam posts.. .make them think that they've been successful On 3/29/06, Rahul S. Johari [EMAIL PROTECTED] wrote: Ave, I¹ve run into a slight problem. We maintain a Guestbook for our company¹s website. Lately we have been getting a lot of ³Spam² entries into the Guestbook. I added a snippet into the PHP Script a field in the mySQL database to record the IP Address of posters. However, for the SPAM posts, it records ³Null² instead of an IP Address. I¹m using $REMOTE_ADDR to records the IP. It records IP Addresses of any genuine poster... But NULL for the spam poster. What else can I do to block the SPAM entry? Is there some other Unique Identifier that I can record of the Spam poster and then block him? Thanks, Rahul S. Johari Coordinator, Internet Administration Informed Marketing Services Inc. 500 Federal Street, Suite 201 Troy NY 12180 Tel: (518) 687-6700 x154 Fax: (518) 687-6799 Email: [EMAIL PROTECTED] http://www.informed-sources.com -- Joe Harman - * My programs never have bugs, they just develop random features. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IP Address Filtering
Good thing I don't have kids! On 3/29/06, Kevin Kinsey [EMAIL PROTECTED] wrote: Joe Harman wrote: if you really want to mess with them.. only show the user with the NULL IP address all the spam posts.. .make them think that they've been successful Freaking hilarious idea!! Remind me not to let my kids play with yours. :-D Of course, there's probably not any Real People(tm) behind these addys. Kevin Kinsey -- Sentient plasmoids are a gas. -- Joe Harman - * My programs never have bugs, they just develop random features. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] private $foo
On Tuesday 28 March 2006 1:12 pm, Jochem Maas wrote: ?php class Foo { private $foo = 'foo'; function __get($k) { if (isset($this-{$k})) { return $this-{$k}; } throw new Exception(non existing property!); } function __set($k, $v) { if (isset($this-{$k})) { $this-{$k} = $v; return; } throw new Exception(non existing property!); } } $f = new Foo; echo $f-foo,\n; $f-foo = bar; echo $f-foo,\n; Maybe I'm wrong, but I thought you couldn't use the $f-foo to access private variables from outside a class? -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] where php at?
On Monday 27 March 2006 12:31 pm, tedd wrote: At 1:19 PM -0600 3/27/06, Jay Blanchard wrote: [snip] Where do I type in which php? [/snip] At the command line on the host. Aarrrg -- no disrespect meant. I'm totally and absolutely clueless and frustrated. It must be my age because I haven't seen a command line since my Apple][ days -- let alone one while doing web work. I'm sitting in front of my computer accessing my remote web site via ftp (GoLive) writing code and trying to set up a cron job using cpanel to run that code. Now, I have no idea of where I should type in which php -- I've tried putting it in my cpanel cron jobs command to run box, but that doesn't do anything. Does anyone have any reference material of where a command line of the host is? Thanks. tedd -- --- - http://sperling.com Hey Tedd, Do you have ssh access to your remote server from your local machine? If you do, then that would be where you'd run the command which php. On Linux/Mac OS X, you can ssh via a terminal. On Windows, a program like PuTTY will do the trick. Link for PuTTY download (just in case): http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Syntax for ssh: ssh user account@hostname/IP Once you have an ssh session open to your remote server, running which php will return the remote path for php. Hope that helps. -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE quirk
With IE, it's not a quirk. It's a feature. On Thursday 16 March 2006 3:31 pm, Jay Blanchard wrote: [snip] I created a small bannering program. It works great in Firefox. But I have a problem with IE. If I place the banner on a different domain than the bannering program, Ex: www.bannerserver.com www.otherserver.com has img tag calling from www.bannerserver.com I use a session to keep track of the banner that is displayed, have even tried using cookies directly. Works great in firefox, problem with IE is first time vising www.otherserver.com, clicking on the img does not work, apparently, the session was never start/recorded when retrieving the image. However, if I go back to www.otherserver.com, it then works fine, I can go anywhere, as long as I don't close the browser, www.otherserver.com works. Why would IE not be recording the session info on the first visit? Firefox does it just fine. Anyone run into this? [/snip] From http://www.php.net/session [quote] When using session_start() to begin a session this session will remain open until the page has finished loading or it is explicitly terminated. You can lose the session however if the the page contains a reference to img src= with name and id references (which may be used if the image is referencing a dynamic image, called by javascript) This seems to casue IE6 to refresh the page session id and hence loose the session. [/quote] -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What am I missing?
On Tuesday 07 March 2006 11:45 am, Gustav Wiberg wrote: form name=frmMan action=admin/phpfunctions/addnewmanufacturer.php?frmManufacturer=?php echo $frmIDManufacturer;?frmModel=?php echo $frmIDModel;? method=post input type=text size=30 name=frmManufacturerName input type=submit value=ok /form You could try using an absolute rather than a relative path: /mobilkamera/admin/phpfunctions/addnewmanufacturer.php -- Joe Henry www.celebrityaccess.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Downloading very large files
Jonathan, Not sure how you're using fread, but here's a slightly modified version of what's in the manual that might help: ?php $handle = fopen(/var/dump/vids/test.mpg, rb); while (!feof($handle)) { print fread($handle, 8192); } fclose($handle); ? If my understanding of this code is correct you won't be trying to load the entire file into memory and you're not trying to store the file in a variable. All that this should do is give the client the file in 8KB chunks - which is much easier on the overall load your script will add to the system and will probably run faster since it's not as taxing. Again I've never had to write a script that matches your conditions but I hope this helps. -Joe W. www.joewollard.com - theCore On 2/13/06, Jonathan Duncan [EMAIL PROTECTED] wrote: Thank you for the input. For now we are just using PHP to create symbolic links to the video files and the links are removed when they are done viewing the video. We are open to other suggest still, but for now, this fills our needs and bypasses putting so much stress on PHP as to put hundreds of mb of files through it. Why secure? A combination of all those reason. Thanks, Jonathan On Mon, 13 Feb 2006, Rory Browne wrote: I've seen this problem many times before, but I'm not sure what solution was found. Possible solutions: Encrypt the file, make it publicly available, and then give the right people the encryption key. Put it behind a .htaccess file allowing only the IP of the correct person - remove the .htaccess entry after a certain lengh of time. Why are the videos secure? Copyright? Privacy? Bandwidth? On 2/13/06, Jonathan Duncan [EMAIL PROTECTED] wrote: I have an application that delivers files to the client browser. These files a very large video files. 250mb+ each. I have two options: 1) I could have PHP deliver the file with fread, or 2) I could have PHP present a link to the file. However, for security purposes, I would rather not have the actual files available. I suppose I could have PHP create temporary symbolic links on the file system that link to the files in question and then remove the links, thus requiring the users to go through an authentication process to retrieve files that are assigned to them. Anyway, downloading such large files causes PHP to balk with size limitation errors. I could increase the size limit and memory limit settings in php.ini, but for file sizes that large, is it recommended? Are there best practice limits on these settings: max_input_time, memory_limit, max_execution_time, etc.? Thanks, Jonathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php