[PHP] Re: define constants within functions?
Sure, define them outside the function :) Justin French [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If I define a constant within a function, it appears that the constant is only defined within the namespace of the function. Fair enough. Can I globalise these definitions? --- Justin French http://indent.com.au -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL PHP Examples Training Providers Required
Robby Russell wrote: Not to start a SQL war, but have you consider PostgreSQL as well in your decisions? And how about Firebird, Oracle has roots from the same original development in the 1980's. -- Lester Caine - L.S.Caine Electronic Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] weird error, might be javascript?
Hi all, FIrstly apologies if this is slightly OT, but it is relevant to PHP. I have been working on a pretty big project over the last couple of months and then all of a sudden I started getting errors in my browser, the error in the bottom left corner with the yellow icon. anyway Im not sure what causes these errors. It says that it expects a ) on line 597 of that page. First thing is that my page is not even 100 lines long. Secondly I get different errors on different pages. I also get errors on all pages. I do use a javascript file that is used on most pages for various functions like validation and opening other pages etc... So what I'm guessing is that something is wrong somewhere in that page but, I have no clue what it is or where it is. I tried to go through it yesterday but its such a long process and I cant seem to see anything else wrong. So should I in a way recreate the whole javascript file from the beginning till now? and hopefully the error will come up or are there any other ideas you guys have or any tools that could assist me? Thanks in advance Angelo Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Date and time
Hi, I have this date in timestamp format: $a= 20040810114155; I want to add 7 days to this date. How can i do that? Thanks Home, no matter how far... http://www.home.ro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] weird error, might be javascript?
Angelo Zanetti wrote: I have been working on a pretty big project over the last couple of months and then all of a sudden I started getting errors in my browser, the error in the bottom left corner with the yellow icon. anyway Im not sure what causes these errors. It says that it expects a ) on line 597 of that page. That's a JavaScript error. Look at line 597 of the HTML source, not the PHP source, to find the error. -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Date and time
DIFF FanneHH wrote: I have this date in timestamp format: $a= 20040810114155; I want to add 7 days to this date. How can i do that? echo date('YmdHis',mktime(substr($a,8,2),substr($a,10,2),substr($a,12,2),substr($a,4,2),substr($a,6,2)+7,substr($a,0,4))); Looks like a MySQL timestamp. If so, you can use SELECT yourcolumn + INTERVAL 7 DAY FROM yourtable ... in your query. -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date and time
That's a mysql timestamp, if you want to manipulate dates in PHP you'll need to use unix timestamps. You have a couple of options, select unix_timestamp(myFld) as myFld from myTbl Then just add 60*60*24*7 to it. Or, parse it with: function convert_timestamp ($timestamp) { $timestring = substr($timestamp,0,8). . substr($timestamp,8,2).:. substr($timestamp,10,2).:. substr($timestamp,12,2); return strtotime($timestring); } Diff Fannehh [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I have this date in timestamp format: $a= 20040810114155; I want to add 7 days to this date. How can i do that? Thanks Home, no matter how far... http://www.home.ro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] weird error, might be javascript?
yes but even If I take the page source, its not anywhere near 597 lines long...any other ideas? Sorry forgot to mention it in initial post. John Holmes [EMAIL PROTECTED] 8/11/2004 12:44:25 PM Angelo Zanetti wrote: I have been working on a pretty big project over the last couple of months and then all of a sudden I started getting errors in my browser, the error in the bottom left corner with the yellow icon. anyway Im not sure what causes these errors. It says that it expects a ) on line 597 of that page. That's a JavaScript error. Look at line 597 of the HTML source, not the PHP source, to find the error. -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Encoding
Greetings, I have heard about PHP Encoding technique. What exactly it does and how is it useful? Any more help will really be appreciated. Thanks a lot for giving your time. -- Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] weird error, might be javascript?
Angelo Zanetti wrote: yes but even If I take the page source, its not anywhere near 597 lines long...any other ideas? Sorry forgot to mention it in initial post. Do you have a URL? It's a Javascript error, either way. -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] weird error, might be javascript?
Please do not top post. On Wednesday 11 August 2004 19:03, Angelo Zanetti wrote: yes but even If I take the page source, its not anywhere near 597 lines long...any other ideas? Sorry forgot to mention it in initial post. Depending on your browser and how you view the source the line reported and the line where you will (eventually) find the error may be different. So keep looking. Angelo Zanetti wrote: I have been working on a pretty big project over the last couple of months and then all of a sudden I started getting errors in my As it happened all of a sudden then just roll back your changes to before it happened then implement them step-by-step until it happens all of a sudden again. That should help you pinpoint where the problem is. -- 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 -- /* To say phooey to a GUI is no hooey. -- Murphy's Law of GUIs */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SQL Functions
This might be slightly off the topic but I would recommend you use a database abstraction layer which will do what you want to achieve Check out Pear DB http://pear.php.net/manual/en/package.database.db.php and adodb http://adodb.sourceforge.net/ pete Dan Joseph wrote: Hi Everyone, I'm trying to build a class to handle various SQL functions. One of them is to take a query, and return all rows. Here's what I have so far: function selectRows( $sql ) { $count = 0; $results = mysql_query( $sql, DB::connect() ); $data = mysql_fetch_array( $results ); return $data; } Right now it only returns 1 row. I'm guessing this is how it should be, considering I haven't looped thru any other rows. What I want to do is return something that holds all the rows, however, I cannot see a decent way of doing this. I've played with putting it into a new array, but I can't decide if that's the best way to do it. Wondering if I could get some opinions on how you all would handle this? -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Encoding
On Wednesday 11 August 2004 19:11, Kevin wrote: I have heard about PHP Encoding technique. What exactly it does and how is it useful? Any more help will really be appreciated. google PHP Encoding Thanks a lot for giving your time. Thank google. -- 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 -- /* A sine curve goes off to infinity, or at least the end of the blackboard. -- Prof. Steiner */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date and time
There was a little mistake in the code I posted before, try this one: http://aidan.dotgeek.org/lib/?file=function.convert_timestamp.php Diff Fannehh [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I have this date in timestamp format: $a= 20040810114155; I want to add 7 days to this date. How can i do that? Thanks Home, no matter how far... http://www.home.ro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL PHP Examples Training Providers Required
[snip] I'm looking for some examples of sites that are purely MySQL and PHP running on Unix and that contain a few thousand records preferably held in relational databases. Rationale: I need to justify PHP as a tool of choice over say vb.net or Oracle. My recommendation, despite my limited knowledge of MySQL and PHP is that even if we have 10-15 databases holding upwards of 10,000 records each PHP and MySQL are the tools of choice and I doubt that there are any functions missing that you'd find in VB.Net. I could be wrong and if so, please let me know. [/snip] We do not have any external sites that can be looked at, but we have several internal apps on Linux and BSD boxes, all running MySQL and PHP. Our largest application processes an average of 1.2 million records per day with the database currently holding nearly 350 million (350,000,000) records. One of the tables in this database contains 180,000,000+ records. Each of the tables in this particular database are configured to be able to hold 1 billion records if required. (DON'T FORGET TO PROPERLY INDEX LARGE TABLES!) We use PHP to process those records for use in various systems throughout the company as well as providing reporting mechanisms on those records. PHP has proven to be a reliable and effective tool for creating applications where ditribution to hundreds of users is required and rapid roll out is a necessity. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: define constants within functions?
[snip] Sure, define them outside the function :) [/snip] I have not tried this (we usually place constants in a section of the code external to any function) but are you saying that if a constant is defined within the bounds of a function it is not global? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] download script
Hi, Following class may be usefull. http://www.phpclasses.org/browse/package/699.html One Advice :: Please check your script in another browsers too. some Buggy Browser may cause the problems. zareef ahmed --- Aaron Todd [EMAIL PROTECTED] wrote: I was going to post another follow-up question in a pending thread here but it seems to have been deleted. Anyway, I am trying to write a download script that will downloaded files from my site. All these files need to be protected so just anybody cant come to the site and download them. I have already created a login environment for this site and just need to make my file downloads work. Currently they are in a directory protected by .htaccess. I was told on the previous thread that I needed to place the files that are protected by .htaccess ouside of the webroot in order for PHP to have rights to them. My web root is /home/lgxdlr/mainwebsite_html/ I put the secure directory called test in /home/lgxdlr/ I am trying to dowload a file using readfile(), but PHP still cant seem to get to the file. Here is my code: ?php $file = /home/lgxdlr/test/.$_GET['file'].; if (file_exists(basename($file))) { header(Content-Description: File Transfer); header(Content-Type: application/force-download); header(Content-Disposition: attachment; filename=.basename($file)); @readfile($file); } else { echo $filebr; echo basename($file); echo brNo File Found; } ? If anyone can give me a hand with this please post. Thanks, Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Zareef Ahmed :: A PHP Developer in Delhi(India). Homepage :: http://www.zasaifi.com __ Do you Yahoo!? Yahoo! Mail Now with 25x more storage than before! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP logic - Whats going on here?
Ive stumbled onto a rather strange problem, atleast I cant see why this is happening. Im using phpMailer to send mails, and I have the following straight forward code : $mail = new phpmailer(); $mail-IsSendmail(); $mail-From = '[EMAIL PROTECTED]'; $mail-FromName = 'From Name'; $mail-AddAddress('[EMAIL PROTECTED]'); $mail-Subject = $header; $mail-Body = $body; Then to send the mail we use this : if(!$mail-Send()) { echo $lang_error['mailer_error'] . br\n; } As you see above, Ive dropped the what if all goes well loop, since I believe that the $mail-Send() is initiaded in the first statement For some reason the above results in a blank mail, no $body at all, rest is fine. However, if I include a dummy for if all goes well : if(!$mail-Send()) { echo $lang_error['mailer_error'] . br\n; } else { // Why do I need this one??? } What I dont understand is why do I need the last else statement? Isnt the result of $mail-Send() completed if I only check for !$mail-Send()? Maby it would be better to write like this : if(!$mail-Send()) { echo $lang_error['mailer_error'] . br\n; } else if ($mail-Send()){ // Why do I need this one??? } The above would in my belief send two mails, atleast my logic tells me that. The strange part is that when looking at examples from phpmailer.sourceforge.net they use my initial loop aswell, not the Why do I need this one??? part. Im beginning to wonder if there are something mystical going on with either my code or our servers. ?? Hope someone understand what Im wondering about here, hehe. -- -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [PHP4] class overload and ref to objects
Hi all, I have encountered some troubles in trying to achieve the following: - overload class properties by means of __set() and __get() magic functions - store references to objects rather than copies of them in the overloaded class properties using the following code I can actually store and access references to objects, but it doesn't work if I try to call a method on the referenced object: $OO = new overloadedClass(); $OO-new_property = $myObject; // this is a real ref to $myObject echo $OO-new_property-my_property // it works fine $OO-new_property-myFunction();// doesn't work and produces fatal error the error message looks like this: Fatal error: Class 'overloadedClass' does not support overloaded method calls... any help or suggestion is very much appreciated. thanks, Alessandro - code fragment ?php class overloadedClass { var $Properties = array(); function ServicesRepository() { overload(overloadedClass); } function __set($property_name, $property_value) { $this-Properties[$property_name] = $property_value; return true; } function __get($property_name, $property_value) { if(isset($this-Properties[$property_name])) { $property_value = $this-Properties[$property_name]; return true; } else return false; } } ? *** Alessandro Vitale Jr. Software Engineer Tiscali International Network Spa +39 070 4601678 [EMAIL PROTECTED] *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP logic - Whats going on here?
[snip] Then to send the mail we use this : if(!$mail-Send()) { echo $lang_error['mailer_error'] . br\n; } As you see above, Ive dropped the what if all goes well loop, since I believe that the $mail-Send() is initiaded in the first statement For some reason the above results in a blank mail, no $body at all, rest is fine. However, if I include a dummy for if all goes well : if(!$mail-Send()) { echo $lang_error['mailer_error'] . br\n; } else { // Why do I need this one??? } What I dont understand is why do I need the last else statement? Isnt the result of $mail-Send() completed if I only check for !$mail-Send()? [/snip] This is fairly standard in programming languages all the way around. The 'else', even if a dummy, is the antithesis of the NOT statement. Think of it this way ... my code if($mail-Send()){ // sends mail because $mail-Send evaluates to TRUE } else { // evaluates to FALSE echo $lang_error['mailer_error'] . br\n; } my code your code my comments if(!$mail-Send()) { // if $mail-Send is FALSE 'if' evaluates TRUE echo $lang_error['mailer_error'] . br\n; } else { // $mail-Send evaluated to TRUE, without 'else' it is has no place to 'act' // Why do I need this one??? } your code I hope that helps, may not be crystal clear. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP logic - Whats going on here?
Thanks for your reply, it all seems logical when you think of it, still I also think it sounds logical without the extra ELSE statement since the function has to executed for the first IF to do the comparison, meaning that the email should be sendt in the first place. (If it didnt how could it state FALSE or TRUE, unless PHP only simulates the function if it falls outside the initial IF statement) However, no reason to argue the obvious, :D On the other hand, this would also mean that the exmaples from phpmailers homepage are wrong : [ SNIP FROM http://phpmailer.sourceforge.net/extending.html ] $mail-Body= $body; $mail-AltBody = $text_body; $mail-AddAddress($row[email], $row[full_name]); $mail-AddStringAttachment($row[photo], YourPhoto.jpg); if(!$mail-Send()) echo There has been a mail error sending to . $row[email] . br; [ /SNIP] This is probably why I in the first place removed the extra ELSE statement, since I didnt see any reason for it. But in future Ill always include it it seems, :D -- Kim Steinhaug - There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. - www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Load data and Insert
Hi! i need do two querys in one. First query is a load data and the second query is insert into. My idea is to concatenate with and, but i'not know. Is it possible? Regards, Juan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/MySQL based webmail?
Matthew Sims [EMAIL PROTECTED] writes: Uh, well...Squirrelmail is simply a webpage. The number of simultaneous users is defined by the web server application, aka Apache. Perhaps we view it differently. Apache is a web server. SquirrelMail and Horde are applications, written in PHP. I'm curious about user experiences deploying both, especially in terms of resource consumption and scalability. IMAP doesn't HAVE to be on the same box. You can use SM to connect to an another server running your mail. Yes. But both Squirrel and Horde must speak IMAP to the mail server, whether on localhost or remote. IMAP's nontrivial and introduces more load on the web app server than -- say -- a POP-based mail GUI. Or static web pages. I'm also quite interested in fault-tolerance. I can deploy a couple of physical boxes running SquirrelMail behind load balancers. But Squirrel stores stuff like user address books and preferences on the web server's disk; this obviously won't work in a load balanced arrangement where a client connection is just as likely to go to the other box. I could put the files on a back-end NetApp NFS server like I do for my (balanced) SMTP/IMAP mail servers; this may introduce NFS file locking problems and corruption by simultaneous access to the same NFS-resident file. (My SMTP/IMAP servers use Maildir to avoid NFS problems). Does Horde have these same implementation issues? How does it store preferences and such? It seems a much more resource-intensive application than the relatively simpler SquirrelMail, but I haven't done any benchmarks to compare the two. Basically it boils down to this question of web app scalability and resource needs: can I support a community of (say) 2500 people, where maybe 100 are actively using webmail at any given instant on a box like a Sun Netra running Slowaris with 1GB RAM? Or some 2GHz i86 box with 1GB running FreeBSD? If not, how are you folks worrying the scalability issue? While this isn't specifically a PHP question, I think scalability of PHP applications is germane to the list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Load data and Insert
Juan Pablo Herrera [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi! i need do two querys in one. First query is a load data and the second query is insert into. My idea is to concatenate with and, but i'not know. Is it possible? Regards, Juan Please specify a bit more clearly *what* data you want to load *from where* and insert into *what*. Then we may be able to help you. Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Load data and Insert
[snip] i need do two querys in one. First query is a load data and the second query is insert into. My idea is to concatenate with and, but i'not know. Is it possible? [/snip] a. It is possible. http://catb.org/~esr/faqs/smart-questions.html 2. This is a PHP list, not a SQL list. III. HTH! INSERT INTO `table1` SELECT * FROM `table2` You can use conditions, the number of columns must match. http://dev.mysql.com/doc/mysql/en/INSERT.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Load data and Insert
Torsten Roehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Juan Pablo Herrera [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi! i need do two querys in one. First query is a load data and the second query is insert into. My idea is to concatenate with and, but i'not know. Is it possible? Regards, Juan Please specify a bit more clearly *what* data you want to load *from where* and insert into *what*. Then we may be able to help you. Regards, Torsten Roehr If you refer to MySQL you can use the INSERT ... SELECT syntax to do this in one query. See here: http://dev.mysql.com/doc/mysql/en/INSERT_SELECT.html Regards, Torsten Roehr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OO Question for PHP4
Hi all. As the subject suggests, I am using PHP4 and am having something going on that I don't think should be. Presume the following code class Foo { function Foo () { return Bar; } } $foo = new Foo; echo $foo; $foo comes out as an object. Does this have to be done in two line like this?: class Foo { function bar () { return Bar; } } $foo = new Foo; $bar = $foo-bar; Or is there a better design approach I should be reminded of or learn? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OO Question for PHP4
[snip] Hi all. As the subject suggests, I am using PHP4 and am having something going on that I don't think should be. Presume the following code class Foo { function Foo () { return Bar; } } $foo = new Foo; echo $foo; $foo comes out as an object. Does this have to be done in two line like this?: class Foo { function bar () { return Bar; } } $foo = new Foo; $bar = $foo-bar; [/snip] This is correct. $foo = new Foo; // calls $foo as the object echo $foo; // echo's an object Bar would then be a public member of $foo, hence $foo-bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO Question for PHP4
Im sure you should be returning a value in your constructor at all?? Ill check the manual, but i dont think ive ever seen a constructor return anything, doesnt sound right.. Let me check. Jason Jed R. Brubaker [EMAIL PROTECTED] wrote: Hi all. As the subject suggests, I am using PHP4 and am having something going on that I don't think should be. Presume the following code class Foo { function Foo () { return Bar; } } $foo = new Foo; echo $foo; $foo comes out as an object. Does this have to be done in two line like this?: class Foo { function bar () { return Bar; } } $foo = new Foo; $bar = $foo-bar; Or is there a better design approach I should be reminded of or learn? Thanks in advance! -- 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 logic - Whats going on here?
On 08/11/2004 9:28 AM, Kim Steinhaug [EMAIL PROTECTED] wrote: Thanks for your reply, it all seems logical when you think of it, still I also think it sounds logical without the extra ELSE statement since the function has to executed for the first IF to do the comparison, meaning that the email should be sendt in the first place. (If it didnt how could it state FALSE or TRUE, unless PHP only simulates the function if it falls outside the initial IF statement) However, no reason to argue the obvious, :D On the other hand, this would also mean that the exmaples from phpmailers homepage are wrong : [ SNIP FROM http://phpmailer.sourceforge.net/extending.html ] $mail-Body= $body; $mail-AltBody = $text_body; $mail-AddAddress($row[email], $row[full_name]); $mail-AddStringAttachment($row[photo], YourPhoto.jpg); if(!$mail-Send()) echo There has been a mail error sending to . $row[email] . br; [ /SNIP] This is probably why I in the first place removed the extra ELSE statement, since I didnt see any reason for it. But in future Ill always include it it seems, :D I've been using PHPMailer like this for years: if (!$mail-Send()) { } You shouldn't need an extra else { }, Jay's reasoning nonetheless. That being said, I don't know why it isn't working for you. Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Load data and Insert
Torsten Roehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Juan Pablo Herrera [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi! i need do two querys in one. First query is a load data and the second query is insert into. My idea is to concatenate with and, but i'not know. Is it possible? Regards, Juan Please specify a bit more clearly *what* data you want to load *from where* and insert into *what*. Then we may be able to help you. Regards, Torsten Roehr If you refer to MySQL you can use the INSERT ... SELECT syntax to do this in one query. See here: http://dev.mysql.com/doc/mysql/en/INSERT_SELECT.html Regards, Torsten Roehr It's OK, but i need concatenate load data with insert. I have a file *.cvs that used three fields (a,b,c), my database have four fields(a,b,c,d). The insert have the data for last field. Regards, Juan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Load data and Insert
[snip] It's OK, but i need concatenate load data with insert. I have a file *.cvs that used three fields (a,b,c), my database have four fields(a,b,c,d). The insert have the data for last field. [/snip] This cannot be done. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] redirecting to another frame using php header function
hi... can anyone point me to a way to do a page redirect using the php 'Header' function to another frame. I have a page in one frame, when the user does a submit, i want to have the app do a redirect using the 'Header' function, with the subsequent page being displayed in another frame. didn't find anything from google/php.net thanks -bruce -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO Question for PHP4
* Jason Davidson [EMAIL PROTECTED]: Im sure you should be returning a value in your constructor at all?? Ill check the manual, but i dont think ive ever seen a constructor return anything, doesnt sound right.. Let me check. From my experience, returning a value from a constructor currently does nothing, in either PHP4 or PHP5. -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP logic - Whats going on here?
Kim Steinhaug wrote: [snip] For some reason the above results in a blank mail, no $body at all, rest is fine. However, if I include a dummy for if all goes well : if(!$mail-Send()) { echo $lang_error['mailer_error'] . br\n; } else { // Why do I need this one??? } What I dont understand is why do I need the last else statement? You shouldn't. Isnt the result of $mail-Send() completed if I only check for !$mail-Send()? Yes. Maby it would be better to write like this : if(!$mail-Send()) { echo $lang_error['mailer_error'] . br\n; } else if ($mail-Send()){ // Why do I need this one??? } The above would in my belief send two mails, atleast my logic tells me that. I'm not familiary with phpMailer, or exactly how the Send method words, but the code above would end up calling the Send method twice. If the Send method does in fact send (as its name suggests) then you probably don't want to call it twice when you intend to send the message only once. :) [snip] Hope someone understand what Im wondering about here, hehe. In PHP (and every language that I've ever used...) an if statement's expression is evaluated regardless of whether there is an else portion, or an elseif, etc. For example, suppose we have a function foo() that is evaluated primarily for its side effects, but may return either true or false to indicate if the function was successful. This: if (foo()) { print foo() was successful!\n; } is functionally equivalent to this: if (foo()) { print foo() was successful!\n; } else { } The null else clause should have no effect whatsoever on the execution of the script. In fact, the following code snippets are all functionally identical: //Version one foo(); //Version two if (foo()) { } //Version three if (!foo()) { } else { } In all three cases foo() is evaluated just once. Something else you should be aware of: When the expression in the if statement is a compound expression (it contains multiple expressions), then the PHP parser uses lazy or short-circuit evaluation. This means that the parser only evaluates the portions of the expression that are necessary to calculate the result of the entire expression. An example: if (foo() bar()) { //Do stuff } In the above example, foo() is evaluated first. If foo() returns false, bar() is not evaluated at all. The reason is that no matter what bar()'s return value is, the entire expression can only be false. Since the parser has already determined the final result, it has no need to evaluate any further terms. Similarly: if (foo() || bar()) { //Do stuff } In this example, bar() will not be evaluated if foo() returns true, but will be if foo() returns false. These are obviously simple examples, but basically the parser only evaluates the terms that are necessary and doesn't go any further. This can be used as a type of flow control to have certain functions/methods called only if another returned true or false. For example, the following two code snippets are functionally identical: //Version one if (foo()) { bar(); } //Version two if (foo() bar()) { } As far as your specific problem, I suspect that there are factors at play that you are not aware of. Either you have run across a bug in the PHP parser itself (unlikely), or you are inadvertently making other changes when you add the else clause. I would suggest using basic debugging techniques to echo/print the contents of the body string at various points to see what it contains. You may need to drill down into the actual source code for the Send() method to see what it things the body string is. If something is happening to this value this approach should reveal where it's occuring. HTH... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mailinglists are honey for Spammers
Hi, Currently i'm working on a php script which allow to archive the content of email accounts. It fetch the accounts through the imap extension and store the messages in a database. It is easy to subscribe an address to this list and collect email adresses. I mean the attemp to hide emails, example: myemail () yahoo ! com has only a psychological value, but it prevent from nothing. Regards, atur
RE: [PHP] PHP logic - Whats going on here?
Michael Sims wrote: string at various points to see what it contains. You may need to drill down into the actual source code for the Send() method to see what it things the body string is. Errr... s/things/thinks/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO Question for PHP4
On Wed, 2004-08-11 at 11:14, Jed R. Brubaker wrote: Hi all. As the subject suggests, I am using PHP4 and am having something going on that I don't think should be. Presume the following code class Foo { function Foo () { return Bar; } } $foo = new Foo; echo $foo; $foo comes out as an object. Does this have to be done in two line like this?: class Foo { function bar () { return Bar; } } $foo = new Foo; $bar = $foo-bar; Or is there a better design approach I should be reminded of or learn? Thanks in advance! Constructors always return a reference to the object. A return statement is disregarded. Have a look at http://www.php.net/language.oop.constructor in particular a post in the comments by steffen staehle. HTH -- Regards, David GetAnyIdeas Web Design [EMAIL PROTECTED] P. 416.452.9410 F. 416.570.4529 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO Question for PHP4
Yup, i typo'd .. should have read, Im not sure you should be returning a value.. Jason Matthew Weier O'Phinney [EMAIL PROTECTED] wrote: * Jason Davidson [EMAIL PROTECTED]: Im sure you should be returning a value in your constructor at all?? Ill check the manual, but i dont think ive ever seen a constructor return anything, doesnt sound right.. Let me check. From my experience, returning a value from a constructor currently does nothing, in either PHP4 or PHP5. -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirecting to another frame using php header function
bruce wrote: hi... can anyone point me to a way to do a page redirect using the php 'Header' function to another frame. I have a page in one frame, when the user does a submit, i want to have the app do a redirect using the 'Header' function, with the subsequent page being displayed in another frame. didn't find anything from google/php.net Can't do this with php. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [SPAM] [PHP] Date and tim
On 11 Aug 2004 10:35:37 -, DIFF FanneHH [EMAIL PROTECTED] wrote: Hi, I have this date in timestamp format: $a= 20040810114155; Convert it to a unix timestamp (that's a mysql timestamp), then add 7 days worth of seconds to it. Search the archives or the web for more. If you're stuck, try using substr. I want to add 7 days to this date. How can i do that? Thanks Home, no matter how far... http://www.home.ro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] weird error, might be javascript?
On Wed, 11 Aug 2004 13:03:23 +0200, Angelo Zanetti [EMAIL PROTECTED] wrote: yes but even If I take the page source, its not anywhere near 597 lines long...any other ideas? Sorry forgot to mention it in initial post. How long is the JavaScript file? Look at line 597 in that file. If that also does not work, try using Mozilla FireFox. I find it much easier to use for JS debugging. John Holmes [EMAIL PROTECTED] 8/11/2004 12:44:25 PM Angelo Zanetti wrote: I have been working on a pretty big project over the last couple of months and then all of a sudden I started getting errors in my browser, the error in the bottom left corner with the yellow icon. anyway Im not sure what causes these errors. It says that it expects a ) on line 597 of that page. That's a JavaScript error. Look at line 597 of the HTML source, not the PHP source, to find the error. -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: define constants within functions?
On Wed, 11 Aug 2004 06:54:35 -0500, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] Sure, define them outside the function :) [/snip] I have not tried this (we usually place constants in a section of the code external to any function) but are you saying that if a constant is defined within the bounds of a function it is not global? Yes, it is global. The OP was not calling his function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP4] class overload and ref to objects
The magic methods tend to screw up references in PHP4. I've turned it off completely myself. My advise is to switch to PHP5 or not use the overloading. On Wed, 11 Aug 2004 15:06:51 +0200, Alessandro Vitale [EMAIL PROTECTED] wrote: Hi all, I have encountered some troubles in trying to achieve the following: - overload class properties by means of __set() and __get() magic functions - store references to objects rather than copies of them in the overloaded class properties using the following code I can actually store and access references to objects, but it doesn't work if I try to call a method on the referenced object: $OO = new overloadedClass(); $OO-new_property = $myObject; // this is a real ref to $myObject echo $OO-new_property-my_property // it works fine $OO-new_property-myFunction();// doesn't work and produces fatal error the error message looks like this: Fatal error: Class 'overloadedClass' does not support overloaded method calls... any help or suggestion is very much appreciated. thanks, Alessandro - code fragment ?php class overloadedClass { var $Properties = array(); function ServicesRepository() { overload(overloadedClass); } function __set($property_name, $property_value) { $this-Properties[$property_name] = $property_value; return true; } function __get($property_name, $property_value) { if(isset($this-Properties[$property_name])) { $property_value = $this-Properties[$property_name]; return true; } else return false; } } ? *** Alessandro Vitale Jr. Software Engineer Tiscali International Network Spa +39 070 4601678 [EMAIL PROTECTED] *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php !DSPAM:411a17dc169931992880537! -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirecting to another frame using php header function
bruce wrote: can anyone point me to a way to do a page redirect using the php 'Header' function to another frame. No. Use Javascript. -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mailinglists are honey for Spammers
SPAM wrote: Currently i'm working on a php script You forgot the part where you ACTUALLY ASK A QUESTION... -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Load data and Insert
On Wed, 11 Aug 2004 12:49:22 -0300 (ART), Juan Pablo Herrera [EMAIL PROTECTED] wrote: Torsten Roehr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Juan Pablo Herrera [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi! i need do two querys in one. First query is a load data and the second query is insert into. My idea is to concatenate with and, but i'not know. Is it possible? Regards, Juan Please specify a bit more clearly *what* data you want to load *from where* and insert into *what*. Then we may be able to help you. Regards, Torsten Roehr If you refer to MySQL you can use the INSERT ... SELECT syntax to do this in one query. See here: http://dev.mysql.com/doc/mysql/en/INSERT_SELECT.html Regards, Torsten Roehr It's OK, but i need concatenate load data with insert. I have a file *.cvs that used three fields (a,b,c), my database have four fields(a,b,c,d). The insert have the data for last field. Regards, Juan I assume you means a csv file, not a cvs file. No, you can't directly load it into Mysql. Yes, you can load it into PHP and then do an INSERT with that data. Google for PHP CSV. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/MySQL based webmail?
This is probably getting a little offtopic (okay, a lot and my last for today) but I'll answer what I can. Now I can't speak for Horde but I can't see how Horde would be any different than what Squirrelmail provides. Matthew Sims [EMAIL PROTECTED] writes: Uh, well...Squirrelmail is simply a webpage. The number of simultaneous users is defined by the web server application, aka Apache. Perhaps we view it differently. Apache is a web server. SquirrelMail and Horde are applications, written in PHP. I'm curious about user experiences deploying both, especially in terms of resource consumption and scalability. I can't speak for mass deployment, but I can't see why it would be any different if 5 people log on at once or 100 people log on. Apache is proven to support enterprise level websites. Your network is your bottleneck. Distribute the load. IMAP doesn't HAVE to be on the same box. You can use SM to connect to an another server running your mail. Yes. But both Squirrel and Horde must speak IMAP to the mail server, whether on localhost or remote. IMAP's nontrivial and introduces more load on the web app server than -- say -- a POP-based mail GUI. Or static web pages. There's a difference between what POP and IMAP does. Basically, do you want your users to view mail from one computer only (laptops, desktops) with no worries about disk space or from any computer (terminals all around the area) with email stored on the mail server. http://www.cit.cornell.edu/computer/email/imap-pop.html I'm also quite interested in fault-tolerance. I can deploy a couple of physical boxes running SquirrelMail behind load balancers. But Squirrel stores stuff like user address books and preferences on the web server's disk; this obviously won't work in a load balanced arrangement where a client connection is just as likely to go to the other box. I could put the files on a back-end NetApp NFS server like I do for my (balanced) SMTP/IMAP mail servers; this may introduce NFS file locking problems and corruption by simultaneous access to the same NFS-resident file. (My SMTP/IMAP servers use Maildir to avoid NFS problems). Not nessessarily. Squirrelmail takes advatages of databases. You can have, say, a MySQL database server that all your load balanced Squirrelmail servers can access to retrieve user info such as logins, addresses and preferences. In fact, this would be a recommended way if you're planning on serving mass users. Stick a fiber connection between the two and you're set for bandwidth. Does Horde have these same implementation issues? How does it store preferences and such? It seems a much more resource-intensive application than the relatively simpler SquirrelMail, but I haven't done any benchmarks to compare the two. Not sure, but if Horde supports databases then that would be the way to go for storing preferences and such. I don't know about resources comparisons, though. Also, Squirrelmail supports PostgreSQL which might be a better database for performace. Squirrelmail website offers some perfomance tips: http://www.squirrelmail.org/wiki/en_US/SquirrelMailPerformance Basically it boils down to this question of web app scalability and resource needs: can I support a community of (say) 2500 people, where maybe 100 are actively using webmail at any given instant on a box like a Sun Netra running Slowaris with 1GB RAM? Or some 2GHz i86 box with 1GB running FreeBSD? If not, how are you folks worrying the scalability issue? While this isn't specifically a PHP question, I think scalability of PHP applications is germane to the list. I'm not sure how scalability comes into play with PHP. If you have 50 users online and suddenly it doubles up to 100 users, can your network and servers handle the sudden rush? PHP is going to output HTML no matter what. It's the server environment that determines whether it can handle the load. And since you mentioned a load balanced network you're already on the right track. That will solve your scalability issues. Need another server due to the increase of users? Add another web server to the load. Just keep your mail, web and database servers seperate with maybe fiber connections (if possible) between them to reduce latency. Okay...I think that's enough off topic discussions today. :) -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/MySQL based webmail?
On Wednesday 11 August 2004 23:01, Chris Shenton wrote: IMAP doesn't HAVE to be on the same box. You can use SM to connect to an another server running your mail. Yes. But both Squirrel and Horde must speak IMAP to the mail server, whether on localhost or remote. IMAP's nontrivial and introduces more load on the web app server than -- say -- a POP-based mail GUI. Or static web pages. The IMAP server is what takes most CPU cycles. Threading/filtering/sorting the mail also causes huge loads on the server. Another thing to take into account is the underlying filesystem used to store the mail and the mail box format. Eg if using maildir and you're storing a lot of mail then using EXT2/EXT3 filesystems means major bottlenecks. I'm also quite interested in fault-tolerance. I can deploy a couple of physical boxes running SquirrelMail behind load balancers. But Squirrel stores stuff like user address books and preferences on the web server's disk; this obviously won't work in a load balanced arrangement where a client connection is just as likely to go to the other box. Squirrelmail can store user preferences etc on MySQL, and LDAP. While this isn't specifically a PHP question, I think scalability of PHP applications is germane to the list. I think you'll get a more meaningful discussion on the SM list. Also check out the SM wiki which has some tips on speeding up SM. -- 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 -- /* Give them RADAR-GUIDED SKEE-BALL LANES and VELVEETA BURRITOS!! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP logic - Whats going on here?
Wow, Michael. Nice response. -Ed -Original Message- From: Michael Sims [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 11, 2004 9:03 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] PHP logic - Whats going on here? Kim Steinhaug wrote: [snip] For some reason the above results in a blank mail, no $body at all, rest is fine. However, if I include a dummy for if all goes well : if(!$mail-Send()) { echo $lang_error['mailer_error'] . br\n; } else { // Why do I need this one??? } What I dont understand is why do I need the last else statement? You shouldn't. Isnt the result of $mail-Send() completed if I only check for !$mail-Send()? Yes. Maby it would be better to write like this : if(!$mail-Send()) { echo $lang_error['mailer_error'] . br\n; } else if ($mail-Send()){ // Why do I need this one??? } The above would in my belief send two mails, atleast my logic tells me that. I'm not familiary with phpMailer, or exactly how the Send method words, but the code above would end up calling the Send method twice. If the Send method does in fact send (as its name suggests) then you probably don't want to call it twice when you intend to send the message only once. :) [snip] Hope someone understand what Im wondering about here, hehe. In PHP (and every language that I've ever used...) an if statement's expression is evaluated regardless of whether there is an else portion, or an elseif, etc. For example, suppose we have a function foo() that is evaluated primarily for its side effects, but may return either true or false to indicate if the function was successful. This: if (foo()) { print foo() was successful!\n; } is functionally equivalent to this: if (foo()) { print foo() was successful!\n; } else { } The null else clause should have no effect whatsoever on the execution of the script. In fact, the following code snippets are all functionally identical: //Version one foo(); //Version two if (foo()) { } //Version three if (!foo()) { } else { } In all three cases foo() is evaluated just once. Something else you should be aware of: When the expression in the if statement is a compound expression (it contains multiple expressions), then the PHP parser uses lazy or short-circuit evaluation. This means that the parser only evaluates the portions of the expression that are necessary to calculate the result of the entire expression. An example: if (foo() bar()) { //Do stuff } In the above example, foo() is evaluated first. If foo() returns false, bar() is not evaluated at all. The reason is that no matter what bar()'s return value is, the entire expression can only be false. Since the parser has already determined the final result, it has no need to evaluate any further terms. Similarly: if (foo() || bar()) { //Do stuff } In this example, bar() will not be evaluated if foo() returns true, but will be if foo() returns false. These are obviously simple examples, but basically the parser only evaluates the terms that are necessary and doesn't go any further. This can be used as a type of flow control to have certain functions/methods called only if another returned true or false. For example, the following two code snippets are functionally identical: //Version one if (foo()) { bar(); } //Version two if (foo() bar()) { } As far as your specific problem, I suspect that there are factors at play that you are not aware of. Either you have run across a bug in the PHP parser itself (unlikely), or you are inadvertently making other changes when you add the else clause. I would suggest using basic debugging techniques to echo/print the contents of the body string at various points to see what it contains. You may need to drill down into the actual source code for the Send() method to see what it things the body string is. If something is happening to this value this approach should reveal where it's occuring. HTH... -- 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] Mailinglists are honey for Spammers
-Original Message- SPAM wrote: Currently i'm working on a php script You forgot the part where you ACTUALLY ASK A QUESTION... Hehe I wonder if this is covered in the Newbie Guide -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO Question for PHP4
On Wed, 11 Aug 2004 09:14:08 -0600, Jed R. Brubaker [EMAIL PROTECTED] wrote: Hi all. As the subject suggests, I am using PHP4 and am having something going on that I don't think should be. Presume the following code class Foo { function Foo () { return Bar; You shouldn't be returning from a constructor. } } $foo = new Foo; echo $foo; It's generally bad prcative to echo anything other than scalar types (strings and numbers). Try using print_r() or var_dump() instead. $foo comes out as an object. Does this have to be done in two line like this?: class Foo { function bar () { return Bar; } } $foo = new Foo; $bar = $foo-bar; Yes, this has to be two lines. I'm not sure how you'd want to put this as one. In addition, you should have parenthesis on your funciton call: $bar = $foo-bar(); Or is there a better design approach I should be reminded of or learn? -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Date and time
There was a little mistake in the code I posted before, try this one: http://aidan.dotgeek.org/lib/?file=function.convert_timestamp.php Diff Fannehh [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I have this date in timestamp format: $a= 20040810114155; I want to add 7 days to this date. How can i do that? Thanks Isn't it considered faster to let the database do the conversion to Unix Timestamp? -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/MySQL based webmail?
On Wed, 11 Aug 2004 10:15:00 -0700 (PDT), Matthew Sims [EMAIL PROTECTED] wrote: [snip] Yes. But both Squirrel and Horde must speak IMAP to the mail server, whether on localhost or remote. IMAP's nontrivial and introduces more load on the web app server than -- say -- a POP-based mail GUI. Or static web pages. There's a difference between what POP and IMAP does. Basically, do you want your users to view mail from one computer only (laptops, desktops) with no worries about disk space or from any computer (terminals all around the area) with email stored on the mail server. http://www.cit.cornell.edu/computer/email/imap-pop.html [snip] Quick comment. POP does not *have* to download the messages locally *only*. It can also leave the messages on the server, behaving much like IMAP. Of course, POP by default will not leave the message on the server and it much more lightweight (less features) than IMAP. It all depends on what you and your app need. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] updating a frame from within php...
On Wed, 2004-08-11 at 00:13, Matthew Sims wrote: hi... this probably doens't belong here.. but i'll try! i have a two frame window. when the user logs into the 'main' window, i want to be able to 'update' the 'main' window and then hte 'nav' window. some underlying vars are getting set, and i need to be be able to refresh elements/links in the 'nav' window with the new values... searching through google, hasn't really shed any insight/light on the best approach for this.. any ideas/pointers/comments/thoughts... thanks -bruce I think javascript would be your cup of tea...getting the browser to reload a frame. Google is your friend: http://www.google.com/search?q=javascript%20reload%20framehl=enlr=ie=UTF-8sa=Ntab=gw Have been trying to find a way to do this myself. One idea I had to do this from within PHP was to define the nav frame as a function which would be called based on the actions in the main window. The nav frame function would use the target elements to send their output to the correct frame. Have not tried this yet so I am not sure that would work. Have not been able to think of any other way to do it from PHP. -- Scot L. Harris [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirecting to another frame using php header function
hi... can anyone point me to a way to do a page redirect using the php 'Header' function to another frame. I have a page in one frame, when the user does a submit, i want to have the app do a redirect using the 'Header' function, with the subsequent page being displayed in another frame. didn't find anything from google/php.net thanks -bruce Javascript, javascript, javascript. If you want the browser to do something, use client-side instructions. If you want the server to do something, use server-side instructions. A header simply sends, well, HTTP headers. You're asking the browser to reload a frame which is different. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/MySQL based webmail?
On Wed, 2004-08-11 at 10:38, Justin Patrin wrote: On Wed, 11 Aug 2004 10:15:00 -0700 (PDT), Matthew Sims [EMAIL PROTECTED] wrote: [snip] Yes. But both Squirrel and Horde must speak IMAP to the mail server, whether on localhost or remote. IMAP's nontrivial and introduces more load on the web app server than -- say -- a POP-based mail GUI. Or static web pages. There's a difference between what POP and IMAP does. Basically, do you want your users to view mail from one computer only (laptops, desktops) with no worries about disk space or from any computer (terminals all around the area) with email stored on the mail server. http://www.cit.cornell.edu/computer/email/imap-pop.html [snip] Quick comment. POP does not *have* to download the messages locally *only*. It can also leave the messages on the server, behaving much like IMAP. Of course, POP by default will not leave the message on the server and it much more lightweight (less features) than IMAP. It all depends on what you and your app need. POP does not have folders. So, aside from that it stores messages on a server it is nothing like IMAP. With IMAP, you can use any IMAP client and see your folder/message structure the same way, where as with POP, you get an INBOX and cannot store your SENT, etc messages on the server unless you CC/BCC yourself. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / signature.asc Description: This is a digitally signed message part
[PHP] Adjust two or more mysql rows ?
Hi List, I have a qty posted via a form field, lets say 46. In my mysql table I have two rows which I want to reduce their qty fields. 1 row has a qty of say 13 and the second has a qty of 50, making 63 in total. So I would like to say something like if $_POST[qty] is greater than row 1's qty then update row[qty] = 0, then minus what was the row qty, 13 , from $_POST[qty] to new var say $newqty = $_POST[qty]-$row[qty], this leaves 37. Then from the 2nd row take 37 from its qty of 50 leaving 13. End result being row 1's qty field = 0 and row 2's qty field = 13. I hope this is not as clear as mud and if you need further clarity to be able to advise me then I will be happy to correspond. I thank you fully in advance for any help, logic pointers or nuggets of wisdom. Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adjust two or more mysql rows ?
Yup, confused me... what is it for? J Dave Carrera [EMAIL PROTECTED] wrote: Hi List, I have a qty posted via a form field, lets say 46. In my mysql table I have two rows which I want to reduce their qty fields. 1 row has a qty of say 13 and the second has a qty of 50, making 63 in total. So I would like to say something like if $_POST[qty] is greater than row 1's qty then update row[qty] = 0, then minus what was the row qty, 13 , from $_POST[qty] to new var say $newqty = $_POST[qty]-$row[qty], this leaves 37. Then from the 2nd row take 37 from its qty of 50 leaving 13. End result being row 1's qty field = 0 and row 2's qty field = 13. I hope this is not as clear as mud and if you need further clarity to be able to advise me then I will be happy to correspond. I thank you fully in advance for any help, logic pointers or nuggets of wisdom. Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 -- 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] updating a frame from within php...
On Wed, 2004-08-11 at 00:13, Matthew Sims wrote: hi... this probably doens't belong here.. but i'll try! i have a two frame window. when the user logs into the 'main' window, i want to be able to 'update' the 'main' window and then hte 'nav' window. some underlying vars are getting set, and i need to be be able to refresh elements/links in the 'nav' window with the new values... searching through google, hasn't really shed any insight/light on the best approach for this.. any ideas/pointers/comments/thoughts... thanks -bruce I think javascript would be your cup of tea...getting the browser to reload a frame. Google is your friend: http://www.google.com/search?q=javascript%20reload%20framehl=enlr=ie=UTF-8sa=Ntab=gw Have been trying to find a way to do this myself. One idea I had to do this from within PHP was to define the nav frame as a function which would be called based on the actions in the main window. The nav frame function would use the target elements to send their output to the correct frame. Have not tried this yet so I am not sure that would work. Have not been able to think of any other way to do it from PHP. -- Scot L. Harris [EMAIL PROTECTED] The problem with this is that once the PHP code has been executed...it's done! No more code will run until the webpage is refreshed/submitted/reloaded/whatever. You can't have PHP force a reload of a particular frame. It's all or nothing. PHP doesn't understand frames. It simply takes in variables, does its little shindig, spits out HTML and then it goes asleep. Any events that happen within the browser can only be accompanied by client-side instruction code. When you click the submit button in that one frame, only that frame will reload. PHP will view the two frames as two seperate web browsers with no correlation between them. I've created the exact same thing with what you're describing at my work. The login is in the left frame and when someone logs in, all my variables are stored in $_SESSION vars and I use javascript to reload the right frame by way of body onLoad=parent.right.location.reload(). Now both frames have access to the $_SESSION vars. If you want to make this work with with PHP, remove the frames and simply use the form submit to reload the same page. -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] updating a frame from within php...
Scot L. Harris wrote: snip Have been trying to find a way to do this myself. One idea I had to do this from within PHP was to define the nav frame as a function which would be called based on the actions in the main window. The nav frame function would use the target elements to send their output to the correct frame. Have not tried this yet so I am not sure that would work. Have not been able to think of any other way to do it from PHP. /snip There is *no* way to do this from PHP. When you want to do things like open a new window, target a frame, etc., it's all done via the browser and the DOM. PHP does not have access to the client side. The best you can hope to do is have php output some JavaScript to make the client act as you wish. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Adjust two or more mysql rows ?
I am deving a goods in system that REQUIRES that each delivery of items be entered into raw stock separately. This is why two rows in the table have identical details like, Supplier Product name But the qtys may be diff. Ect ect Now the PREPARATION dept need to internally order the RAW STOCK to make the final items for sale. SO they order from RAW STOCK items they want and this is where the RAW stock reductions come in. To keep it simple, I group the identical items available to the PREP team showing only the total in raw stock. They enter what they need and this is where I want to reduce the raw stock until I have reached the total ordered by the PREP team. I am having a look at array_walk to see if that can help but ask yourself or the list if you have any ideas how I can step through each returned row adjusting the qty level until I reach 0 which the posted value. I hope that helps Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com -Original Message- From: Jason Davidson [mailto:[EMAIL PROTECTED] Sent: 11 August 2004 19:00 To: Dave Carrera; [EMAIL PROTECTED] Subject: Re: [PHP] Adjust two or more mysql rows ? Yup, confused me... what is it for? J Dave Carrera [EMAIL PROTECTED] wrote: Hi List, I have a qty posted via a form field, lets say 46. In my mysql table I have two rows which I want to reduce their qty fields. 1 row has a qty of say 13 and the second has a qty of 50, making 63 in total. So I would like to say something like if $_POST[qty] is greater than row 1's qty then update row[qty] = 0, then minus what was the row qty, 13 , from $_POST[qty] to new var say $newqty = $_POST[qty]-$row[qty], this leaves 37. Then from the 2nd row take 37 from its qty of 50 leaving 13. End result being row 1's qty field = 0 and row 2's qty field = 13. I hope this is not as clear as mud and if you need further clarity to be able to advise me then I will be happy to correspond. I thank you fully in advance for any help, logic pointers or nuggets of wisdom. Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adjust two or more mysql rows ?
Dave Carrera wrote: I have a qty posted via a form field, lets say 46. In my mysql table I have two rows which I want to reduce their qty fields. 1 row has a qty of say 13 and the second has a qty of 50, making 63 in total. So I would like to say something like if $_POST[qty] is greater than row 1's qty then update row[qty] = 0, then minus what was the row qty, 13 , from $_POST[qty] to new var say $newqty = $_POST[qty]-$row[qty], this leaves 37. Then from the 2nd row take 37 from its qty of 50 leaving 13. End result being row 1's qty field = 0 and row 2's qty field = 13. I think you have a seriously flawed database structure. There is no row 1 in a database, you know that, right? Pretty sure you can do what you're after, though, you'll just have to involve about four different queries and some PHP magic in the middle... -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] updating a frame from within php...
Have been trying to find a way to do this myself. One idea I had to do this from within PHP was to define the nav frame as a function which would be called based on the actions in the main window. The nav frame function would use the target elements to send their output to the correct frame. Have not tried this yet so I am not sure that would work. Have not been able to think of any other way to do it from PHP. In case it helps, think of PHP as server-side only. PHP processes scripts and outputs a web page that gets sent to the client / browser. Any activity occuring on the client/browser side needs to be handled by something like Javascript. Do a google on javascript frame reload and you'll see several examples of how to do this. -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Adjust two or more mysql rows ?
I don't think you can have a single mysql query do what you're wanting. Break it into mutiple queries. -Original Message- Hi List, I have a qty posted via a form field, lets say 46. In my mysql table I have two rows which I want to reduce their qty fields. 1 row has a qty of say 13 and the second has a qty of 50, making 63 in total. So I would like to say something like if $_POST[qty] is greater than row 1's qty then update row[qty] = 0, then minus what was the row qty, 13 , from $_POST[qty] to new var say $newqty = $_POST[qty]-$row[qty], this leaves 37. Then from the 2nd row take 37 from its qty of 50 leaving 13. End result being row 1's qty field = 0 and row 2's qty field = 13. I hope this is not as clear as mud and if you need further clarity to be able to advise me then I will be happy to correspond. I thank you fully in advance for any help, logic pointers or nuggets of wisdom. Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 -- 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] Adjust two or more mysql rows ?
I think John's right. Your schema sounds like it needs some serious work, especially if you're storing identical details with every single transaction. Go back and study relational database basics before trying to create an inventory management system or you'll end up in a world of hurt. -Ed -Original Message- From: Dave Carrera [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 11, 2004 11:14 AM To: 'Jason Davidson' Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Adjust two or more mysql rows ? I am deving a goods in system that REQUIRES that each delivery of items be entered into raw stock separately. This is why two rows in the table have identical details like, Supplier Product name But the qtys may be diff. Ect ect Now the PREPARATION dept need to internally order the RAW STOCK to make the final items for sale. SO they order from RAW STOCK items they want and this is where the RAW stock reductions come in. To keep it simple, I group the identical items available to the PREP team showing only the total in raw stock. They enter what they need and this is where I want to reduce the raw stock until I have reached the total ordered by the PREP team. I am having a look at array_walk to see if that can help but ask yourself or the list if you have any ideas how I can step through each returned row adjusting the qty level until I reach 0 which the posted value. I hope that helps Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com -Original Message- From: Jason Davidson [mailto:[EMAIL PROTECTED] Sent: 11 August 2004 19:00 To: Dave Carrera; [EMAIL PROTECTED] Subject: Re: [PHP] Adjust two or more mysql rows ? Yup, confused me... what is it for? J Dave Carrera [EMAIL PROTECTED] wrote: Hi List, I have a qty posted via a form field, lets say 46. In my mysql table I have two rows which I want to reduce their qty fields. 1 row has a qty of say 13 and the second has a qty of 50, making 63 in total. So I would like to say something like if $_POST[qty] is greater than row 1's qty then update row[qty] = 0, then minus what was the row qty, 13 , from $_POST[qty] to new var say $newqty = $_POST[qty]-$row[qty], this leaves 37. Then from the 2nd row take 37 from its qty of 50 leaving 13. End result being row 1's qty field = 0 and row 2's qty field = 13. I hope this is not as clear as mud and if you need further clarity to be able to advise me then I will be happy to correspond. I thank you fully in advance for any help, logic pointers or nuggets of wisdom. Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 -- 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] Adjust two or more mysql rows ?
Dave Carrera wrote: I am deving a goods in system that REQUIRES that each delivery of items be entered into raw stock separately. This is why two rows in the table have identical details like, Supplier Product name But the qtys may be diff. Ect ect Now the PREPARATION dept need to internally order the RAW STOCK to make the final items for sale. SO they order from RAW STOCK items they want and this is where the RAW stock reductions come in. Do they need to know that when they order 20 widgets, that 10 came from the shipment on Tuesday and 10 came from the shipment on Monday? And that the Monday shipment is all used up? You could still use a better database structure, I think, but something along these lines may work. $qty = $_POST['quantity']; $query = SELECT shipment_id, quantity FROM shipments WHERE product_id = 'XXX' AND quantity 0 ORDER BY shipment_date ASC; $result = mysql_query($query) or die(mysql_error()); while($qty 0 $row = mysql_fetch_assoc($result)) { if($qty $row['quantity']) { $qty = $qty - $row['quantity']; $query = UPDATE shipments SET quantity = 0 WHERE shipment_id = {$row['shipment_id'] AND product_id = 'XXX'; } else { $r = $row['quantity'] - $qty; $qty = 0; $query = UPDATE shipments SET quantity = {$r} WHERE shipment_id = {$row['shipment_id'] AND product_id = 'XXX'; } $result2 = mysql_query($query) or die(mysql_error()); } You'll have to grab what shipments or other information you want as you loop through the results, of course. I'd recommend you use InnoDB tables so you can wrap the whole thing in a transaction, also (or use a database abstraction layer that simulates transactions). -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] updating a frame from within php...
in the event the user disbales j'script, i'm looking for an alternative... in my case, it should be pretty easy, because i'm looking to reload the entire page into the _top/parent frame/window. however, when i send the header, it gets interpreted as reloading in the same frame. which is not what i want to occur!!! i've seen some references to meta-tag attributes within the HEADER that alude to being able to specify the target window for the content... regards. -Original Message- From: Ed Lazor [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 11, 2004 11:23 AM To: 'Scot L. Harris'; [EMAIL PROTECTED] Subject: RE: [PHP] updating a frame from within php... Have been trying to find a way to do this myself. One idea I had to do this from within PHP was to define the nav frame as a function which would be called based on the actions in the main window. The nav frame function would use the target elements to send their output to the correct frame. Have not tried this yet so I am not sure that would work. Have not been able to think of any other way to do it from PHP. In case it helps, think of PHP as server-side only. PHP processes scripts and outputs a web page that gets sent to the client / browser. Any activity occuring on the client/browser side needs to be handled by something like Javascript. Do a google on javascript frame reload and you'll see several examples of how to do this. -Ed -- 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 logic - Whats going on here?
On Thursday 12 August 2004 01:26, Ed Lazor wrote: Wow, Michael. Nice response. Could we please trim our posts? Thank you. -- 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 -- /* Good day to let down old friends who need help. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Adjust two or more mysql rows ?
Sort of... Here is a sort of layout of my table data: Id | prodname | qty | datein 1 toy1332004-08-11 13:41:26 2 toy2122004-08-11 14:41:26 3 toy1162004-08-11 15:41:26 4 toy3222004-08-11 16:41:26 This is what I mean by rows, maybe wrong terminology... So as you can see two rows have a qty 0 and prodname is the same (toy1) It is reducing their qtys where datein is oldest from now() is what I am trying to do. I am trying something now sort of like this: $val = $_POST[qty] // equals 53 Select from table where prodanme=$_POST[pname] and qty 0 order by datein desc $row = mysql_fetch_array($sql); // this gives me the oldest row with whers satisfied Now compare $row[qty] with $val If its = $row[qty] then update row with row[qty]-$val; exit; Else if $val $row[qty] then $newval = $val-$row[qty]; Update the current $row[qty] to 0 then run the sql again as it will get the row which has a qty value Keep going til $newval = 0 exit. Probably wont work as I have it laid out here but I think the basic logic is ok. Hers goes :-) Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com -Original Message- From: Jason Davidson [mailto:[EMAIL PROTECTED] Sent: 11 August 2004 19:26 To: Dave Carrera Subject: RE: [PHP] Adjust two or more mysql rows ? ok, i understand better, so you have a good idea of what your doing by looks of it, i guess your trying to get some opinionis on the best way of doing this? so, to make your query and logic easier, how about making your row1 column type an unsigned int, then it cant go below zero, and you can just minus the qty right in the update query, then you can do something like.. UPDATE goods SET row1 = (row1-$qty), row2 = .. likely will have to use some logic to extrapolate some of your values..does this help at all... Jason Dave Carrera [EMAIL PROTECTED] wrote: I am deving a goods in system that REQUIRES that each delivery of items be entered into raw stock separately. This is why two rows in the table have identical details like, Supplier Product name But the qtys may be diff. Ect ect Now the PREPARATION dept need to internally order the RAW STOCK to make the final items for sale. SO they order from RAW STOCK items they want and this is where the RAW stock reductions come in. To keep it simple, I group the identical items available to the PREP team showing only the total in raw stock. They enter what they need and this is where I want to reduce the raw stock until I have reached the total ordered by the PREP team. I am having a look at array_walk to see if that can help but ask yourself or the list if you have any ideas how I can step through each returned row adjusting the qty level until I reach 0 which the posted value. I hope that helps Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com -Original Message- From: Jason Davidson [mailto:[EMAIL PROTECTED] Sent: 11 August 2004 19:00 To: Dave Carrera; [EMAIL PROTECTED] Subject: Re: [PHP] Adjust two or more mysql rows ? Yup, confused me... what is it for? J Dave Carrera [EMAIL PROTECTED] wrote: Hi List, I have a qty posted via a form field, lets say 46. In my mysql table I have two rows which I want to reduce their qty fields. 1 row has a qty of say 13 and the second has a qty of 50, making 63 in total. So I would like to say something like if $_POST[qty] is greater than row 1's qty then update row[qty] = 0, then minus what was the row qty, 13 , from $_POST[qty] to new var say $newqty = $_POST[qty]-$row[qty], this leaves 37. Then from the 2nd row take 37 from its qty of 50 leaving 13. End result being row 1's qty field = 0 and row 2's qty field = 13. I hope this is not as clear as mud and if you need further clarity to be able to advise me then I will be happy to correspond. I thank you fully in advance for any help, logic pointers or nuggets of wisdom. Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 --- Outgoing mail is certified Virus
RE: [PHP] Adjust two or more mysql rows ?
Multiple queries are going to be in order as mentioend i beleive, also, as mentioned, you may want to put some relational db design into practice here, im not sure how big your table is going to be, but its going to have a lot of same data in it.. how about table products id INT AUTO_INCREMENT NOT NULL, name VARCHAR(100) NOT NULL, datein DATETIME NOT NULL table stock product_id INT NOT NULL raw_stock UNSIGNED INT NOT NULL, other_stock UNSIGNED INT NOT NULL, jason Dave Carrera [EMAIL PROTECTED] wrote: Sort of... Here is a sort of layout of my table data: Id | prodname | qty | datein 1 toy1332004-08-11 13:41:26 2 toy2122004-08-11 14:41:26 3 toy1162004-08-11 15:41:26 4 toy3222004-08-11 16:41:26 This is what I mean by rows, maybe wrong terminology... So as you can see two rows have a qty 0 and prodname is the same (toy1) It is reducing their qtys where datein is oldest from now() is what I am trying to do. I am trying something now sort of like this: $val = $_POST[qty] // equals 53 Select from table where prodanme=$_POST[pname] and qty 0 order by datein desc $row = mysql_fetch_array($sql); // this gives me the oldest row with whers satisfied Now compare $row[qty] with $val If its = $row[qty] then update row with row[qty]-$val; exit; Else if $val $row[qty] then $newval = $val-$row[qty]; Update the current $row[qty] to 0 then run the sql again as it will get the row which has a qty value Keep going til $newval = 0 exit. Probably wont work as I have it laid out here but I think the basic logic is ok. Hers goes :-) Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com -Original Message- From: Jason Davidson [mailto:[EMAIL PROTECTED] Sent: 11 August 2004 19:26 To: Dave Carrera Subject: RE: [PHP] Adjust two or more mysql rows ? ok, i understand better, so you have a good idea of what your doing by looks of it, i guess your trying to get some opinionis on the best way of doing this? so, to make your query and logic easier, how about making your row1 column type an unsigned int, then it cant go below zero, and you can just minus the qty right in the update query, then you can do something like.. UPDATE goods SET row1 = (row1-$qty), row2 = .. likely will have to use some logic to extrapolate some of your values..does this help at all... Jason Dave Carrera [EMAIL PROTECTED] wrote: I am deving a goods in system that REQUIRES that each delivery of items be entered into raw stock separately. This is why two rows in the table have identical details like, Supplier Product name But the qtys may be diff. Ect ect Now the PREPARATION dept need to internally order the RAW STOCK to make the final items for sale. SO they order from RAW STOCK items they want and this is where the RAW stock reductions come in. To keep it simple, I group the identical items available to the PREP team showing only the total in raw stock. They enter what they need and this is where I want to reduce the raw stock until I have reached the total ordered by the PREP team. I am having a look at array_walk to see if that can help but ask yourself or the list if you have any ideas how I can step through each returned row adjusting the qty level until I reach 0 which the posted value. I hope that helps Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com -Original Message- From: Jason Davidson [mailto:[EMAIL PROTECTED] Sent: 11 August 2004 19:00 To: Dave Carrera; [EMAIL PROTECTED] Subject: Re: [PHP] Adjust two or more mysql rows ? Yup, confused me... what is it for? J Dave Carrera [EMAIL PROTECTED] wrote: Hi List, I have a qty posted via a form field, lets say 46. In my mysql table I have two rows which I want to reduce their qty fields. 1 row has a qty of say 13 and the second has a qty of 50, making 63 in total. So I would like to say something like if $_POST[qty] is greater than row 1's qty then update row[qty] = 0, then minus what was the row qty, 13 , from $_POST[qty] to new var say $newqty = $_POST[qty]-$row[qty], this leaves 37. Then from the 2nd row take 37 from its qty of 50 leaving 13. End result being row 1's qty field = 0 and row 2's qty field = 13. I hope this is not as clear as mud and if you need further clarity to be able to advise me then I will be happy to correspond. I thank you fully in advance for any help, logic pointers or nuggets of wisdom. Dave Carrera -- UK Web Hosting @ http://www.ephgroup.com --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.736 / Virus Database: 490 - Release Date: 09/08/2004 -- PHP
RE: [PHP] updating a frame from within php...
-Original Message- in the event the user disbales j'script, i'm looking for an alternative... There is none. Assuming the client has disabled everything on their end means you only have HTML to work with in presenting content. Are you understanding this concept? Btw, I forgot to mention that using frames is basically a bad idea. Search engines don't handle sites that use frames as well. Plus, you run into problems when giving people the URL to a specific page; it becomes necessary to use javascript to force the reload of the page inside the frame or you end up having to use a modified URL of some sort. For example http://www.mysite.com/fiction/story1.php It sounds like you're trying to use frames to save from having to put the same header or menu on every page. Is this true? If so, have you considered creating separate files and using PHP's include command? -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP logic - Whats going on here?
-Original Message- Wow, Michael. Nice response. Could we please trim our posts? Thank you. Sorry. Thought I'd sent it to him only. -Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] updating a frame from within php...
bruce wrote: in the event the user disbales j'script, i'm looking for an alternative... in my case, it should be pretty easy, because i'm looking to reload the entire page into the _top/parent frame/window. however, when i send the header, it gets interpreted as reloading in the same frame. which is not what i want to occur!!! i've seen some references to meta-tag attributes within the HEADER that alude to being able to specify the target window for the content... snip It *CANNOT* be done with php. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] updating a frame from within php...
in the event the user disbales j'script, i'm looking for an alternative... You can't substitute PHP for javascript. Their functionalities are completely different. in my case, it should be pretty easy, because i'm looking to reload the entire page into the _top/parent frame/window. however, when i send the header, it gets interpreted as reloading in the same frame. which is not what i want to occur!!! Because that's exactly the way PHP operates. It sees your frame as one web browser. The other frame is another browser. If you want one frame to reload another frame, you HAVE to use javascript. i've seen some references to meta-tag attributes within the HEADER that alude to being able to specify the target window for the content... PHP does not know what a target is. It may display the target, but that's all it'll do. Javascript keeps track of targets and elements because the code is working within the browser. Picture javascript as a user sitting in front of a web browser who has the ability to click on buttons, reload any frame and enter text into forms. Now picture PHP as the guy to writes the HTML and sends it to the browser and stands there waiting for a request to send more HTML to the browser. Frame? I don't know where this frame is. You'll have to ask the javascript guy where that is. (that's my bad rendition of PHP guy talking) -- --Matthew Sims --http://killermookie.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Creating plotted graphs on the fly
Hi, I wanted to know if there is way with PHP to take a bunch of data points and create a plotted graph image (jpg, gif or png). The data points would be inputed into a web form and then the data points would be plotted on a graph once the user submitted the information. Any help would be appreciated. Thank you, Ryan Spaulding -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Creating plotted graphs on the fly
[snip] I wanted to know if there is way with PHP to take a bunch of data points and create a plotted graph image (jpg, gif or png). The data points would be inputed into a web form and then the data points would be plotted on a graph once the user submitted the information. [/snip] http://www.aditus.nu/jpgraph/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with mysql_fetch_array
i am trying to print some values from a table with using mysql_fetch_array in a loop but not able to get correct values. it works fine for the loop i=0, prints all desired values but when it bocomes i=1 and starts the loop again the result values gets reset and prints the same old values. for example: outout of the query is result 1 result 2 result 3 result 4 result 5 result 6 result 7 result 8 result 9 result 10 result 11 result 12 :when i=0, it runs through the loop and prints result 1 result 2 result 3 result 4 result 5 result 6 :which is perfect. :but when i=1, it prints the same values, result 1 result 2 result 3 result 4 result 5 result 6 why is that so? can anyone help me? thanks in advance. $query4 = mysql_query(SELECT result FROM TBL_result WHERE survey_no=2; for($i=0; $i 2; ++$i)//surveys { for($j=0; $j 2; ++$j)//questions { for ($k=0; $k 3; ++$k)//sub-quesions { $row2 = mysql_fetch_array($query4); //Printing all result values one by one } } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with mysql_fetch_array
On Wed, 11 Aug 2004 17:13:49 -0400, Deepak Dhake [EMAIL PROTECTED] wrote: i am trying to print some values from a table with using mysql_fetch_array in a loop but not able to get correct values. it works fine for the loop i=0, prints all desired values but when it bocomes i=1 and starts the loop again the result values gets reset and prints the same old values. for example: outout of the query is result 1 result 2 result 3 result 4 result 5 result 6 result 7 result 8 result 9 result 10 result 11 result 12 :when i=0, it runs through the loop and prints result 1 result 2 result 3 result 4 result 5 result 6 :which is perfect. :but when i=1, it prints the same values, result 1 result 2 result 3 result 4 result 5 result 6 why is that so? can anyone help me? thanks in advance. $query4 = mysql_query(SELECT result FROM TBL_result WHERE survey_no=2; for($i=0; $i 2; ++$i)//surveys { for($j=0; $j 2; ++$j)//questions { for ($k=0; $k 3; ++$k)//sub-quesions { $row2 = mysql_fetch_array($query4); //Printing all result values one by one } } } I'm not sure what you think this should do, but you're assuming that 2 * 2 * 3 (12) records will be returned, no more, no less. I doubt this is the case. Normally, such things are done like this: $query4 = mysql_query(SELECT result FROM TBL_result WHERE survey_no=2; while($row2 = mysql_fetch_array($query4)) { //print array } If this isn't what you want, perhaps you should be doing 3 seperate queries in there? Please explain why you have 3 for loops around your fetch; -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload Problems
(Sorry if this is a repost, had some problems with my news client not sending properly) Thanks for the pointers Raditha, unfortunately I still can't get it working. I have been banging away at this for a few days now, and I currently have the following my script: ini_set(max_execution_time, 600); ini_set(max_input_time, 600); also tried set_time_limit(600) The following displaying in phpinfo(): upload_max_filesize 2M post_max_size 8M memory limit 8M and in an .htaccess file in the directory. LimitRequestBody 200 httpd.conf does not have LimitRequestBody set. I either get a white screen with no errors displayed or a 404 page and really cannot work out what is going on. Does anybody have any other ideas as to where I may have gone wrong ? [EMAIL PROTECTED] [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]: Mark Collin wrote: I'm having problems with my file upload code. If I start to upload files larger than a approx 400k the page seems to time out and I get a page cannot be displayed error. I have checked the php.ini on the server and max file size is 2Mb and max Post size is 8Mb. This is typical of the default setting for LimitRequestBody directive of apache - which is set to 512kb please look at your httpd.conf file and see if this is set - just deleting that line would do. If it still does not work you might find this link usefull http://www.radinks.com/upload/config.php - it shows how to configure php for handling large uploads. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] learning to right objects
I am trying to change some of my functions in to classes and objects. I have been checking out the php.net and google and still not grasping the concept. here is my example all I am trying to do is print 2 numbers to the browser that are randomly generated from dieRolls. Thanks in advance -Blake class dieRolls{ function dieRolls($die){ $num = rand(1, $die); $this-num; } } $num1 = new dieRolls(6); $num2 = new dieRolls(8); $bar1 = $num1-bar1; $bar2 = $num2-bar2; echoHibr\n; echo$bar1br\n; echo$bar2br\n; -- +-+-++ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/ \--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File Upload Problems
On 11 Aug 2004 21:30:38 -, Mark Collin [EMAIL PROTECTED] wrote: (Sorry if this is a repost, had some problems with my news client not sending properly) Thanks for the pointers Raditha, unfortunately I still can't get it working. I have been banging away at this for a few days now, and I currently have the following my script: ini_set(max_execution_time, 600); ini_set(max_input_time, 600); also tried set_time_limit(600) The following displaying in phpinfo(): upload_max_filesize 2M post_max_size 8M memory limit 8M and in an .htaccess file in the directory. LimitRequestBody 200 httpd.conf does not have LimitRequestBody set. I either get a white screen with no errors displayed or a 404 page and really cannot work out what is going on. Does anybody have any other ideas as to where I may have gone wrong ? [EMAIL PROTECTED] [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]: Mark Collin wrote: I'm having problems with my file upload code. If I start to upload files larger than a approx 400k the page seems to time out and I get a page cannot be displayed error. I have checked the php.ini on the server and max file size is 2Mb and max Post size is 8Mb. This is typical of the default setting for LimitRequestBody directive of apache - which is set to 512kb please look at your httpd.conf file and see if this is set - just deleting that line would do. If it still does not work you might find this link usefull http://www.radinks.com/upload/config.php - it shows how to configure php for handling large uploads. 1) Have you checked the temp dir where these files are uploaded? Is it perhaps full? 2) Are the images you're uploading the right format? GD can't read non-RGB jpegs, for instance. 3) Are the file names strange at all? Filenames with spaces or special / international chars can cause problems. 4) Have you checked memory usage while the script is running? If you're in Linux, use top on the command-line. 5) Have you checked the Apache logs? Specifically, look int he error log for crashes. If it's crashing, you've probably hit your memory limit or a bug in PHP or GD. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] learning to right objects
On Wed, 11 Aug 2004 16:35:33 -0500, Blake Schroeder [EMAIL PROTECTED] wrote: I am trying to change some of my functions in to classes and objects. I have been checking out the php.net and google and still not grasping the concept. here is my example all I am trying to do is print 2 numbers to the browser that are randomly generated from dieRolls. Thanks in advance -Blake class dieRolls{ function dieRolls($die){ $num = rand(1, $die); You're storing this value in a local var, not an object property. Try: $this-num = rand(1, $die); $this-num; This does nothing as $this-num is not set (see above) and you're not *doing* anything with it. } } $num1 = new dieRolls(6); $num2 = new dieRolls(8); $bar1 = $num1-bar1; $bar2 = $num2-bar2; I don't know what you think these two lines are doing. You never set bar1 or bar2, so you'r enot going to get anything. echoHibr\n; echo$bar1br\n; echo$bar2br\n; I would suggest using this (after fixing the first problem I pointed out): echo $num1-num.br/\n; echo $num2-num.br/\n; -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] learning to right objects
Justin Thank you now I have a working example to go from. Justin Patrin wrote: On Wed, 11 Aug 2004 16:35:33 -0500, Blake Schroeder [EMAIL PROTECTED] wrote: I am trying to change some of my functions in to classes and objects. I have been checking out the php.net and google and still not grasping the concept. here is my example all I am trying to do is print 2 numbers to the browser that are randomly generated from dieRolls. Thanks in advance -Blake class dieRolls{ function dieRolls($die){ $num = rand(1, $die); You're storing this value in a local var, not an object property. Try: $this-num = rand(1, $die); $this-num; This does nothing as $this-num is not set (see above) and you're not *doing* anything with it. } } $num1 = new dieRolls(6); $num2 = new dieRolls(8); $bar1 = $num1-bar1; $bar2 = $num2-bar2; I don't know what you think these two lines are doing. You never set bar1 or bar2, so you'r enot going to get anything. echoHibr\n; echo$bar1br\n; echo$bar2br\n; I would suggest using this (after fixing the first problem I pointed out): echo $num1-num.br/\n; echo $num2-num.br/\n; -- +-+-++ | Blake Schroeder | Owner/Developer |lhwd.net| +--(http://www.lhwd.net)+--/3174026352\--+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating plotted graphs on the fly
Thank you On Aug 11, 2004, at 1:25 PM, Jay Blanchard wrote: [snip] I wanted to know if there is way with PHP to take a bunch of data points and create a plotted graph image (jpg, gif or png). The data points would be inputed into a web form and then the data points would be plotted on a graph once the user submitted the information. [/snip] http://www.aditus.nu/jpgraph/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] scan a text string to pick up certain words
Hi All, I guess regex can do the trick but I don't know much about regex :(( Here is what I want: Say a text string in which there're several words enclosed by { and }, for example {hellow}. I need to pick up each of the words like this and print them or do some processing one by one. Can any one please show me an example how to do this in PHP. Thanks in advance! Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] scan a text string to pick up certain words
On Wed, 11 Aug 2004 18:07:57 -0400, Alex Shi [EMAIL PROTECTED] wrote: Hi All, I guess regex can do the trick but I don't know much about regex :(( Here is what I want: Say a text string in which there're several words enclosed by { and }, for example {hellow}. I need to pick up each of the words like this and print them or do some processing one by one. Can any one please show me an example how to do this in PHP. Thanks in advance! preg_match_all('/{([^}]*)}/', $text, $matches); print_r($matches[1]); -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: MySQL PHP Examples Training Providers Required
Michael, My company has recently developed a Web site module for a local manufacturing company. The Web site module is a PHP and MySQL application composed of several screens and advanced engineering functionality (graphing, calculations etc). One of the database tables for the application has over 110,000 records. Why I chose to reply to your email is because PHP is not usually used for the development of more complex functionality like the Web site module that we have developed. The module performed well in testing. It has not been released for production yet, so I don't have a good performance report on the production version of the Web site module (with many concurrent users). I could provide you the URL to the Web site when it is released to production. Regards, -- Lukasz Karapuda VP Application Development - newline Creations LLC e-mail: [EMAIL PROTECTED] http://www.thenewline.com -Original Message- From: Harlequin [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 10, 2004 7:07 PM To: [EMAIL PROTECTED] Subject: MySQL PHP Examples Training Providers Required Hi all. This might sound like a strange request but here goes. I'm looking for some examples of sites that are purely MySQL and PHP running on Unix and that contain a few thousand records preferably held in relational databases. Rationale: I need to justify PHP as a tool of choice over say vb.net or Oracle. My recommendation, despite my limited knowledge of MySQL and PHP is that even if we have 10-15 databases holding upwards of 10,000 records each PHP and MySQL are the tools of choice and I doubt that there are any functions missing that you'd find in VB.Net. I could be wrong and if so, please let me know. My other question is that I am looking for training in the UK, preferably in the North. I have no idea about accreditation or certification requirements and wondered if anyone could provide any recommendations...? Thanks for your time guys. -- - Michael Mason Arras People www.arraspeople.co.uk - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Netegrity's siteminder + PHP + Apache
Hello All, Does anyone of any good documentation for compiling Netegrity's Siteminder module with Apache for use in a PHP based application? Thanks. Saqib Ali http://validate.sf.net XHTML/DocBook XML Validator and Transformer
Re: [PHP] RE: MySQL PHP Examples Training Providers Required
On Wed, 11 Aug 2004 18:20:23 -0400, Lukasz Karapuda [EMAIL PROTECTED] wrote: Michael, My company has recently developed a Web site module for a local manufacturing company. The Web site module is a PHP and MySQL application composed of several screens and advanced engineering functionality (graphing, calculations etc). One of the database tables for the application has over 110,000 records. Why I chose to reply to your email is because PHP is not usually used for the development of more complex functionality like the Web site module that we have developed. I beg to differ. Many large and complex sites are written in PHP. There are also many large and complex programs written in PHP which are in production use. Take TYPO3, for example: http://www.typo3.org The module performed well in testing. It has not been released for production yet, so I don't have a good performance report on the production version of the Web site module (with many concurrent users). I could provide you the URL to the Web site when it is released to production. Regards, -- Lukasz Karapuda VP Application Development - newline Creations LLC e-mail: [EMAIL PROTECTED] http://www.thenewline.com -Original Message- From: Harlequin [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 10, 2004 7:07 PM To: [EMAIL PROTECTED] Subject: MySQL PHP Examples Training Providers Required Hi all. This might sound like a strange request but here goes. I'm looking for some examples of sites that are purely MySQL and PHP running on Unix and that contain a few thousand records preferably held in relational databases. Rationale: I need to justify PHP as a tool of choice over say vb.net or Oracle. My recommendation, despite my limited knowledge of MySQL and PHP is that even if we have 10-15 databases holding upwards of 10,000 records each PHP and MySQL are the tools of choice and I doubt that there are any functions missing that you'd find in VB.Net. I could be wrong and if so, please let me know. My other question is that I am looking for training in the UK, preferably in the North. I have no idea about accreditation or certification requirements and wondered if anyone could provide any recommendations...? Thanks for your time guys. -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] scan a text string to pick up certain words
It works the way as supposed :) Thanks! On Wed, 11 Aug 2004 18:07:57 -0400, Alex Shi [EMAIL PROTECTED] wrote: Hi All, I guess regex can do the trick but I don't know much about regex :(( Here is what I want: Say a text string in which there're several words enclosed by { and }, for example {hellow}. I need to pick up each of the words like this and print them or do some processing one by one. Can any one please show me an example how to do this in PHP. Thanks in advance! preg_match_all('/{([^}]*)}/', $text, $matches); print_r($matches[1]); -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Escaping quotes
Hi All, I have this expression; $query = INSERT INTO $table (%s) VALUES (%s); $query = sprintf($query, implode(,, $fld), implode(,, $val)); $result = mssql_query($query) or die($errmsg); I am trying to insert values from an array into the database. I keep getting the error that I can't pass column names in this context. I know it's because I'm not enclosing $val in quotes. I've tried a number of variations; implode(\,\, $val) implode(\',\', $val) implode(,, \.$val.\) - This blows up nicely ;-) Where am I going wrong on this? alex hogan * The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Escaping quotes
On Wed, 11 Aug 2004 19:03:32 -0500, Alex Hogan [EMAIL PROTECTED] wrote: Hi All, I have this expression; $query = INSERT INTO $table (%s) VALUES (%s); $query = sprintf($query, implode(,, $fld), implode(,, $val)); $result = mssql_query($query) or die($errmsg); I am trying to insert values from an array into the database. I keep getting the error that I can't pass column names in this context. I know it's because I'm not enclosing $val in quotes. I've tried a number of variations; implode(\,\, $val) implode(\',\', $val) implode(,, \.$val.\) - This blows up nicely ;-) Where am I going wrong on this? 1) By using implode to do this 2) By not escaping quotes in the data If you look in the PEAR::DB code, here's how they quote field names: function quoteIdentifier($str) { return '[' . str_replace(']', ']]', $str) . ']'; } and here's how they quote values: function quoteSmart($in) { if (is_int($in) || is_double($in)) { return $in; } elseif (is_bool($in)) { return $in ? 1 : 0; } elseif (is_null($in)) { return 'NULL'; } else { return ' . str_replace(', '', $in) . '; } } -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/MySQL based webmail?
Hi Chris, Horde is little bit heavier than Squirrelmail. You can buy a Zend acclerator to speed up the things. I think your community is not that big and Horde works fine in our organization where we have 1000 users and all are pretty active. Look and feel matters in the web mail so before you make any decision then consider this issue as well. Let me know if you need more information about Horde. Thanks, Hardik --- Chris Shenton [EMAIL PROTECTED] wrote: Matthew Sims [EMAIL PROTECTED] writes: Uh, well...Squirrelmail is simply a webpage. The number of simultaneous users is defined by the web server application, aka Apache. Perhaps we view it differently. Apache is a web server. SquirrelMail and Horde are applications, written in PHP. I'm curious about user experiences deploying both, especially in terms of resource consumption and scalability. IMAP doesn't HAVE to be on the same box. You can use SM to connect to an another server running your mail. Yes. But both Squirrel and Horde must speak IMAP to the mail server, whether on localhost or remote. IMAP's nontrivial and introduces more load on the web app server than -- say -- a POP-based mail GUI. Or static web pages. I'm also quite interested in fault-tolerance. I can deploy a couple of physical boxes running SquirrelMail behind load balancers. But Squirrel stores stuff like user address books and preferences on the web server's disk; this obviously won't work in a load balanced arrangement where a client connection is just as likely to go to the other box. I could put the files on a back-end NetApp NFS server like I do for my (balanced) SMTP/IMAP mail servers; this may introduce NFS file locking problems and corruption by simultaneous access to the same NFS-resident file. (My SMTP/IMAP servers use Maildir to avoid NFS problems). Does Horde have these same implementation issues? How does it store preferences and such? It seems a much more resource-intensive application than the relatively simpler SquirrelMail, but I haven't done any benchmarks to compare the two. Basically it boils down to this question of web app scalability and resource needs: can I support a community of (say) 2500 people, where maybe 100 are actively using webmail at any given instant on a box like a Sun Netra running Slowaris with 1GB RAM? Or some 2GHz i86 box with 1GB running FreeBSD? If not, how are you folks worrying the scalability issue? While this isn't specifically a PHP question, I think scalability of PHP applications is germane to the list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP/MySQL based webmail?
On Wed, 11 Aug 2004 18:25:34 -0700 (PDT), Hardik Doshi [EMAIL PROTECTED] wrote: Hi Chris, Horde is little bit heavier than Squirrelmail. You can buy a Zend acclerator to speed up the things. You can also get the free TurckMMCache to cache the parsed PHP files. I think your community is not that big and Horde works fine in our organization where we have 1000 users and all are pretty active. Look and feel matters in the web mail so before you make any decision then consider this issue as well. Let me know if you need more information about Horde. Thanks, Hardik --- Chris Shenton [EMAIL PROTECTED] wrote: Matthew Sims [EMAIL PROTECTED] writes: Uh, well...Squirrelmail is simply a webpage. The number of simultaneous users is defined by the web server application, aka Apache. Perhaps we view it differently. Apache is a web server. SquirrelMail and Horde are applications, written in PHP. I'm curious about user experiences deploying both, especially in terms of resource consumption and scalability. IMAP doesn't HAVE to be on the same box. You can use SM to connect to an another server running your mail. Yes. But both Squirrel and Horde must speak IMAP to the mail server, whether on localhost or remote. IMAP's nontrivial and introduces more load on the web app server than -- say -- a POP-based mail GUI. Or static web pages. I'm also quite interested in fault-tolerance. I can deploy a couple of physical boxes running SquirrelMail behind load balancers. But Squirrel stores stuff like user address books and preferences on the web server's disk; this obviously won't work in a load balanced arrangement where a client connection is just as likely to go to the other box. I could put the files on a back-end NetApp NFS server like I do for my (balanced) SMTP/IMAP mail servers; this may introduce NFS file locking problems and corruption by simultaneous access to the same NFS-resident file. (My SMTP/IMAP servers use Maildir to avoid NFS problems). Does Horde have these same implementation issues? How does it store preferences and such? It seems a much more resource-intensive application than the relatively simpler SquirrelMail, but I haven't done any benchmarks to compare the two. Basically it boils down to this question of web app scalability and resource needs: can I support a community of (say) 2500 people, where maybe 100 are actively using webmail at any given instant on a box like a Sun Netra running Slowaris with 1GB RAM? Or some 2GHz i86 box with 1GB running FreeBSD? If not, how are you folks worrying the scalability issue? While this isn't specifically a PHP question, I think scalability of PHP applications is germane to the list. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/package/DB_DataObject_FormBuilder paperCrane --Justin Patrin-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Query Question
Why does this query not work? It should only show the eventdetails for the shown event. - ?php $event = mysql_query(select id, information from event where id=.$id); ? ?php $eventdetail_query = mysql_query(select titles, informations, file_name from eventdetail, event where eventdetail.event = event.id); while($eventdetail = mysql_fetch_row($eventdetail_query)){ print(span style=\font-family: Arial, Helvetica, sans-serif;font-size:12px;\a target=_blank href=\../PDF/$eventdetail[2]\ class=\decisions_links\.strip_tags(html_decode($eventdetail[0]))./a/ span); print(nbspspan style=\font-family: Arial, Helvetica, sans-serif;font-size:12px;\.html_decode($eventdetail[1])./span); } ? - TIA Karl-Heinz Tracking #: B3BFF38AEF0C854C96E9B501DD35C6C783308CA5 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Query Question
whats the error, are there any matching fields for the columns eventetail.event and event.id? Jason Karl-Heinz Schulz [EMAIL PROTECTED] wrote: Why does this query not work? It should only show the eventdetails for the shown event. - ?php $event = mysql_query(select id, information from event where id=.$id); ? ?php $eventdetail_query = mysql_query(select titles, informations, file_name from eventdetail, event where eventdetail.event = event.id); while($eventdetail = mysql_fetch_row($eventdetail_query)){ print(span style=\font-family: Arial, Helvetica, sans-serif;font-size:12px;\a target=_blank href=\../PDF/$eventdetail[2]\ class=\decisions_links\.strip_tags(html_decode($eventdetail[0]))./a/ span); print( span style=\font-family: Arial, Helvetica, sans-serif;font-size:12px;\.html_decode($eventdetail[1])./span); } ? - TIA Karl-Heinz Tracking #: B3BFF38AEF0C854C96E9B501DD35C6C783308CA5 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Escaping quotes
Hi, Thursday, August 12, 2004, 10:03:32 AM, you wrote: AH Hi All, AH I have this expression; AH $query = INSERT INTO $table (%s) VALUES (%s); AH $query = sprintf($query, implode(,, $fld), implode(,, AH $val)); AH $result = mssql_query($query) or die($errmsg); AH I am trying to insert values from an array into the database. AH I keep getting the error that I can't pass column names in this context. AH I know it's because I'm not enclosing $val in quotes. AH I've tried a number of variations; AH implode(\,\, $val) AH implode(\',\', $val) AH implode(,, \.$val.\) - This blows up nicely ;-) AH Where am I going wrong on this? AH alex hogan You can do it this way but you must make sure that any strings in your values array have been escaped before with mysql_escape_string() and probably trimmed as well. $fields = array('id','name','age'); $values = array(1,'Dave',40); $table = 'test'; $sql = sprintf(INSERT INTO %s (%s) VALUES ('%s'),$table,implode(',',$fields),implode(',',$values)); echo $sql; (It's perfectly ok to quote numbers) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Query Question
I found my problem. $eventdetail_query = mysql_query(select DISTINCT titles, informations, file_name from eventdetail, event where eventdetail.event = .$id); -Original Message- From: Karl-Heinz Schulz [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 11, 2004 10:13 PM To: 'Jason Davidson' Subject: RE: [PHP] Query Question Oops - it shows all the eventdetails for all the events -Original Message- From: Jason Davidson [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 11, 2004 10:10 PM To: Karl-Heinz Schulz; [EMAIL PROTECTED] Subject: Re: [PHP] Query Question whats the error, are there any matching fields for the columns eventetail.event and event.id? Jason Karl-Heinz Schulz [EMAIL PROTECTED] wrote: Why does this query not work? It should only show the eventdetails for the shown event. - ?php $event = mysql_query(select id, information from event where id=.$id); ? ?php $eventdetail_query = mysql_query(select titles, informations, file_name from eventdetail, event where eventdetail.event = event.id); while($eventdetail = mysql_fetch_row($eventdetail_query)){ print(span style=\font-family: Arial, Helvetica, sans-serif;font-size:12px;\a target=_blank href=\../PDF/$eventdetail[2]\ class=\decisions_links\.strip_tags(html_decode($eventdetail[0]))./a/ span); print( span style=\font-family: Arial, Helvetica, sans-serif;font-size:12px;\.html_decode($eventdetail[1])./span); } ? - TIA Karl-Heinz Tracking #: B3BFF38AEF0C854C96E9B501DD35C6C783308CA5 -- 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] Encoding
How can I encode my string using my own key? Is there any method to do this? i.e. using base64_encode() and convert_uuencode() functions? -- Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php