Re: [PHP] PHP Fusebox
i have used this before , its a wierd system and you have to echo the html absolutely painful I am trying to standardize my development process and have been looking at the different frameworks out there. One of the philosophies I like is that of Fusebox, although originally developed for ColdFusion it is now available for PHP: http://bombusbee.com/ Anybody have any experience working with Fusebox, or can anybody recommend any other frameworks that I should also look at? I am looking for a framework that will be developed going into PHP 5 also. Your help is appreciated. Ralph -- 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] Sum a column of values from a MySQL query
Yes, I know. However, the while() loop should generate all the invoice in a list. -Original Message- From: Giz [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 12:03 AM To: 'Ben C.'; [EMAIL PROTECTED] Subject: RE: [PHP] Sum a column of values from a MySQL query I think you're a big confused here. Your query will only return one row, because you're using sum(). $invoicepartpaid will be your total for the invoiceid specified. -Original Message- From: Ben C. [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 11:42 PM To: [EMAIL PROTECTED] Subject: [PHP] Sum a column of values from a MySQL query I am trying to sum a query of values from a MySQL table. The code I am using is: ---BEGIN CODE #1-- $sql_2 = SELECT SUM(partpaidamount) as partpaid FROM $tb_name WHERE invoiceid = \$invoiceid\ ; $result_2 = @mysql_query($sql_2,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($result_2)) { $invoicepartpaid = $row['partpaid']; } ---END CODE #2 -- 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 Fusebox
Hello, You could also take a look at Krysalis Foundation - http://www.interakt.ro/products/Krysalis/ It implements the MVC approach by defining a sitemap with the request serving rules, and by separating the model from the view using XML trees as the output of the model and XSL to add the presentation layer over it. Alexandru -- Alexandru COSTIN Chief Operating Officer http://www.interakt.ro/ +4021 312 5312 Tariq Murtaza [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Ralph! I suggest MVC. http://phrame.sourceforge.net/ http://www.phpmvc.net/ Regards, TM. Ralph Guzman wrote: I am trying to standardize my development process and have been looking at the different frameworks out there. One of the philosophies I like is that of Fusebox, although originally developed for ColdFusion it is now available for PHP: http://bombusbee.com/ Anybody have any experience working with Fusebox, or can anybody recommend any other frameworks that I should also look at? I am looking for a framework that will be developed going into PHP 5 also. Your help is appreciated. Ralph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Fusebox
really tedious logic Hello, You could also take a look at Krysalis Foundation - http://www.interakt.ro/products/Krysalis/ It implements the MVC approach by defining a sitemap with the request serving rules, and by separating the model from the view using XML trees as the output of the model and XSL to add the presentation layer over it. Alexandru -- Alexandru COSTIN Chief Operating Officer http://www.interakt.ro/ +4021 312 5312 Tariq Murtaza [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Ralph! I suggest MVC. http://phrame.sourceforge.net/ http://www.phpmvc.net/ Regards, TM. Ralph Guzman wrote: I am trying to standardize my development process and have been looking at the different frameworks out there. One of the philosophies I like is that of Fusebox, although originally developed for ColdFusion it is now available for PHP: http://bombusbee.com/ Anybody have any experience working with Fusebox, or can anybody recommend any other frameworks that I should also look at? I am looking for a framework that will be developed going into PHP 5 also. Your help is appreciated. Ralph -- 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] strange foreach behaviour
I have come up against a very strange problem. I currently have no idea how to even approach attempting to fix it... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: strange foreach behaviour
My apologies for the last post - somehow managed to send whilst attempting to copy and paste... d'oh. I'd like to try again. I have come up against a very strange problem. I currently have no idea how to even approach attempting to fix it... In the following code snippet, $this-items is an array of objects - each of these objects is one of two object types (with similar interfaces). There is nothing that unusual in the these few lines: foreach ($this-items as $code = $item) { var_dump($this-items[$code]); var_dump($item); etc. } but after successfully calling this piece of code a number of times in my application, I get the following output: object(citem)(2) { [q]= int(1) [c]= string(3) 157 } NULL Fatal error: Call to a member function on a non-object in /var/www/local/ge/include/product.php4 on line 58 I have no comprehension how it is that the two var_dump() commands can produce different outputs. Can anyone suggest what sort of thing I need to be looking at?! Any help very gratefully received, regards, Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] snippet
can someone explain this for me: ... $sFont =submit(font) ? SITE_ROOT . PROG_PATH . submit(font) : ; ... mfg. hwiens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] snippet
Hello, This is a reply to an e-mail that you wrote on Tue, 5 Aug 2003 at 11:14, lines prefixed by '' were originally written by you. $sFont =submit(font) ? SITE_ROOT . PROG_PATH . submit(font) : ; it is the same as: if(submit(font)){ $sFont = SITE_ROOT . PROG_PATH; } else { $sFont = ; } (see http://uk.php.net/language.operators.comparison) submit() is a user defined function, if it evaluates to false then $sFont will contain the value of those two constants put togetherm otherwise it will be set to an empty string. HTH David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Free PHP error handling script: www.phpmachine.com/error-handler/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sum a column of values from a MySQL query
On Tuesday 05 August 2003 15:43, Ben C. wrote: Yes, I know. However, the while() loop should generate all the invoice in a list. As has been pointed out the query only results in a single row. So how would the while-loop generate all the invoice[s]? It's only ever given a single row to play with. And has also been pointed out, could you state clearly: - what exactly you're trying to do - what your database schema is - what you tried that didn't work, and *how* it didn't work -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* I appoint you ambassador to Fantasy Island!!! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best PHP CMS
I'm just looking for some opinions. I've been going though sourceforge looking at different CMS systems. There are a lot of really good CMS projects out there. I'm looking for some opinions on the best ones out there. I'm obviously looking at something PHP based and using mySQL backend. Some of the features that I'd like are an easy template implementation, blog features, media gallery and something that's easy to build custom modules to add features. So far I'm looking at about 6 CMS systems, I like certain things in each of them. so what's your opinion. - Anthony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sum a column of values from a MySQL query
[snip] However, why not just SUM all the rows in the table in the query if you just want a total? $sql_2 = SELECT SUM(partpaidamount) as partpaid FROM $tb_name; [/snip] That is what he is doing. The SELECT SUM will only return ONE row! I am not sure that the problem is being explained clearly though. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Formatted text from mySQL DB
From: PHPSpooky [EMAIL PROTECTED] When I create any field and let data be sent into my mySQL DB through it.. it goes ok. But when I retrieve it.. the data comes completely unformatted. Ah, this question again. Has it been four days already? HTML does not render new lines. Have a look at the source code of your page and you'll see that the text is indeed on separate lines. HTML only understands something like br /, though, to go to a new line. So, you need to replace the new line characters with HTML breaks in order to maintain appearance. www.php.net/nl2br ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Repopulating forms
Sweet... Thank you. Works perfectly. You all have be most helpful. Hope this works in Smarty Gerard - Original Message - From: CPT John W. Holmes [EMAIL PROTECTED] To: Gerard L Petersen [EMAIL PROTECTED]; Php-General [EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 4:07 PM Subject: Re: [PHP] Repopulating forms From: Gerard L Petersen [EMAIL PROTECTED] My code looks like this. ?PHP $test = gerard's name is \gerard\; echo $test.br; echo 'input type=text name=test2 value='.$test.'br'; ? Just like HTML doesn't render newlines, it also doesn't understand using the \ character as an escape character. You are creating this: input type=text name=test2 value=gerard's name is gerard So, HTML takes the first bit between double quotes and ignores the rest as a unknown attribute. Run htmlentities() on $test before putting it in the INPUT element to change the quotes to HTML entities. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem using unlink()
Hi, I have a problem using unlink(); on a system using FreeBSD and Apache... where my local system using Windows and Apache experiences no problems. ? unlink(test1.php); ? On the windows system is deletes the file, but on the FBSD system the file does not delete and returns no error. I have tried using the full path, and CHMODing the files but no luck. Thanks for any help/advice you can give me. James Brash -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP/JavaScript/HTML
Hello folks I wrote a JavaScript to set the values of a Select html object by client side. The values are copied from another Select that I create getting the values from the database. After the user set the values he/she wants to add it in another form, for example, then press submit button, the values of the user Select object doesn't appears on the next page. What can I do to get the user selected values in the another page? Someone could help me? Thanks! .:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. Maurício Alegre Valente AGP5 Tecnologia da Informação Ltda. (48) 439-3004 Visite nosso site: www.agp5.com.br .:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. - Original Message - From: Nicholas Robinson [EMAIL PROTECTED] To: skate [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 4:26 AM Subject: Re: [PHP] easier than switch As, in this case, only one of the variables is non-null, then you could use the string concatenation operator and this would return what you want. i.e. type = $_POST['news'] . $_POST['dreams'] . $_POST['storys']... I think I've used the same variable name in different forms on the same page, as only one form submission occurs at any one time there can't be a conflict and PHP doesn't care where the POST'ed variable came from.. So, you could rename news, dreams, etc. to be type and extract the result directly without having to fiddle around. HTH Nick On Monday 04 Aug 2003 11:19 pm, skate wrote: okay, so i know there's an easy way to do this, and i've seen it done, sure of it. so please forgive the stupidity of my question, i don't even know where to begin to look in the archives either... i have several forms on one page, they all submit a different variable, i then want to set one variable depending on that... okay, now i'm confusing myself, lets try explain it with some code... ? if(isset($_POST)) { $type = $_POST['news'] || $_POST['dreams'] || $_POST['storys'] || $_POST['words'] || $_POST['chat']; } ? obviously this doesn't work. but i wanna set $type depending on which $_POST variable was sent. only one of these will ever be sent. rather than doing a big ass switch statement, is there no way i can get this into one line? i hope this isn't too confusing... -- 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] Formatted text from mySQL DB
Astrum Et Securis! I had a question.. When I create any field and let data be sent into my mySQL DB through it.. it goes ok. But when I retrieve it.. the data comes completely unformatted. That is.. let's say I fed this in a textarea.. The Man Is Cool. If I view the data from my phpMyAdmin or even Command Line mySQL.. the data has gone just this way.. But when I use mysql_fetch_array() to get the data back from mySQL, it prints as .. The Man Is Cool. The newline disappears, and I have to use br's while feeding the data to have the line gaps. What am I doing wrong? Following is an example code of what I use.. ? while ($result = mysql_fetch_array($query)) { echo $result[data] br ; } ? If the data stored in 'data' was multiple lines.. I would get one single line from the Database.. not as I had sent it in. Dominor! PHPSpooky -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Repopulating forms
-Original Message- From: Gerard L Petersen [mailto:[EMAIL PROTECTED] Sent: 05 August 2003 14:56 My code looks like this. ?PHP $test = gerard's name is \gerard\; echo $test.br; echo 'input type=text name=test2 value='.$test.'br'; echo 'input type=text name=test2 value='.htmlentities($test).'br'; Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Allowed mem size exhausted
I have the following code that generates the following error. I am using this code to prepare a zip or tar.gz file as an email attachment. Can someone suggest a better / more efficient way to do this and maybe avoid the error??? I believe that the file that generated this error was about 1.8MB. 6 $fp = fopen($path.$filename, r); 7 $content = fread($fp, filesize($path.$filename)); 8 $attachment = base64_encode($content); 9 $attachment = chunk_split($attachment); Fatal error: Allowed memory size of 8388608 bytes exhausted at (null):0 (tried to allocate 2228273 bytes) in /home/user/public_html/dir/subdir/include/functions.php on line 9 Many thanks! Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: FDF problem with IE - any experts out there?!?
Oooh, and I forgot! In addition to all the other Microsuck non-compliance... IE just plain doesn't like the IDEA of a dynamic PDF file. Thus, if you use the usual no-cache headers, it will puke on you. So what you have to do is embed a random part in your URL. Continuing with our example from yesterday, instead of: http://example.com/yourexistingscript/id/42/phony.pdf You need to have do something like this: http://example.com/yourexistingscript/id/42/iebroken756348329/phony.pdf Note that the digits following 'iebroken' need to be RANDOM. Here's the code I use to change the action of my Submit button in my most recent project: //strip off the name of the PDF: $self_last_slash = strrpos($self, '/'); $self_front = substr($self, 0, $self_last_slash - 1); $self_back = substr($self, $self_last_slash); //strip off the previous random insertion: $self_front_last_slash = strrpos($self_front, '/'); $self_front = substr($self, 0, $self_front_last_slash); mt_srand((double) microtime() * 100); $microsoft_sucks = mt_rand(1, mt_getrandmax()); $microsoft_sucks = iebroken$microsoft_sucks; $action = http://$hostname$self_front/$microsoft_sucks$self_back;; error_log(Setting action to $action); //You'll have to read the docs at http://fooassociates.com/phpfer/html/rn20re284.html to grok the bindec stuff. fdf_set_submit_form_action($outfdf, Save, FDFUp, $action, bindec(00111)); And, finally, even though Micrsuck IE ignores the Content-type: in favor of the .pdf at the end (see previous post in this thread), you MUST use the Content-type: vnd.fdf in order to get the FDF to actually work through IE+Acrobat. I'm assuming IE+Reader also needs this, but haven't tested that just yet. So, to summarize: 1. You need the URL to END in .pdf, because IE sucks. 2. You can't have ?variable=value at the end of the URL, because IE sucks. 3. You can't use no-cache headers, because IE sucks. 4. While 1. might make you think the Content-type is irrelevant, it must be application/vnd.fdf because IE sucking doesn't convince Acrobat to do the right thing. 5. IE sucks. Thus, you have to rename your script without the .php and use .htaccess to force it to execute, you then have to tack on all your variable=value pairs in a fake path, as well as a random string, and finally the URL has to end in .pdf to make IE happy. You can't send the no-cache headers, and you must send the application/vnd.dfd content-type. Do all that, and IE actually works. Well, as much as IE can ever be said to work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] snippet
Hi Harry, can someone explain this for me: ... $sFont =submit(font) ? SITE_ROOT . PROG_PATH . submit(font) : ; ... It's called the ternary operator, and it's a shorthand for if...else... The line you're asking about is equivalent to: if (submit(font)) { $sFont = SITE_ROOT . PROG_PATH . submit(font); } else { $sFont = ; } The format is: (condition to check) ? (result if true) : (result if false); Cheers Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Formatted text from mySQL DB
Astrum Et Securis! Thanks all.. for the very needed input. www.php.net/nl2br has been very helpful. I'm still testing out the different ways. There appears to be a differentiation between people's usage and formulas for the same. While some find nl2br() very helpful, others find it a waste of time. And some have their own ereg_replace() formulas assisting them. A little bit of testing will have me on my way. Thanks again.. Dominor! PHPSpooky HTML does not render new lines. Have a look at the source code of your page and you'll see that the text is indeed on separate lines. HTML only understands something like br /, though, to go to a new line. So, you need to replace the new line characters with HTML breaks in order to maintain appearance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettin parameters from url, architecture question
* Thus wrote Merlin ([EMAIL PROTECTED]): they are dynamic. Would it make sence to put all requests to an error document? Is this not a huge load for the server? Lets say I redirect all 401 errors to one php page where I parse the url and find the right file to redirect. This would be possible, but I fear that it would slow down the server. Yes, it is an very inefficient way to handle things. I probably should have added that this isn't a recommended way to do this. What do you think? Maybe there is another possiblitiy=? Mod rewrite might be a better alternative: RewriteRule ^file_html_22.html$ dospamfile.php HTH, Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/JavaScript/HTML
From: Mauricio [EMAIL PROTECTED] I wrote a JavaScript to set the values of a Select html object by client side. The values are copied from another Select that I create getting the values from the database. After the user set the values he/she wants to add it in another form, for example, then press submit button, the values of the user Select object doesn't appears on the next page. What can I do to get the user selected values in the another page? Well, if I understand that correctly, you need to use Javascript to select all of the options that the user selected to add to the second select box. If they aren't selected, then they won't be passed to the next page. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Handling DELETE requests
Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Seairth Jacobs ([EMAIL PROTECTED]): Under Apache 1.3, how can I respond to DELETE request with a PHP script? I have no problem with GET, POST, or PUT. The only thing I found was the Scripts directive, but that requires a specic script to be named. I am looking for something more generic, possibly where I can just say that php scripts can accept DELETE requests. hmm.. I've never seen the DELETE method used anywhere, and probably for good reason. By default you cant use this method with apache and I'm not sure if you can enable it without recompiling it or getting a patch that enables it. Yes, Mod_Actions allows this functionality, but this ability is a blanket statement-style directive, where *all* DELETE requests would go to the same single script, regardless of what the DELETE was for. Now if you do enable the method, it is rather undefined on how it would be handled by php. According to some documentation I found (w3c) is: quote DELETE Requests that the server delete the information corresponding to the given URL. After a successfull DELETE method, the URL becomes invalid for any future methods. /quote If the client issues a 'DELETE /file.php' will the server delete the php file and make it unusable. Or will it pass the Request to php. If the latter happens then my assumption is that it will be like a GET request but the $REQUEST_METHOD variable will be 'DELETE' instead of 'GET'. And you program can act accordingly. Well, the argument could be made for PUT as well. Should the server PUT a new copy of the PHP file, or pass the PUT on to the PHP file for processing? Currently, the default behaviour is to pass the request on to the script, which is what I would expect and what I want for DELETE as well. My application has a single entry-point script with its own maintained sub-paths. Such a DELETE request would inform that script to delete the names subpath (or return the appropriate HTTP response... likely 405). Now with that said, the common way to simulate a DELETE method is by using GET with query paramaters telling you that this request want to really delete something. In general, this is not a good design. GETs are not supposed to cause side-effects. Use of POST to a given URI's container URI would be a better alternative. Still, it's a shame that all the HTTP verbs are not better supported, as more applications are beginning to use them (finally). It's just that most people think the only HTTP client is the Web browser, which is not true anymore. Thanks for the reply. --- Seairth Jacobs [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session ID as a regex
On Wednesday 06 August 2003 02:28, Gerard Samuel wrote: How would you best describe a session id as a regex? [a-z0-9]{32} Just checking to see if any other characters can be in a session id. I think [a-f0-9]{32} is sufficient. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Are you selling NYLON OIL WELLS?? If so, we can use TWO DOZEN!! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to auto create a new page on the fly
--- DougD [EMAIL PROTECTED] wrote: I would like to create a new page on the fly - basically having the PHP file to export content into a new static HTML file and save it as content.php. Can you give more information? This answers your current question (assuming you meant to phrase that as a question): touch('content.php'); Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Values from forms
-Original Message- From: Beauford.2005 [mailto:[EMAIL PROTECTED] Sent: 05 August 2003 00:36 Thanks for the info. The first suggestion doesn't work, The first suggestion does work -- I've used it more than once in the past. If it doesn't work for you, you're doing something wrong. But the array solution is better. and the second may work - but the problem is I need the array to start at '1' - and arrays in general start at 0. PHP arrays start wherever they start -- by default, if you don't specify otherwise, they start at 0, but they can start with anything (e.g. array('foo'='bar', 'plugh'='xyzzy') starts at 'foo') -- so if you want one to start at 1 then just start it at 1. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sum a column of values from a MySQL query
-Original Message- From: Ben C. [mailto:[EMAIL PROTECTED] Sent: 05 August 2003 07:42 I am trying to sum a query of values from a MySQL table. The code I am using is: ---BEGIN CODE #1-- $sql_2 = SELECT SUM(partpaidamount) as partpaid FROM $tb_name WHERE invoiceid = \$invoiceid\ ; $result_2 = @mysql_query($sql_2,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($result_2)) { $invoicepartpaid = $row['partpaid']; } ---END CODE #2 1) The code returns the sum of a partially paid invoice. The individual invoice is 'partpaid'. WORKS...NO PROBLEM That's a very confusing description -- what do you mean by sum of a partially paid invoce? What you're getting is the sum of partpaidamount for all invoices with the given invoiceid -- although how you can have more than one invoice with the same invoiceid beats me! 2) The while() then return a list of partially paid invoices which is $invoicepartpaid. WORKS..NO PROBLEM No, wrong -- it can't and doesn't return a list, since the query above will return a *single* value -- the sum of partpaidamount for the selected invoices. That's one row with one value in it. 3) I then want to add the list of partially paid invoices ($invoicepartpaid) together. I AM STUCK HERE ADDING THE INVOICES AMOUNTS TOGETHER. But you've already added the partially paid invoice amount together with your SELECT SUM(partpaidamount) -- why are you trying to do it again? There seems to be a fundamental problem here somewhere -- why don't you go right back to the beginning and describe: (1) The table you are selecting from (fieldnames, what they contain, etc.). (2) Exactly what you are trying to extract from it, using what criteria. (3) Which exact values from that you want to add together. (4) and what you expect the final result to be. Then we might all be starting from a level playing field in terms of understanding exactly what you're trying to do (and if not, someone will be sure to ask further questions!). Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Repopulating forms
From: Gerard L Petersen [EMAIL PROTECTED] My code looks like this. ?PHP $test = gerard's name is \gerard\; echo $test.br; echo 'input type=text name=test2 value='.$test.'br'; ? Just like HTML doesn't render newlines, it also doesn't understand using the \ character as an escape character. You are creating this: input type=text name=test2 value=gerard's name is gerard So, HTML takes the first bit between double quotes and ignores the rest as a unknown attribute. Run htmlentities() on $test before putting it in the INPUT element to change the quotes to HTML entities. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dev style guide
* Thus wrote jsWalter ([EMAIL PROTECTED]): Is there a style guide for coding practices used when creating code to be shared with the community? The rule is to code they way the community has been coding. if the indent like such: if ($var) { //blah } Dont change it to no matter how much it breaks your religion. if ($var) { } now of course, they should have some rules defined with some coding standards documentation. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettin parameters from url, architecture question
thanx, that points me into the right direction. I will do some research on that. cheers, Merlin -- lt;IFRAME SRC=http://saratoga.globosapiens/associates/report_member.php?u=3color=EEE EEE scrolling=no frameborder=0 TITLE=My travel articles width=330 height=155 ALLOWTRANSPARENCY=truea href=http://www.globosapiens.net; title=Worldwide Travel CommunityaTravel Communitya/ /IFRAME Curt Zirzow [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] * Thus wrote Merlin ([EMAIL PROTECTED]): they are dynamic. Would it make sence to put all requests to an error document? Is this not a huge load for the server? Lets say I redirect all 401 errors to one php page where I parse the url and find the right file to redirect. This would be possible, but I fear that it would slow down the server. Yes, it is an very inefficient way to handle things. I probably should have added that this isn't a recommended way to do this. What do you think? Maybe there is another possiblitiy=? Mod rewrite might be a better alternative: RewriteRule ^file_html_22.html$ dospamfile.php HTH, Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Display Records in Multiple Pages help please !
If you're using CGI/Perl, WHY WHY WHY are you asking questions on a PHP list? I've given you a hint, so perhaps take that hint and ask a question on an Oracle list, or search the Oracle documentation for similar functions. Justin French On Tuesday, August 5, 2003, at 10:37 PM, Coello, David wrote: thank you for replying, good morning. im using oracle 8. with cgi/perl thank you david -Original Message- From: Justin French [mailto:[EMAIL PROTECTED] Well, you haven't told us what database you're using at all, but I'll assume MySQL. In which case you should look at the LIMIT part of your query. http://www.mysql.com/doc/en/SELECT.html All you need to do is pass around a starting point variable on each page, so that you know where the result for the next page of results will start from (eg row 40 or 41 for page 3) On Tuesday, August 5, 2003, at 02:53 AM, Coello, David wrote: good afternoon i found a forum about displaying 25 records per page, im using cgi and i need also to display only 25 records per page but i want to be able to go to my next page and see the next 25 and so on... the proble that im having is that i have a about 2000 records and the query that i use calls all of them? how do i limit them thank you david coello -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettin parameters from url, architecture question
--- Merlin [EMAIL PROTECTED] wrote: So they are saving cpu and db_traffic by writing html pages out? Pretty much, yeah, though I don't think the pages are completely static HTML either, but the majority of the logic is done in batches. It was basically a common sense approach taken a long time ago when the following was considered: 1. We generate content for every single user. 2. Many users are receiving pages where 99% of the content is identical. How are they making sure that they are up to date? It's part of the configuration. If you download their source code and use it on your own site, you will probably use a different configuration than they use (unless your site is very busy). If memory serves correctly, there are Perl daemons constantly running that do the generating. If you can tolerate minute intervals between refreshes, you could just use cron and some shell scripts (in PHP or whatever), which would be simpler to implement. A lot of PHP developers use some sort of server-side caching within their own applications - whatever pieces of data rarely change but are having to be generated over and over. Do u know any good tutorials on that? No, but I'm sure someone has written some if you search. Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class extension problem
* Thus wrote Joshua Groboski ([EMAIL PROTECTED]): ?php class CMS { var $prop1 = a; function CMS(){ $this-prop1 = A; } } class WebSite extends CMS{ var $prop2 = b; function WebSite(){ } function setProp2(){ $this-prop2 = $this-prop1; } } $ws = new WebSite(); echo Before: . $ws-prop2 . : . $ws-prop1 . \n; $ws-setProp2(); echo After: . $ws-prop2 . : . $ws-prop1 . \n; ? If you run this, you'll notice the constructor for CMS is never called. Is this a by-design functionality, am I wrong about what I think should happen, or am I just totally off my rocker? PHP 4.0 does not have full support in what most people think should happen. you will need to call the inherited constructor inside the child. function WebSite() { $this-CMS(); } PHP 5.0 has a lot of changes but still is in development ATM. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get exec() to display output from UNIX Shell Environemnt?
I have read the manual but haven't seen anything that work with system, passthru, exec for this command code. Here's the example that I use for exec() and curl with one example script and it work. --snip-- exec(curl -d \$XP_ECALS_STR\ 21 .TARGET_URL, $result_array, $res_code); --snip-- But with this one, it doesn't work. As you can see, this is not really much different from the 1st example. --snip-- exec(curl -u \$BASIC_AUTH\ -d \$XML_REQ_STR\ 21 .TARGET_URL, $result_array, $res_code); --snip-- Thanks, Scott F. Reuben D. Budiardja [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tuesday 05 August 2003 05:20 pm, Scott Fletcher wrote: Hi! How do I get the php function exec() to spit out the data from the Unix Shell Environment onto the webpage? I mean, I can create a script in bash shell environment using the terminal on the Unix machine and it would spit out the background information from the O/S along with the shell script. I can do that with cURL. So, for the PHP, I would need to use exec() but it only executed the script without a problem but no shell output from the unix shell onto the webpage. How can I do that? It is very helpful for troubleshooting purpose. Use the second argument of exec(), or use system(), depending on your need. Read The Manual for exec() and system(). It's pretty clear. RDB -- - /\ ASCII Ribbon Campaign against HTML \ / email and proprietary format X attachments. / \ - Have you been used by Microsoft today? Choose your life. Choose freedom. Choose LINUX. - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to get exec() to display output from UNIX Shell Environemnt?
On Tuesday 05 August 2003 05:20 pm, Scott Fletcher wrote: Hi! How do I get the php function exec() to spit out the data from the Unix Shell Environment onto the webpage? I mean, I can create a script in bash shell environment using the terminal on the Unix machine and it would spit out the background information from the O/S along with the shell script. I can do that with cURL. So, for the PHP, I would need to use exec() but it only executed the script without a problem but no shell output from the unix shell onto the webpage. How can I do that? It is very helpful for troubleshooting purpose. Use the second argument of exec(), or use system(), depending on your need. Read The Manual for exec() and system(). It's pretty clear. RDB -- - /\ ASCII Ribbon Campaign against HTML \ / email and proprietary format X attachments. / \ - Have you been used by Microsoft today? Choose your life. Choose freedom. Choose LINUX. - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to auto create a new page on the fly
also look into output buffering. so you would then do these steps 1. start buffer 2. redirect all output to varaible $output 3. echo Static HTML code (from opening to closing html tags) 4. when completly done all output, the variable $output should have all the html code 5. then using filesystem functions (fopen, etc...) dump variable into that newly created file and then you are done. If you have questions just post onto the list, but check the filesystem methods and the output buffering methods (ob_start, ob_flush, etc...). Bobby Dougd [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I would like to create a new page on the fly - basically having the PHP file to export content into a new static HTML file and save it as content.php. Make sense? Appreciate your help and insights. -Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: why doesn't default values for this function work
Anders Thoresson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I'm having problem with a function that I'll use to validate user input before passing it to MySQL. For strings, I want to make sure that they aren't to long, so I have written this function: function secure_string($unsafe_string, $max_length = -1, $errormessage = Too many characters. ) */ { // verify that string isn't longer then $max_length, if $max_length is set if ($max_length -1) { if (!is_int($max_length)) { error(Variable max_length is not an integer. ); } if (strlen($unsafe_string) $max_length) { error($errormessage); } } ... and the validation will continue here. When I want to use the max length check I pass a value to the function like this: $a_header = secure_string($_POST['a_header'], 60, Header must not be more then 60 characters. ); But I having to problems: 1) If no max length is passed, and $max_length gets the value -1, the if- loop if ($max_length -1) is still run. 2) Calls to my own function error doesn't work. Instead of creating a popupwindow with javascript (which works in other places where error() is called) the errormessage is printed like html. What's wrong? Best regards, -- anders thoresson Having trouble with your line wrap? Okay.. from what I can decipher you have a logic error starting with the first if() statement. You've set a default value of -1 and then you're testing if the input is greater than -1. However if the variable Is Set but Empty the input will evaluate to 0 which is greater than -1 and the condition will be true. This is what Jason was talking about but it's only half the problem. The other thing is if you're going to use the default value then the is_int() statement should come *before* the value comparison. But you should not need the default value at all becuase your're testing the validity of $max_length against the length of the string later in the function. Provided you know that the value is an integer and less than $max_length then any testing beyond that is just redundant nonsense. So fortunately all you need to do is eliminate the default value along with the first if() statement and you should be good to go.. function secure_string($unsafe_string, $max_length) { if(!is_int($max_length)) error(Variable max_length is not an integer. ); if (strlen($unsafe_string) $max_length) error(Too many characters.); } - Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best PHP CMS
On Tuesday 05 Aug 2003 2:51 pm, you wrote: I'm just looking for some opinions. I've been going though sourceforge looking at different CMS systems. There are a lot of really good CMS Have a look at Typo3 - http://typo3.com Will do all you want, but it's a big package and may be too sophisticated (and hence maybe not worth the learning curve) for your requirements. If you either need a large setup with many content authors, or are likely to use it for a number of sites it's well worth the effort. Ask me off-list if you have any specific questions. - Nick -- Nick Talbott, Powys County Council (UK) IT Policy and Strategy Manager/Rheolwr Polisi a Chynllunio TGCh email: [EMAIL PROTECTED] fax:01597 824781 web:www.powys.gov.uk and www.powysweb.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I change ? to %3F
David Nicholson wrote: If you want *only* the ?:/ characters changed then it can be done with a regular rexpression, the e modifier, and the ord(), hex() and strtoupper() functions, post back if you would like an example. $new_str = str_replace(array('?',':','','/'),array('3F','3A','26','2F'),$old_string); should be less costly than a regular expression with an 'e' modifier. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/JavaScript/HTML
From: Mauricio [EMAIL PROTECTED] On the Address Bar I can see: index.php?slcAdd=1slcAdd=2slcAdd=3 But when I get the value using $HTTP_GET_VARS['slcAdd']; it returns just the last value. What can I do to get them all? Name your select box as slcAdd[] and you'll have all of the values in an array. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gettin parameters from url, architecture question
Also, don't rule out the possibility of generating static HTML at regular intervals. This is how sites such as Slashdot operate - it's a sort of a creative server-side caching mechanism. this sounds very interesting. So they are saving cpu and db_traffic by writing html pages out? How are they making sure that they are up to date? Do u know any good tutorials on that? Merlin -- lt;IFRAME SRC=http://saratoga.globosapiens/associates/report_member.php?u=3color=EEE EEE scrolling=no frameborder=0 TITLE=My travel articles width=330 height=155 ALLOWTRANSPARENCY=truea href=http://www.globosapiens.net; title=Worldwide Travel CommunityaTravel Communitya/ /IFRAME Chris Shiflett [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] --- Merlin [EMAIL PROTECTED] wrote: What do you think? Maybe there is another possiblitiy=? Are you certain the site in question doesn't simply parse the HTML files as if they were PHP? Even so, I do not understand how you think one of these URLs is more search optimized than the other: http://example.org/script.html http://example.org/script.php Also, don't rule out the possibility of generating static HTML at regular intervals. This is how sites such as Slashdot operate - it's a sort of a creative server-side caching mechanism. Hope that helps. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dev style guide
Is there a style guide for coding practices used when creating code to be shared with the community? PEAR has some, http://pear.php.net/manual/en/standards.php I gave them a cursory glance, and they seem to be pretty solid -- in line with standards that I used for the past year or so after realizing that my old code was nearly indecipherable. They use the One True Brace Style, which is encouraging: function fooFunction($arg1, $arg2 = '') { if (condition) { statement; } return $val; } - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Fusebox
Hi Ralph! I suggest MVC. http://phrame.sourceforge.net/ http://www.phpmvc.net/ Regards, TM. Ralph Guzman wrote: I am trying to standardize my development process and have been looking at the different frameworks out there. One of the philosophies I like is that of Fusebox, although originally developed for ColdFusion it is now available for PHP: http://bombusbee.com/ Anybody have any experience working with Fusebox, or can anybody recommend any other frameworks that I should also look at? I am looking for a framework that will be developed going into PHP 5 also. Your help is appreciated. Ralph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preventing output dump of passthru()
Hello, This is a reply to an e-mail that you wrote on Wed, 6 Aug 2003 at 00:56, lines prefixed by '' were originally written by you. Hello, Trying to prevent the output dumping of passthru() and instead store the output in a variable. I read an article that suggested this: ob_start(); passthru(command); $output =3D ob_get_contents(); ob_end_clean(); But that didn't work. Is there *ANY* way to achieve what I want? What you put above should work, but how about... $output = array(); exec(command,$output); $output = implode(,$output); (see http://uk.php.net/implode and http://uk2.php.net/manual/en/function.exec.php) All the best, David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Free PHP error handling script: www.phpmachine.com/error-handler/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Unzipping Files
I am doing this for a client, and he doesn't have the ZZIPlib installed, and would like to avoid it if possible. Any other ideas? It has been mentioned before: use exec, or the backtick operator, and the command-line tools: unzip, bunzip, gunzip, etc. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dev style guide
Is there a style guide for coding practices used when creating code to be shared with the community? Walter -- Ankh if you love Isis. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Command line php....
On Wednesday 06 August 2003 11:11, John Nichel wrote: 4.3.2 Try disabling output buffer in php.ini. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* The quantity of the food consumed is in direct ratio to your weight. -- For heavy dieters */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO function overloading?
Hi, This statement isn't entirely correct, overloading is possible with the overload extension. http://www.php.net/overload Regards, Greg -- phpDocumentor http://www.phpdoc.org Curt Zirzow wrote: * Thus wrote Jean-Christian IMbeault ([EMAIL PROTECTED]): Is it possible to overload a function is a class. I would like to have the same function defined differently depending on the number of arguments passed in. For example: overloading isn't possible in php4. Curt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stop neurotic posting
andu wrote: This is a very busy list, over 100 message in a quiet day and most people are helpful and decent, don't mind reading and learning. Unfortunately there are some who mostly post stuff like 'read the manual' and other shit like that. Stuffing e-mailboxes with such garbage day after day doesn't do anybody any good even if the manual is not being read as much as it should be. Is it too difficult to not answer the post at all if you disagree with the content? Please search the archives... this argument has been made before. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php