Re: [PHP] redirect
it works, thx Chris W. Parker [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] Pablo Zorzoli mailto:[EMAIL PROTECTED] on Wednesday, October 29, 2003 11:20 AM said: You cannot do any echo ; before header(location:..); maybe that's the problem. The solution would be to turn on output buffering. ?php ob_start(); // do your stuff header(Location: http://www.fullurl.com/notjust/a/page.html;); exit; ? hth, Chris. p.s. Output buffering I think can have some performance issues regarding server memory but I'm not certain about this. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and java
On Wed, 29 Oct 2003 19:27:36 -0600 David Miller [EMAIL PROTECTED] wrote: I have written PHP code to upload and download files to my server through my browser. On the local side I have generated a java applet to do a few things that I just can't do with a browser. There are some things that I need the java on the local machine to have access to on the server. I started to generate a java servlet to do this when I found out that my service provider doesn't support servlets. For example, I need for the java to be able to make a request of the server for a directory listing, then fetch an image from the directory to display in the applet. I am a little new to java applets. Any ideas on how to do this? Hmm... maybe you can try asking on a Java list or just find a provider the supports servlets ;) - E - __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echo issue RESOLVED!
(Just FYI) On Wed, 29 Oct 2003 23:03:55 +0100 Ryan A [EMAIL PROTECTED] wrote: If I have said it once I have said it a thousand times..MAC's are evil. Step away from it and leave the darkness behind.come towards the light and thePC ...[snip]... Too bad for you... Just by reading this - http://www.apple.com/macosx/ esp. these last two sections: * Solid as a rock * Developer's dream would give people reason to consider and even switch... One of Japan's most prestigious universities, Tokyo University, just purchased 1,149 customized iMacs and 53 Xserves--all running OS X, of course. They weren't the first one though. A university in Nagoya City has also bought more than a thousand of those. Imagine this. I've just finished recording a re-run of Dark Angel. I've cut the commercials, added chapters, and now it's ready to render and burn into a DVD together with the previous episode (I can put two in one disc). While waiting, I'm listening to my fav music on MP3s and debugging some of my PHP scripts. Oh, and did I mention that I'm doing all of this while copying voice/music from cassette tapes to the hard disk so that I can turn them all into MP3s? And did I mention that you can do all of the above just by installing Mac OS X and one software called Toast? You don't even need to install Apache, sendmail, etc. (and of course PHP) for testing since they're part of the OS installation. Do you need to ssh to your remote server? No sweat. The terminal is part of the OS as well. There you can just run the ssh client and login to your remote server. Btw, you can *also* customize the looks of your terminal. I like mine semi-transparent, with a prompt that looks and feels like I was back in those DOS days ;) Yes, I can do those and more on my Mac. And it doesn't even crash on me even if I do many things at the same time. I could run it for months! The only time I really needed to reboot it is when I added a new Serial ATA RAID card. Now, I'm really missing the blue screen... Too bad, my Mac is only next to my wife when it comes to being sexy, gorgeous, and beautiful grin Still not convinced? Too bad for you... - E - __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and java
Why can't you do this using PHP? Have a php script generate a directory listing the user can choose from and when the user chooses a picture load that picture. Jacob On Thu, 2003-10-30 at 02:27, David Miller wrote: I have written PHP code to upload and download files to my server through my browser. On the local side I have generated a java applet to do a few things that I just can't do with a browser. There are some things that I need the java on the local machine to have access to on the server. I started to generate a java servlet to do this when I found out that my service provider doesn't support servlets. For example, I need for the java to be able to make a request of the server for a directory listing, then fetch an image from the directory to display in the applet. I am a little new to java applets. Any ideas on how to do this? JDM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Venlig hilsen / Best regards, Jacob Vennervald System Developer Proventum Solutions ApS Tuborg Boulevard 12 2900 Hellerup Denmark Phone: +45 36 94 41 66 Mobile: +45 61 68 58 51 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echo issue RESOLVED!
- Edwin - wrote: Just by reading this - http://www.apple.com/macosx/ esp. these last two sections: * Solid as a rock * Developer's dream would give people reason to consider and even switch... Mac OS X is fairly stable, I'll give you that. As for developer's dream, that's a matter of opinion. One of Japan's most prestigious universities, Tokyo University, just purchased 1,149 customized iMacs and 53 Xserves--all running OS X, of course. They weren't the first one though. A university in Nagoya City has also bought more than a thousand of those. Yep, Macs are being bought. Same can be said for Intel-compatible hardware running Linux and Windows. Imagine this. I've just finished recording a re-run of Dark Angel. I've cut the commercials, added chapters, and now it's ready to render and burn into a DVD together with the previous episode (I can put two in one disc). While waiting, I'm listening to my fav music on MP3s and debugging some of my PHP scripts. Oh, and did I mention that I'm doing all of this while copying voice/music from cassette tapes to the hard disk so that I can turn them all into MP3s? And did I mention that you can do all of the above just by installing Mac OS X and one software called Toast? You don't even need to install Apache, sendmail, etc. (and of course PHP) for testing since they're part of the OS installation. With a DVD burner and video capture equipment. Oh, and my iMac doesn't even have a sound in port. Apache, sendmail, and PHP are also standard on most Linux distros. Do you need to ssh to your remote server? No sweat. The terminal is part of the OS as well. There you can just run the ssh client and login to your remote server. Btw, you can *also* customize the looks of your terminal. I like mine semi-transparent, with a prompt that looks and feels like I was back in those DOS days ;) Same for all Linux distros. Yes, I can do those and more on my Mac. And it doesn't even crash on me even if I do many things at the same time. I could run it for months! The only time I really needed to reboot it is when I added a new Serial ATA RAID card. Now, I'm really missing the blue screen... Linux is stable too. My iMac is dirt slow, and cost $1000. But I bought my old iMac back in 2000-ish. Maybe Macs have become better since then, I don't know. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String Array Creation and assigment
On Wed, Oct 29, 2003 at 12:47:58PM -0500, Dan wrote: : : please help with the following: : : I tried this first : : $b[] = 'Book Worzel, Richard (1989). From Employee to Entrepreneur: how to : turn your experience into a fortune. Toronto: Key Porter books.'; : $b[] = 'Book Ries, Al and Jack Trout (1994). The 22 Immutable Laws of : Marketing. New York: Harper Business'; : ... : : then tried this : : $b[0] = 'Book Worzel, Richard (1989). From Employee to Entrepreneur: how to : turn your experience into a fortune. Toronto: Key Porter books.'; : $b[1] = 'Book Ries, Al and Jack Trout (1994). The 22 Immutable Laws of : Marketing. New York: Harper Business'; : ... : : none of the above work, what's right? Both of these examples worked for me without any problems. What exactly do you mean, none of the above work? What happens when you do a simple print_r($b) ? Or even a basic is_array($b) after each set of variable assignments? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echo issue RESOLVED!
On Thu, 30 Oct 2003 02:47:47 -0500 Leif K-Brooks [EMAIL PROTECTED] wrote: - Edwin - wrote: Just by reading this - http://www.apple.com/macosx/ esp. these last two sections: * Solid as a rock * Developer's dream would give people reason to consider and even switch... Mac OS X is fairly stable, I'll give you that. As for developer's dream, that's a matter of opinion. Of course! But imagine your Super Graphics Designer decided to start coding. Where can you run QuarkXPress, Photoshop, Illustrator, Shade, Final Cut Pro, DVD Studio Pro, PHP, Java, Perl, Apache, MySQL, etc. ALL at the same time? That, without even worrying your OS might crash? One of Japan's most prestigious universities, Tokyo University, just purchased 1,149 customized iMacs and 53 Xserves--all running OS X, of course. They weren't the first one though. A university in Nagoya City has also bought more than a thousand of those. Yep, Macs are being bought. Same can be said for Intel-compatible hardware running Linux and Windows. True. But the ones I mentioned above were not bought just for casual use. Let's say, it's more for those mission-critical projects ;) Imagine this. I've just finished recording a re-run of Dark Angel. I've cut the commercials, added chapters, and now it's ready to render and burn into a DVD together with the previous episode(I can put two in one disc). While waiting, I'm listening to my fav music on MP3s and debugging some of my PHP scripts. Oh, and did I mention that I'm doing all of this while copying voice/music from cassette tapes to the hard disk so that I can turn them all into MP3s? And did I mention that you can do all of the above just by installing Mac OS X and one software called Toast? You don't even need to install Apache, sendmail, etc. (and of course PHP) for testing since they're part of the OS installation. With a DVD burner and video capture equipment. Yes. But the DVD burner comes as a standard these days. Oh, and my iMac doesn't even have a sound in port. Hmmm... I'm not aware of that. The new ones have though... Apache, sendmail, and PHP are also standard on most Linux distros. Correct. Do you need to ssh to your remote server? No sweat. The terminal is part of the OS as well. There you can just run the ssh client and login to your remote server. Btw, you can*also* customize the looks of your terminal. I like mine semi-transparent, with a prompt that looks and feels like I was back in those DOS days ;) Same for all Linux distros. True. Yes, I can do those and more on my Mac. And it doesn't even crash on me even if I do many things at the same time. I could run it for months! The only time I really needed to reboot it is when I added a new Serial ATA RAID card. Now, I'm really missing the blue screen... Linux is stable too. Of course! Don't get me wrong. I use Linux as well (both at home and office). The above was basically for people who think Macs are evil ;) My iMac is dirt slow, and cost $1000. Mine's fast, and it costs $4,000. And I'm about to have a FASTER one. The best thing is, I'm not the one who's paying for it (- company). Of course, I can't keep it but I can play with it ;) But I bought my old iMac back in 2000-ish. Maybe Macs have become better since then, I don't know. Yes, even iMacs are better. But imagine what you can do with a Dual 2GHz G5, 8GB of DDR400 RAM, a terabyte of Hard Disk space, Radeon 9800 Pro, an Apple 23 Cinema HD Display, and the latest OS X (Panther). Nah, I don't need all of that... but maybe I can convince my boss to buy it ;) - E - __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object Undefinded index
In my view, to keep the object oriented approach cleaner you should use another class for describing your item, like: class Item { var $_product_id; var $_quantity; function Item($productId, $quantity) { $this-_product_id = $productId; $this-_quantity = $quantity; } function getProductID() { return $this-_product_id; } function getQuantity() { return $this-_quantity; } } Then your Cart class should be defined as follows: class Cart { var $_items; function Cart() { $this-_items = array(); } function addItem($item) { $this-_items[] = $item; } function getItem($id) { return $this-_items[$id]; } } To add a new item to the cart first create the new item by calling the items constructor and then call addItem method of the Cart class(object): $MyCart = new Cart(); ... $newItem = new Item(10, 1); $MyCart-addItem($newItem); To iterate items in a Cart you may do something like that: foreach ($MyCart-getItems as $Item) { echo($Item-getProductId(), $Item-getQuantity); } Allex Steve Turner wrote: I am just learning to use objects. I am messing around with a shopping cart object, but am having confusing problems. I am getting an undefined index error when trying to assign a key value pair to an array variable within an object. I am confused becuase I believe this is how you assign array variables outside an object. It acts like the variable is undefined. Thanks for the help. Steve Turner //-- class Cart { var $items; // Items in shopping cart // Add $quantity articles of $product_id to the cart function add_item ($product_id, $quantity = 1) { $this-items[$product_id] += $quantity; } // Take $quantity articles of $product_id out of the cart function remove_item ($product_id, $quantity) { if ($this-items[$product_id] $quantity) { $this-items[$product_id] -= $quantity; return true; } else { return false; } } } //I am interacting with the object with the following code $cart = new Cart; $cart-add_item(10, 1); foreach ($cart as $product_id = $quantity) { echo $product_id . br . $quantity; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Japanese entry into MySQL and into emails
PHP Gurus, Hello, I'm new to this list. I'm very much new to PHP, so my questions will be very basic. I have two things I need to do in Japanese: 1. Store people's names in kanji in my MySQL database. To this end, I've set up an INSERT command without doing anything different than usual, and then at the HTML interface, just typed in some Japanese text (on an English Windows XP machine, Opera 7.2, using Microsoft's global IME text entry). When I looked in my database via phpMyAdmin, the field looked like it was filled with ASCII gibberish. 2. Send kanji text via PHPs mail() command. I've set up a form on a web page, that posts to a PHP script that will send me feedback from the users. Again, I didn't set up anything different than I would for English usage. When I received the mail, it came out as ASCII gibberish again. I've searched some on the web, and in this lists archives, and I understand that I can possibly use mbstring functions in order to resolve this. However, the manual for this function on php.net is a little beyond my ability to understand it. I'm confused by the need to set internal encoding, and/or also setting the character set. My web site is on a virtual host, and I don't know if I have access to make such adjustments. Can someone please explain in beginners terms how do I set up my PHP scripts to enter Japanese kanji safely into a database and into an email? -- Cheers! Dave G [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Endless 'while' loops?
PHP Gurus, This is my other question which motivated me to join this list. I've been using the book PHP and MySQL Web Development to learn how to build dynamically driven sites. For the most part it's great. But I don't have anyone I know personally that I can ask when I don't understand a part of the book. I want to send out an e-mail to a group of people. Each individual is stored in their own row in my MySQL database, with their address, name, and all those details. My understanding is that I can use either a for loop, or a while loop to accomplish this. In the example they give in this book, they use a while loop (page 670, for anyone who has it). But it's confusing because it looks like this: while ( $subscriber = mysql_fetch_row($result)) { [write and send the email] } $subscriber is probably an array, filled with the email address and information about the mailing list subscriber. But in the rest of the script I can't find where they declare and fill this array. But more than that, I can't understand how this while loop would ever stop running. Nothing seems to change $subscriber within the while loop's control structure. It doesn't ever say anything like $subscriber ++1. Nor does $result have anything act upon it which would change it. So to me they both look static, and this loop looks endless. -- Cheers! Dave G [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Apache 2
Hi everyone, I would like to use apache 2 in a production environment, but initially there seemed to be some issues with the PHP module. Does anybody know if it is ok use it now or is it still buggy with apache 2? Fern -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Endless 'while' loops?
Dave G wrote: In the example they give in this book, they use a while loop (page 670, for anyone who has it). But it's confusing because it looks like this: while ( $subscriber = mysql_fetch_row($result)) { [write and send the email] } $subscriber is probably an array, filled with the email address and information about the mailing list subscriber. But in the rest of the script I can't find where they declare and fill this array. But more than that, I can't understand how this while loop would ever stop running. Nothing seems to change $subscriber within the while loop's control structure. It doesn't ever say anything like $subscriber ++1. Nor does $result have anything act upon it which would change it. So to me they both look static, and this loop looks endless. In PHP, the equal sign returns the value assigned. For instance, this will output 5 and set $foo to 5: print $foo = 5; Now, the mysql_fetch_row function returns an array of results, or false if it's gone through all the results (it automagically knows which result it's on). If it's the last row, $subscriber is set to false and false is given for the loop condition. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Japanese entry into MySQL and into emails
Unless you want to do string manipulation you don't need mbstring. You only need to pay atention to these details: 1. Set charset to kanji for your html pages using header('Content-type: text/html; charset=kangi'); 2. In phpMyAdmin choose Japanese with kangi encoding for the interface language. 3. Set kangi encoding for your emails, preferably use a class that allows you to specify encoding easily. Dave G wrote: PHP Gurus, Hello, I'm new to this list. I'm very much new to PHP, so my questions will be very basic. I have two things I need to do in Japanese: 1. Store people's names in kanji in my MySQL database. To this end, I've set up an INSERT command without doing anything different than usual, and then at the HTML interface, just typed in some Japanese text (on an English Windows XP machine, Opera 7.2, using Microsoft's global IME text entry). When I looked in my database via phpMyAdmin, the field looked like it was filled with ASCII gibberish. 2. Send kanji text via PHPs mail() command. I've set up a form on a web page, that posts to a PHP script that will send me feedback from the users. Again, I didn't set up anything different than I would for English usage. When I received the mail, it came out as ASCII gibberish again. I've searched some on the web, and in this lists archives, and I understand that I can possibly use mbstring functions in order to resolve this. However, the manual for this function on php.net is a little beyond my ability to understand it. I'm confused by the need to set internal encoding, and/or also setting the character set. My web site is on a virtual host, and I don't know if I have access to make such adjustments. Can someone please explain in beginners terms how do I set up my PHP scripts to enter Japanese kanji safely into a database and into an email? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object Undefinded index
I'm just adding a working example to my last post; check the implementation part at the end of the script; Cheers, Allex ?php class Item { var $_productID; var $_quantity; function Item($productID, $quantity) { $this-_productID = $productID; $this-_quantity = $quantity; } function setProductID($productID) { $this-_productID = $productID; } function getProductID() { return $this-_productID; } function setQuantity($quantity) { $this-_productID = $quantity; } function getQuantity() { return $this-_quantity; } } class Cart { var $_items; function Cart() { $this-_items = array(); } function addItem($item) { $this-_items[] = $item; } function getItems() { return $this-_items; } } // test implementation $MyCart = new Cart(); $MyCart-addItem(new Item(10, 20)); $MyCart-addItem(new Item(20, 45)); $MyCart-addItem(new Item(30, 55)); foreach ($MyCart-getItems() as $item) { echo ProductId: . $item-getProductID() . Quantity: . $item-getQuantity() . br; } ? Steve Turner wrote: I am just learning to use objects. I am messing around with a shopping cart object, but am having confusing problems. I am getting an undefined index error when trying to assign a key value pair to an array variable within an object. I am confused becuase I believe this is how you assign array variables outside an object. It acts like the variable is undefined. Thanks for the help. Steve Turner //-- class Cart { var $items; // Items in shopping cart // Add $quantity articles of $product_id to the cart function add_item ($product_id, $quantity = 1) { $this-items[$product_id] += $quantity; } // Take $quantity articles of $product_id out of the cart function remove_item ($product_id, $quantity) { if ($this-items[$product_id] $quantity) { $this-items[$product_id] -= $quantity; return true; } else { return false; } } } //I am interacting with the object with the following code $cart = new Cart; $cart-add_item(10, 1); foreach ($cart as $product_id = $quantity) { echo $product_id . br . $quantity; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Japanese entry into MySQL and into emails
On Thu, Oct 30, 2003 at 10:36:37AM +0100, Marek Kilimajer wrote: : : Unless you want to do string manipulation you don't need mbstring. You : only need to pay atention to these details: : 1. Set charset to kanji for your html pages using : header('Content-type: text/html; charset=kangi'); a. it's spelled kanji and not kangi. b. charset=ISO-2022-JP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Japanese entry into MySQL and into emails
I'm sorry, I have never worked with Japanese. ;) Eugene Lee wrote: On Thu, Oct 30, 2003 at 10:36:37AM +0100, Marek Kilimajer wrote: : : Unless you want to do string manipulation you don't need mbstring. You : only need to pay atention to these details: : 1. Set charset to kanji for your html pages using : header('Content-type: text/html; charset=kangi'); a. it's spelled kanji and not kangi. b. charset=ISO-2022-JP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Apache 2
On Thu, Oct 30, 2003 at 11:22:38AM +0200, Fernando Melo wrote: : : I would like to use apache 2 in a production environment, but initially : there seemed to be some issues with the PHP module. Does anybody know : if it is ok use it now or is it still buggy with apache 2? The combination of PHP 4.x and Apache 2.x are not considered stable for a production environment. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php: file upload program limitation..
max_execution_time does not affect file uploads. Php script and thus also the timer starts after the upload is finished. max_input_time might influence it as it is the time allowed for the browser to post the data. Justin French wrote: See these three directives in php.ini: max_execution_time = 30 max_input_time = 60 memory_limit = 8M and this one you've already played with: post_max_size = 8M Obviously, for you to upload a 5 meg file over to a server is going to take more than 30 seconds, and may *possibly* consume more than 8M of memory (not sure there), so these settings need to be carefully modified to suit your needs. Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PPTs and thumbnails
Dear Friends, Is it possible to retrieve the first slide from a presentation and display it as a thumbnail on my site. Users will upload ppt's which should be displayed in form of thumbnails on my site. On clicking a particular thumbnail the presentation (.ppt or .pps) file should be displayed. I could manage to write the code for ppt upload, but i dont know how to display the same as a thumnail. Any help would be highly appreciated. Thnx in advance... Thanks Regards, ___ PHPLover [EMAIL PROTECTED] Göd döësn't pläy dícë. - Älbërt Ëínstëín ** This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. **
RE: [PHP] Endless 'while' loops?
[snip] But in the rest of the script I can't find where they declare and fill this array. [/snip] The subscriber array is filled by the query. Since PHP is not a strongly typed language there is no need to declare the array. $sql = SELECT `foo`, `bar` FROM `customers` WHERE `status` = 'active'; /*run the query, testing as we go*/ if(!($result = mysql_query($sql, $connection_string))){ echo MySQL reports an error . mysql_error() . \n; exit(); } /*if the query worked the $result 'holds' the info*/ while ( $subscriber = mysql_fetch_row($result)){ echo $subscriber[0].\t; should have info from foo column echo $subscriber[1].\n; should have info from bar column } When mysql_fetch_row($result) returns FALSE the while loop exits. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Japanese entry into MySQL and into emails
Please, include the list's address in cc. You will have much higher chance to get an answer. Dave G wrote: With regards to the kanji field in the MySQL database: Only one field in one table uses kanji. There are seven other tables. Will setting the character set to charset=ISO-2022-JP have any impact on all the straight English input in the database? As I suppose kanji contains also the latin alphabet with the same character codes as ascii, it will not. But you might have trouble searching on the column (case folding according to latin1). Mysql can be configured to use other encodings but the change is server wide and you are on a shared host. I think you should set the column type to BLOB, no text transformation takes place in this case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_regenerate_id()
Cpt John W. Holmes wrote: If you're using sessions in the URL, then it works just fine. So, if PHP is less than 4.3.3, you need to use setcookie() to reset the value of the session id yourself. If you're using 4.3.3, then you don't have to worry about it. I see, but then I would rather call it a bug in 4.3.2 than an enhancement in 4.3.3. I would expect a function which creates a new session id to do all necessary steps to have client and server synchronised. Anyway, thanks John for the explanation. Alexander -- PINO - The free Chatsystem! Available at http://www.pino.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reading and using GIF files
Hi, Now GD doesn't support GIF file format, how can I use imageXXX functions in order to resize/transform/... GIF files? Are there any tools transforming GIF to JPG/PNG/..? Thks in advance. (o_ BENARD Jean-Philippe - Consultant STERIA Infogérance (o_ (o_ //\ RENAULT DTSI/ODPS/[EMAIL PROTECTED] * ALO * API : MLB 02C 1 14 (/)_ (\)_ V_/_ 2 Av du vieil étang * 78181 MONTIGNY-LE-BRETONNEUX Tél : +33 1-30-03-47-83 * Fax : +33 1-30-03-42-10 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading and using GIF files
http://www.imagemagick.org/ Edward Dudlik Those who say it cannot be done should not interrupt the person doing it. wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU - Original Message - From: BENARD Jean-philippe [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, 30 October, 2003 07:36 Subject: [PHP] Reading and using GIF files Hi, Now GD doesn't support GIF file format, how can I use imageXXX functions in order to resize/transform/... GIF files? Are there any tools transforming GIF to JPG/PNG/..? Thks in advance. (o_ BENARD Jean-Philippe - Consultant STERIA Infogérance (o_ (o_ //\ RENAULT DTSI/ODPS/[EMAIL PROTECTED] * ALO * API : MLB 02C 1 14 (/)_ (\)_ V_/_ 2 Av du vieil étang * 78181 MONTIGNY-LE-BRETONNEUX Tél : +33 1-30-03-47-83 * Fax : +33 1-30-03-42-10 -- 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 Apache 2
And when will it be considered stable? It's been a while since Apache 2 was released. PHP needs to speed up for its own good. -Original Message- From: Eugene Lee [mailto:[EMAIL PROTECTED] Sent: 30 October 2003 11:55 To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP Apache 2 On Thu, Oct 30, 2003 at 11:22:38AM +0200, Fernando Melo wrote: : : I would like to use apache 2 in a production environment, but initially : there seemed to be some issues with the PHP module. Does anybody know : if it is ok use it now or is it still buggy with apache 2? The combination of PHP 4.x and Apache 2.x are not considered stable for a production environment. -- 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] Reading and using GIF files
BENARD Jean-philippe wrote: Hi, Now GD doesn't support GIF file format, how can I use imageXXX functions in order to resize/transform/... GIF files? Are there any tools transforming GIF to JPG/PNG/..? Use image functions in this order: imagecreatefromgif - read the gif file imagecreate - this will hold your resized image imagecopyresampled - from the gif source to the new image imagepng/imagejpeg - output the resampled image as png/jpg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Japanese entry into MySQL and into emails
On 2003.10.30, at 18:46 Asia/Tokyo, Eugene Lee wrote: On Thu, Oct 30, 2003 at 10:36:37AM +0100, Marek Kilimajer wrote: : : Unless you want to do string manipulation you don't need mbstring. You : only need to pay atention to these details: : 1. Set charset to kanji for your html pages using : header('Content-type: text/html; charset=kangi'); a. it's spelled kanji and not kangi. b. charset=ISO-2022-JP. Although that would work, I wonder if it'd be easy to find an editor for that... It's usually used for e-mails though. It's always a good idea to use EUC-JP (or, if possible, UTF-8). For shift_jis, here's a note from the manual: http://jp2.php.net/manual/en/ref.mbstring.php Note: SJIS should not be used for internal encoding unless the reader is familiar with parser/compiler, character encoding and character encoding issues. - E - __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Apache 2
On Thu, 2003-10-30 at 14:53, Fernando Melo wrote: And when will it be considered stable? It's been a while since Apache 2 was released. PHP needs to speed up for its own good. Maybe soon, maybe never. This question is covered in a lot of FAQ's on the web. Please search google if you are interested in more specific information. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Reading and using GIF files
Fatal error: Call to undefined function: imagecreatefromgif() in ... New GD version doen't include imagecreatefromgif api because of gif patent ... Cordialement, Jean-Philippe BENARD Consultant STERIA Infogérance ([EMAIL PROTECTED]) -Message d'origine- De : Marek Kilimajer [mailto:[EMAIL PROTECTED] Envoyé : jeudi 30 octobre 2003 14:53 À : BENARD Jean-philippe Cc : [EMAIL PROTECTED] Objet : Re: [PHP] Reading and using GIF files BENARD Jean-philippe wrote: Hi, Now GD doesn't support GIF file format, how can I use imageXXX functions in order to resize/transform/... GIF files? Are there any tools transforming GIF to JPG/PNG/..? Use image functions in this order: imagecreatefromgif - read the gif file imagecreate - this will hold your resized image imagecopyresampled - from the gif source to the new image imagepng/imagejpeg - output the resampled image as png/jpg -- 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] Files question
How can i read all files line by line? I am running windows. I know that there is then a \r\n but i don't know how to extract them... Can you help me? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Files question
[snip] How can i read all files line by line? I am running windows. I know that there is then a \r\n but i don't know how to extract them... Can you help me? [/snip] start with http://www.php.net/fopen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Performance of dynamically generated select boxes
--- Luis Lebron [EMAIL PROTECTED] wrote: I am rebuilding a php application to handle a higher load. The previous programmer had created a series of dynamically generated select boxes using a mysql table. Would it be faster or less resource intensive to create a series of arrays to generate the select boxes and avoid the database queries. I've done some informal testing using Pear Benchmark and it seems the array based script usually takes less time. --- Chris Shiflett wrote: Basically, anything you can do to eliminate talking to the database will usually improve performance by a fair margin. The downside is convenience; if you have data hard-coded in your PHP scripts, it is less convenient to maintain the data. You effectively eliminate the separation between the data and your logic. A similar idea is to eliminate PHP. Apache can serve a lot more static pages than it can PHP pages at any given time. Of course, this has a similar disadvantage as well. Now your pages are static rather than dynamic. I figured that writing the select boxes as plain html would be the fastest solution. However, I did not know of a way of repeating back the database contents using plain html. Now I can compare the the array with the database information and show the previously selected element in the select box. The data is fairly static (i.e. states, countries, etc) so I just created an include file with the arrays and include it as needed. Thanks for the feedback. Luis
Re: [PHP] Japanese entry into MySQL and into emails
Hi, On 2003.10.30, at 18:11 Asia/Tokyo, Dave G wrote: PHP Gurus, Hello, I'm new to this list. I'm very much new to PHP, so my questions will be very basic. I have two things I need to do in Japanese: 1. Store people's names in kanji in my MySQL database. To this end, I've set up an INSERT command without doing anything different than usual, and then at the HTML interface, just typed in some Japanese text (on an English Windows XP machine, Opera 7.2, using Microsoft's global IME text entry). When I looked in my database via phpMyAdmin, the field looked like it was filled with ASCII gibberish. Most probably, you're using phpMyAdmin in English. Choose EUC-JP when entering or viewing data. 2. Send kanji text via PHPs mail() command. I've set up a form on a web page, that posts to a PHP script that will send me feedback from the users. Again, I didn't set up anything different than I would for English usage. When I received the mail, it came out as ASCII gibberish again. Have you tried the examples here? http://jp2.php.net/manual/en/function.mb-send-mail.php I've searched some on the web, and in this lists archives, and I understand that I can possibly use mbstring functions in order to resolve this. However, the manual for this function on php.net is a little beyond my ability to understand it. I'm confused by the need to set internal encoding, and/or also setting the character set. My web site is on a virtual host, and I don't know if I have access to make such adjustments. Can someone please explain in beginners terms how do I set up my PHP scripts to enter Japanese kanji safely into a database and into an email? You'll find some info about internal encoding here: And, you'll be able to set the values by using this: http://jp2.php.net/manual/en/function.ini-set.php Make sure to read this as well: http://jp2.php.net/manual/en/configuration.changes.php - E - __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Files question
Now sorry... I already know to use fopen... I want a script that parses all lines from a file... Just like a loop that with every time it is executed, it echos a line from the file... (this is just a example... else i was using file_get_contents and nl2br...) Jay Blanchard [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [snip] How can i read all files line by line? I am running windows. I know that there is then a \r\n but i don't know how to extract them... Can you help me? [/snip] start with http://www.php.net/fopen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Files question
[snip] Now sorry... I already know to use fopen... I want a script that parses all lines from a file... Just like a loop that with every time it is executed, it echos a line from the file... (this is just a example... else i was using file_get_contents and nl2br...) [/snip] Well, Bas, the fopen and it's associated manual pages describe just how to do this. Basic example $theFile = fopen(myfile.foo, r); //open the file for reading while(!feof($theFile)){ // while the file is not at the end of the file $theLine = fgets($theFile, 1024); // get a line, specify a length echo $theLine; // print out the line you just got } //close the while loop -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Apache 2
PHP needs to speed up for its own good. PHP itself is not the issue. Extensions to PHP are what may cause problems. As Filip said, there are already many discussions about this on the web. Edward Dudlik Those who say it cannot be done should not interrupt the person doing it. wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU - Original Message - From: Fernando Melo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, 30 October, 2003 08:53 Subject: RE: [PHP] PHP Apache 2 And when will it be considered stable? It's been a while since Apache 2 was released. PHP needs to speed up for its own good. -Original Message- From: Eugene Lee [mailto:[EMAIL PROTECTED] Sent: 30 October 2003 11:55 To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP Apache 2 On Thu, Oct 30, 2003 at 11:22:38AM +0200, Fernando Melo wrote: : : I would like to use apache 2 in a production environment, but initially : there seemed to be some issues with the PHP module. Does anybody know : if it is ok use it now or is it still buggy with apache 2? The combination of PHP 4.x and Apache 2.x are not considered stable for a production environment. -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Files question
Try file() function Bas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How can i read all files line by line? I am running windows. I know that there is then a \r\n but i don't know how to extract them... Can you help me? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Files question
Well, Bas, the fopen and it's associated manual pages describe just how to do this. Basic example $theFile = fopen(myfile.foo, r); //open the file for reading while(!feof($theFile)){ // while the file is not at the end of the file $theLine = fgets($theFile, 1024); // get a line, specify a length echo $theLine; // print out the line you just got } //close the while loop http://us2.php.net/manual/en/function.file.php Using file will read each line of a file into an element of the returned array. then you can loop through the array and pull out line by line...example: $lines = file( somefile.txt ); foreach( $lines as $line = $value ) { echo $line = $valuebr; } HTH -- Ray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Set the background color of an image with GD
Hello, I have a stranger behaviour of the function imagecolorallocate. Normally, this function is used to create a color for an image and the first call to this function set the background color of the image. So here is my code : ?php [snip]...[/snip] $im = imagecreate(15, 15); $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); [snip]...[/snip] ? And when I display the page, some times the background of the generated image is not white. The color is the same as the color of the background of the page (defined in the body tag), as if the image was transparent. Have you also this problem ? Why isn't the background white as expected ? Something more strange is that if I replace the line : $white = imagecolorallocate($im, 255, 255, 255); by this line : $white = imagecolorallocate($im, 255, 255, 254); This works fine and the background of the image is well white. Thanks for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] IMAP Extension
Hi, I have just installed APache 2 and PHP 4.3.3 on Linux. and my software that i want to run on it requires both with IMAP Extension. How can i enable IMAP Extension??? ALso would like to know if there is any sample application avl. that can help me check my PHP with mysql.or may be a way by which i can check the same. i am new to both so need help. Thanks in advance Atul Luthra -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copying an uploaded file...
Ah, man, I just found my problem, and do I ever feel stupid... Thought I'd share it to highlight the it's right in front of one's nose feeling: copy($_FILES['userfile']['tmp_name']... ...was a sample code snippet. I had just copied and pasted it without changing the userfile partand since there was no 'userfile' in my form, it would never have worked. Using my own variable pointer $fld works. Thus: copy($_FILES[$fld]['tmp_name']. ...works. And that is all. In any case, thanks for the suggestions. ...Rene On Wednesday, October 29, 2003, at 11:28 PM, John Nichel wrote: Ren Fournier wrote: I've added a path, but still no success Does your webserver (Apache?) have write permission to the directory you're trying to move the file too? -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copying an uploaded file...
* Thus wrote René Fournier ([EMAIL PROTECTED]): Ah, man, I just found my problem, and do I ever feel stupid... Thought I'd share it to highlight the it's right in front of one's nose feeling: copy($_FILES['userfile']['tmp_name']... You should really use: http://php.net/move_uploaded_file Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] removing all duplicate values from an array
Hi, I'm looking for a function that does almost the same as array_unique() But it must also delete the other duplicate entry. sample to explain: array( 'a' = 'one', 'b' = 'one', 'c' = 'zero', 'd' = 'two' ); I now want the result to be: array( 'c' = 'zero', 'd' = 'two' ); This way I will be able to do an array_diff and then see all the duplicate entries listed. this is to find dup. ip address for a hosting system, displaying both accounts will make it easy to trace the amount of accounts 1 ip curruntly has. Anybody know how to do this? Thanks, Allowee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OOP, dynamic class extention
I want to be able to set a base class in a settings file, and then have other classes extend the base class, but PHP won't let me do what I have tried. I get the following error: Fatal error: Class cepweb: Cannot inherit from undefined class my_base_class in /home/me/my_child_class.php on line 10 ex: ?php // settings to be set on install of the app define(MY_BASE_CLASS,base_class); define(MY_BASE_CLASSFILE,base_class.php); // require the class file require_once(MY_BASE_CLASSFILE); class my_child_class extends MY_BASE_CLASSFILE { // yada yada } ? Any thoughts on ways to overcome this? I have tried using a variable instead of a constant, but it didn't work. -Jackson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] removing all duplicate values from an array
I'm looking for a function that does almost the same as array_unique() But it must also delete the other duplicate entry. snip Untested pseudo-PHP follows - $encountered_elements = array(); foreach($original_array as $key = $val) if(in_array($val, $encountered_elements)) { unset($original_array[$key]); } else { $encountered_elements[$key] = $val; } - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echo issue RESOLVED!
The devil will always give you lots of reasons to convert you Do not always take the smooth path, the rough path sometimes.. is the right path. :-D Cheers, -Ryan Oh BTW - Macs are EVIL. On Thu, 30 Oct 2003 02:47:47 -0500 Leif K-Brooks [EMAIL PROTECTED] wrote: - Edwin - wrote: Just by reading this - http://www.apple.com/macosx/ esp. these last two sections: * Solid as a rock * Developer's dream would give people reason to consider and even switch... Mac OS X is fairly stable, I'll give you that. As for developer's dream, that's a matter of opinion. Of course! But imagine your Super Graphics Designer decided to start coding. Where can you run QuarkXPress, Photoshop, Illustrator, Shade, Final Cut Pro, DVD Studio Pro, PHP, Java, Perl, Apache, MySQL, etc. ALL at the same time? That, without even worrying your OS might crash? One of Japan's most prestigious universities, Tokyo University, just purchased 1,149 customized iMacs and 53 Xserves--all running OS X, of course. They weren't the first one though. A university in Nagoya City has also bought more than a thousand of those. Yep, Macs are being bought. Same can be said for Intel-compatible hardware running Linux and Windows. True. But the ones I mentioned above were not bought just for casual use. Let's say, it's more for those mission-critical projects ;) Imagine this. I've just finished recording a re-run of Dark Angel. I've cut the commercials, added chapters, and now it's ready to render and burn into a DVD together with the previous episode(I can put two in one disc). While waiting, I'm listening to my fav music on MP3s and debugging some of my PHP scripts. Oh, and did I mention that I'm doing all of this while copying voice/music from cassette tapes to the hard disk so that I can turn them all into MP3s? And did I mention that you can do all of the above just by installing Mac OS X and one software called Toast? You don't even need to install Apache, sendmail, etc. (and of course PHP) for testing since they're part of the OS installation. With a DVD burner and video capture equipment. Yes. But the DVD burner comes as a standard these days. Oh, and my iMac doesn't even have a sound in port. Hmmm... I'm not aware of that. The new ones have though... Apache, sendmail, and PHP are also standard on most Linux distros. Correct. Do you need to ssh to your remote server? No sweat. The terminal is part of the OS as well. There you can just run the ssh client and login to your remote server. Btw, you can*also* customize the looks of your terminal. I like mine semi-transparent, with a prompt that looks and feels like I was back in those DOS days ;) Same for all Linux distros. True. Yes, I can do those and more on my Mac. And it doesn't even crash on me even if I do many things at the same time. I could run it for months! The only time I really needed to reboot it is when I added a new Serial ATA RAID card. Now, I'm really missing the blue screen... Linux is stable too. Of course! Don't get me wrong. I use Linux as well (both at home and office). The above was basically for people who think Macs are evil ;) My iMac is dirt slow, and cost $1000. Mine's fast, and it costs $4,000. And I'm about to have a FASTER one. The best thing is, I'm not the one who's paying for it (- company). Of course, I can't keep it but I can play with it ;) But I bought my old iMac back in 2000-ish. Maybe Macs have become better since then, I don't know. Yes, even iMacs are better. But imagine what you can do with a Dual 2GHz G5, 8GB of DDR400 RAM, a terabyte of Hard Disk space, Radeon 9800 Pro, an Apple 23 Cinema HD Display, and the latest OS X (Panther). Nah, I don't need all of that... but maybe I can convince my boss to buy it ;) - E - __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- 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] removing all duplicate values from an array
Or... you could use array_count_values() and loop through the array it produces to find out how many of each duplicate value exists in the original array. http://www.php.net/manual/en/function.array-count-values.php Kevin -Original Message- From: Allowee [mailto:[EMAIL PROTECTED] Sent: Thursday, October 30, 2003 10:28 AM To: [EMAIL PROTECTED] Subject: [PHP] removing all duplicate values from an array Hi, I'm looking for a function that does almost the same as array_unique() But it must also delete the other duplicate entry. sample to explain: array( 'a' = 'one', 'b' = 'one', 'c' = 'zero', 'd' = 'two' ); I now want the result to be: array( 'c' = 'zero', 'd' = 'two' ); This way I will be able to do an array_diff and then see all the duplicate entries listed. this is to find dup. ip address for a hosting system, displaying both accounts will make it easy to trace the amount of accounts 1 ip curruntly has. Anybody know how to do this? Thanks, Allowee -- 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] OOP, dynamic class extention
Shouldn't this line: class my_child_class extends MY_BASE_CLASSFILE { Read like this: class my_child_class extends MY_BASE_CLASS { After all base_class.php isn't the name of your class, base_class is. Jackson Miller [EMAIL PROTECTED] wrote: I want to be able to set a base class in a settings file, and then have other classes extend the base class, but PHP won't let me do what I have tried. I get the following error: Fatal error: Class cepweb: Cannot inherit from undefined class my_base_class in /home/me/my_child_class.php on line 10 ex: // settings to be set on install of the app define(MY_BASE_CLASS,base_class); define(MY_BASE_CLASSFILE,base_class.php); // require the class file require_once(MY_BASE_CLASSFILE); class my_child_class extends MY_BASE_CLASSFILE { // yada yada } ? Any thoughts on ways to overcome this? I have tried using a variable instead of a constant, but it didn't work. -Jackson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? Exclusive Video Premiere - Britney Spears
Re: [PHP] OOP, dynamic class extention
php is not c, you can't use constants this way. Jackson Miller wrote: I want to be able to set a base class in a settings file, and then have other classes extend the base class, but PHP won't let me do what I have tried. I get the following error: Fatal error: Class cepweb: Cannot inherit from undefined class my_base_class in /home/me/my_child_class.php on line 10 ex: ?php // settings to be set on install of the app define(MY_BASE_CLASS,base_class); define(MY_BASE_CLASSFILE,base_class.php); // require the class file require_once(MY_BASE_CLASSFILE); class my_child_class extends MY_BASE_CLASSFILE { // yada yada } ? Any thoughts on ways to overcome this? I have tried using a variable instead of a constant, but it didn't work. -Jackson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] new install php not working. Please help.
Folks, I did the fillowing install ./configure --prefix=/www --with-mysql --withmssql=/usr/share/freetds --with -apxs=/www/bin/apxs --enable-track-vars --with-config-file-path=/www/conf When I try access the index..php via the web the file it tries to download. I checked all of the config files and all looks good I can't find out why php will not work. When I search for the php.ini it only brings up a file from the /usr/src/php/php-4.3.3/pear/tests/php.ini Shouldn't this file be in the /etc/ dir? RH 9 Apache 2.0.48 httpd.conf # LoadModule foo_module modules/mod_foo.so LoadModule php4_modulemodules/libphp4.so I can't get php to work.. Thanks for your help. Patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP, dynamic class extention
On Thursday 30 October 2003 12:29 pm, Marek Kilimajer wrote: php is not c, you can't use constants this way. but why? Is there a work around? -Jackson Jackson Miller wrote: I want to be able to set a base class in a settings file, and then have other classes extend the base class, but PHP won't let me do what I have tried. I get the following error: Fatal error: Class cepweb: Cannot inherit from undefined class my_base_class in /home/me/my_child_class.php on line 10 ex: ?php // settings to be set on install of the app define(MY_BASE_CLASS,base_class); define(MY_BASE_CLASSFILE,base_class.php); // require the class file require_once(MY_BASE_CLASSFILE); class my_child_class extends MY_BASE_CLASSFILE { // yada yada } ? Any thoughts on ways to overcome this? I have tried using a variable instead of a constant, but it didn't work. -Jackson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP, dynamic class extention
Why? I guess because php is interpreted language and is parsed only once, no preprocessor. Workaround is quite easy, use variable: ?php // settings to be set on install of the app $MY_BASE_CLASS=base_class; define(MY_BASE_CLASSFILE,base_class.php); // require the class file require_once(MY_BASE_CLASSFILE); class my_child_class extends $MY_BASE_CLASS { // yada yada } ? Jackson Miller wrote: On Thursday 30 October 2003 12:29 pm, Marek Kilimajer wrote: php is not c, you can't use constants this way. but why? Is there a work around? -Jackson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] new install php not working. Please help.
--- Patrick Fowler [EMAIL PROTECTED] wrote: When I try access the index.php via the web the file it tries to download. Try adding this to your httpd.conf: AddType application/x-httpd-php .php Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] removing all duplicate values from an array
I'm looking for a function that does almost the same as array_unique() But it must also delete the other duplicate entry. snip Untested pseudo-PHP follows - $encountered_elements = array(); foreach($original_array as $key = $val) if(in_array($val, $encountered_elements)) { unset($original_array[$key]); } else { $encountered_elements[$key] = $val; } Oops, that should have been: $encountered_elements = array(); foreach($original_array as $key = $val) if(in_array($val, $encountered_elements)) { unset($original_array[$encountered_elements[$val]]); } else { $encountered_elements[$val] = $key; } - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP, dynamic class extention
On Thursday 30 October 2003 01:27 pm, Marek Kilimajer wrote: Why? I guess because php is interpreted language and is parsed only once, no preprocessor. Workaround is quite easy, use variable: I thought that too, and tried it before posting to the list (it was at the bottom of my first email). Unfortunately when you do that you get and expecting T_STRING error. The same thing happens if you put the var in quotes. Why would it not parse the constant the first time? It does everywhere else. -Jackson ?php // settings to be set on install of the app $MY_BASE_CLASS=base_class; define(MY_BASE_CLASSFILE,base_class.php); // require the class file require_once(MY_BASE_CLASSFILE); class my_child_class extends $MY_BASE_CLASS { // yada yada } ? Jackson Miller wrote: On Thursday 30 October 2003 12:29 pm, Marek Kilimajer wrote: php is not c, you can't use constants this way. but why? Is there a work around? -Jackson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mime::decode and multipart
Hi, Can someone explain how to extract the body information from a multipart/mixed part of a mime encoded mail using Pear's mime::decode class? I can get everything else, but when part is defined as multipart/mixed it does not have a body because there are more than one part. I assume that I have to get the parts of the multipart/mixed section, but I can't seem to get this. Thanks -- Geoffrey Makstutis [EMAIL PROTECTED] --- Makstutis Architecture and Design Ltd London --- Don't get even, Get MAAD --- --- This transmission and the information it contains, including any attachment, is intended solely for the named addressee(s). It is confidential and may contain legally privileged information. The unauthorised use, disclosure or copying of this transmission or such information is strictly prohibited. If you are not the/an addressee, and are in possession of this transmission (or any copy) without the consent of any named addressee, please notify the sender immediately by e-mail reply. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with remote include
On Wed, 2003-10-29 at 17:52, Chris Shiflett wrote: --- Pablo Zorzoli [EMAIL PROTECTED] wrote: ? include('http://www.google.com/'); ? That should basically take Google's HTML and make it your own. The image will obviously not work, but it should otherwise look like Google's home page. yes i get Google's HTML. OK, so this proves that this method works in your environment. Given this, can you identify the differences between this code and your own? Maybe if you try to break it down into its simplest case, you will reveal some subtle error that we all missed. Cris and rest of the list, I've tried with the simlpest example: --- output.php ? echo Hello World!; ? -- test.php htmlheadtitletesing!/title/head body ?php include ('http://***.com/output.php'); ? /body/html -- The result is: I spend a lot of time waiting for the response, and i only receive a blank page with the title testing! (wich is okay), but i don't get the hello world. Any clue? Regards, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Oh, for a sureset() (orthogonal to isset())
I'm sure I'm not the first person to find strict checking of whether or not variable (or array index) is set painful. I've considered just setting error_reporting() to some lax level on every script I write for the rest of my life, but have been thinking there might be a better way. What I'd like is a sureset() function ...there's probably a better name, but what it would do is more important: function sureset($var) { if(!isset($var) || empty($var)) return ''; else return $var; } Of course, when you've got strict checking on, the above doesn't work, because if the variable is unset you get caught on the fact before the function call happens. Is there something like this already? Is there a way to make this work? Or should I just go back to the idea of nuking error_reporting in all my scripts? Thanks, Weston Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with remote include
--- Pablo Zorzoli [EMAIL PROTECTED] wrote: I've tried with the simlpest example: --- output.php ? echo Hello World!; ? -- test.php htmlheadtitletesing!/title/head body ?php include ('http://***.com/output.php'); ? /body/html -- Actually, I think the simplest example was what you tries earlier: ? include('http://www.google.com/'); ? Also, as I recall, this was successful. I spend a lot of time waiting for the response, and i only receive a blank page with the title testing! (wich is okay), but i don't get the hello world. Any clue? Maybe it times out? Maybe the server where your PHP script is located cannot access the server at ***.com? Maybe the output that output.php generates isn't what you expect? Basically, because you can include Google's home page successfully, the error lies in something else. Try this from the server hosting your PHP script: wget http://***.com/output.php Then type: vi output.php Are the contents what you expect? Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP, dynamic class extention
Jackson Miller wrote: On Thursday 30 October 2003 01:27 pm, Marek Kilimajer wrote: Why? I guess because php is interpreted language and is parsed only once, no preprocessor. Workaround is quite easy, use variable: I thought that too, and tried it before posting to the list (it was at the bottom of my first email). Can you show it once again. In your first email you use a constant, not variable. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with remote include
On Thu, 2003-10-30 at 17:00, Chris Shiflett wrote: Maybe it times out? Maybe the server where your PHP script is located cannot access the server at ***.com? Maybe the output that output.php generates isn't what you expect? Basically, because you can include Google's home page successfully, the error lies in something else. Try this from the server hosting your PHP script: wget http://***.com/output.php Then type: vi output.php Are the contents what you expect? That's it i cannot wget it from the webserver i get failed: Connection timed out. i tried to wgetit from another machine and i get the desired output. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP, dynamic class extention
On Thursday 30 October 2003 02:15 pm, Marek Kilimajer wrote: Can you show it once again. In your first email you use a constant, not variable. Sure. In my first email I said that I had tried with a variable too (but didn't show the code). Ex1 gives a cannot inherit from undefined class error Ex2 gives a parse error, expecting T_STRING Ex1 (with constants): ?php // settings to be set on install of the app define(MY_BASE_CLASS,base_class); define(MY_BASE_CLASSFILE,base_class.php); // require the class file require_once(MY_BASE_CLASSFILE); class my_child_class extends MY_BASE_CLASS { // yada yada } ? Ex2 (with variables): ?php // settings to be set on install of the app define(MY_BASE_CLASS,base_class); define(MY_BASE_CLASSFILE,base_class.php); $my_base_class_var = MY_BASE_CLASS; // require the class file require_once(MY_BASE_CLASSFILE); class my_child_class extends $my_base_class_var { // yada yada } ? Also, just to be clear: base_class.php ?php class base_class { function base_class() { echo it works; return true; } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stat(), file_exists(), is_file() on Windows2000
All, Here's a new one from me. Had to move a project from a friendly linux environment to an unfriendly windows environment. The problem: all the code I've tried to test whether a temp (from a form post) is there before doing a filesize() on it is failing. I'm doing a filesize check so absurdly large files aren't copied from the temp folder to a permanent folder. (and no I can't change the ini file, already asked, I did mention unfriendly right?) What I want is a value for the filesize of the temporary file. After a form post I call a function with the following: $image_size = getFileSize($_FILES[image][tmp_name]); The value of $_FILES[image][tmp_name] is something like: C:\WINNT\TEMP\php41.tmp here's the function I'm using: function getFileSize($a) { // if (is_file($a)) if (file_exists($a)) { $tmp = number_format(filesize($a)/1024) . KB; }else{ $tmp = error; } clearstatcache(); return $tmp; } The root of the web server is on the G drive, so I don't know if files on the C drive are considered remote or not. I've tried changing the C:\WINNT\TEMP\php41.tmp to C:/WINNT/TEMP/php41.tmp and C:\\WINNT\\TEMP\\php41.tmp, that didn't work. I've tried stat($a); at the start of the function but get an error: Warning: stat failed for C:\WINNT\TEMP\php41.tmp (errno=2 - No such file or directory) in G:\web\domain.com\d\g\functions\fn_data.php on line 41 Right now the function returns error. I've searched the MARC archives, I've searched Google, I've read the manual and contributed notes. Any suggestions? Thanks in advance Chris Hubbard [EMAIL PROTECTED] www.wildcharacters.com 425 481 2020 php based web application development Y! [EMAIL PROTECTED] MSN [EMAIL PROTECTED] AIM ganeshacph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with remote include
--- Pablo Zorzoli [EMAIL PROTECTED] wrote: That's it i cannot wget it from the webserver i get failed: Connection timed out. i tried to wgetit from another machine and i get the desired output. So the server where you're running the PHP script can't connect to the server you specify in your include() call. So, you can now remove PHP from the problem and work on that. One way of testing connectivity is to try and telnet there manually: telnet www.example.org 80 That should time out, which is indicative of your problem. You can also try to do a DNS lookup: host www.example.org This will make sure your server is properly configured to resolve names and that this specific domain resolves properly. Aside from that, you can look at your routing table, speak with a network administrator, etc. Hope that helps. Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stat(), file_exists(), is_file() on Windows2000
From: Chris Hubbard [EMAIL PROTECTED] The problem: all the code I've tried to test whether a temp (from a form post) is there before doing a filesize() on it is failing. I'm doing a filesize check so absurdly large files aren't copied from the temp folder to a permanent folder. (and no I can't change the ini file, already asked, I did mention unfriendly right?) What I want is a value for the filesize of the temporary file. $_FILES['userfile']['size'] ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] stat(), file_exists(), is_file() on Windows2000
John, thanks for the quick response. If it had been a snake it would have bit me. Thanks. I was trying to do it the hard way. Chris -Original Message- From: CPT John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Thursday, October 30, 2003 1:20 PM To: Chris Hubbard; [EMAIL PROTECTED] Php. Net Subject: Re: [PHP] stat(), file_exists(), is_file() on Windows2000 From: Chris Hubbard [EMAIL PROTECTED] The problem: all the code I've tried to test whether a temp (from a form post) is there before doing a filesize() on it is failing. I'm doing a filesize check so absurdly large files aren't copied from the temp folder to a permanent folder. (and no I can't change the ini file, already asked, I did mention unfriendly right?) What I want is a value for the filesize of the temporary file. $_FILES['userfile']['size'] ---John Holmes... -- 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] Object References Problem
Hi there, I'm having trouble with passing objects as references. What I want to do is something like this: class object_1 { var $my_chld; var $my_array; function object_1() { $this-my_array = array('id' = 0, 'name'=''); $this-my_child = new object_2($this); } } class object_2 { var $my_parent; function object_2($parent_object) { $this-my_parent = $parent_object; } function set_parent() { $this-my_parent-my_array['id'] = 1; $this- my_parent-my_array['name'] = 'test'; } } $instance = new object_1(); $instance-my_child-set_parent(); echo instance: .$instance-my_array['name'].br; echo parent: .$instance-my_child-my_parent-my_array['name'].br; The above code give the output: instance: parent: test where I want it to give: instance: test parent: test but somewhere along the way, the reference to the parent object is being broken. I've looked all over the place, and I can't find the answer to this. Can somebody please help me? Cheers, Gareth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] removing all duplicate values from an array
On Thursday 30 October 2003 20:37, Mike Migurski wrote: I'm looking for a function that does almost the same as array_unique() But it must also delete the other duplicate entry. snip Untested pseudo-PHP follows - $encountered_elements = array(); foreach($original_array as $key = $val) if(in_array($val, $encountered_elements)) { unset($original_array[$key]); } else { $encountered_elements[$key] = $val; } Oops, that should have been: $encountered_elements = array(); foreach($original_array as $key = $val) if(in_array($val, $encountered_elements)) { unset($original_array[$encountered_elements[$val]]); } else { $encountered_elements[$val] = $key; } Hi, I edited it a bit to match my script and after some tweaks of my own code it started working :) Thanks, Allowee - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] removing all duplicate values from an array
-Original Message- From: Mike Migurski [mailto:[EMAIL PROTECTED] Sent: Thursday, October 30, 2003 1:37 PM To: Allowee Cc: [EMAIL PROTECTED] Subject: Re: [PHP] removing all duplicate values from an array I'm looking for a function that does almost the same as array_unique() But it must also delete the other duplicate entry. snip Untested pseudo-PHP follows - $encountered_elements = array(); foreach($original_array as $key = $val) if(in_array($val, $encountered_elements)) { unset($original_array[$key]); } else { $encountered_elements[$key] = $val; } Oops, that should have been: $encountered_elements = array(); foreach($original_array as $key = $val) if(in_array($val, $encountered_elements)) { unset($original_array[$encountered_elements[$val]]); } else { $encountered_elements[$val] = $key; } I was running Allowee's example array.. array( 'a' = 'one', 'b' = 'one', 'c' = 'zero', 'd' = 'two' ); through this and am having a hind time with then logic... Could you explain how the output would be array('c' = 'zero', 'd' = 'two')?? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] removing all duplicate values from an array
array( 'a' = 'one', 'b' = 'one', 'c' = 'zero', 'd' = 'two' ); through this and am having a hind time with then logic... Could you explain how the output would be array('c' = 'zero', 'd' = 'two')?? I was being pretty sloppy with the code (should've posted pseudocode to begin with, my bad) but the general logic is: cycle through each element of the input array. If the value has not been encountered before, store the value and key in a secondary array. If the value has been encountered before (it's present in the secondary array), remove it from the input array, and use the the stored key/value in the secondary array to unset its first instance in the input array, too. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Connection AS400-Windows PHP
I would like to establish a connection between AS400 - Windows NT and PHP, to make requetes on data base AS400, from forms PHP. I do not know how to make, could you help me? - Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Testez le nouveau Yahoo! Mail
[PHP] Tips on books and tutorials
Hi! I have just started to look at the exciting world og PHP and MySQL. Anyone that can inform me of good books to buy or free tutorials on the net that can guide me through building a good dynamic website. Thanx!!! TEM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Echo issue RESOLVED!
- Edwin - mailto:[EMAIL PROTECTED] on Wednesday, October 29, 2003 11:26 PM said: [snip lots of nice things about mac osx] Yes, I can do those and more on my Mac. And it doesn't even crash on me even if I do many things at the same time. I could run it for months! Yeah but... it's a Mac. But seriously folks... The reason I don't like Macs is not because they don't perform well but it's because they have a retarded UI. It looks like crap and it works like crap. They do some of the most stupid things as far as user interface goes. Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tips on books and tutorials
Hi, There are many great websites, for instance: http://www.phpdeveloper.org http://www.phpbuilder.com http://www.devshed.com http://www.phpnoise.com/ One of the most vital elements in the life of a PHP programmer is the manual (http://www.php.net/manual), that answers all the questions you will be able to think of. The books part is a little more tricky, because of the fact that PHP 5 will arive in the near future. Most books that are currently available focus on PHP 4 and will be outdated soon. I'm considering to buy PHP Developers Handbook by John Coggeshall (http://www.coggeshall.org/), but you could always take a look at the currently available titles at Amazon. Good luck and happy coding, Filip de Waard On Fri, 2003-10-31 at 00:20, Tore E. Mackay wrote: Hi! I have just started to look at the exciting world og PHP and MySQL. Anyone that can inform me of good books to buy or free tutorials on the net that can guide me through building a good dynamic website. Thanx!!! TEM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Echo issue RESOLVED!
Chris, I seriously disagree with you, in my not so humble opinion OS X is really great. I currently only have Linux installed, but i've just ordered a PowerBook... However, I don't see the point in discussing this topic any longer. You won't change your opinion and Apple afficionados won't change their opinion either. I would like to suggest that you try Linux, BSD or OS X before you speak. Regards, Filip de Waard On Fri, 2003-10-31 at 00:32, Chris W. Parker wrote: - Edwin - mailto:[EMAIL PROTECTED] on Wednesday, October 29, 2003 11:26 PM said: [snip lots of nice things about mac osx] Yes, I can do those and more on my Mac. And it doesn't even crash on me even if I do many things at the same time. I could run it for months! Yeah but... it's a Mac. But seriously folks... The reason I don't like Macs is not because they don't perform well but it's because they have a retarded UI. It looks like crap and it works like crap. They do some of the most stupid things as far as user interface goes. Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object References Problem
Since i see from your code, you are trying to create an object which maintains a list (collection) of instances of another object. Is that correct? Or you are trying to inherit a class from a parent class? Then it's a little bit different story. If this is the case, just tell me and I'll provide you with another example. The confusion comes from using 'parent' and 'child' as names for the class variables. I'll give you an example for the first case just keeping your name convention, but in general it's a good idea to use some more natural (descriptive) names for your variables, and especially to avoid 'parent/child' convention if the classes are not really inherited classes. So, here it is the example, feel free to ask in case there is something unclear in it: ?php // class Object_1 defines the parent object class Object_1 { var $_children; function Object_1() { $this-_children = array(); } function addChild($child) { $this-_children[] = $child; } function getChildren() { return $this-_children; } } // class Object_2 defines the child object(s) class Object_2 { var $_myName; function Object_2($name) { $this-_myName = $name; } function getName() { return $this-_myName; } } // implementation, the long way $MyParentObject = new Object_1; $MyChildObject_1 = new Object_2(child object 1); $MyChildObject_2 = new Object_2(child object 2); $MyChildObject_3 = new Object_2(child object 3); $MyParentObject-addChild($MyChildObject_1); $MyParentObject-addChild($MyChildObject_2); $MyParentObject-addChild($MyChildObject_3); // implementation, the short way $MyParentObject-addChild(new Object_2(child object 4)); $MyParentObject-addChild(new Object_2(child object 5)); // list all children registered in the parent object foreach ($MyParentObject-getChildren() as $achild) { echo $achild-getName() . br; } ? Hope this will help, Boyan Gareth Williams wrote: Hi there, I'm having trouble with passing objects as references. What I want to do is something like this: class object_1 { var $my_chld; var $my_array; function object_1() { $this-my_array = array('id' = 0, 'name'=''); $this-my_child = new object_2($this); } } class object_2 { var $my_parent; function object_2($parent_object) { $this-my_parent = $parent_object; } function set_parent() { $this-my_parent-my_array['id'] = 1; $this- my_parent-my_array['name'] = 'test'; } } $instance = new object_1(); $instance-my_child-set_parent(); echo instance: .$instance-my_array['name'].br; echo parent: .$instance-my_child-my_parent-my_array['name'].br; The above code give the output: instance: parent: test where I want it to give: instance: test parent: test but somewhere along the way, the reference to the parent object is being broken. I've looked all over the place, and I can't find the answer to this. Can somebody please help me? Cheers, Gareth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echo issue RESOLVED!
Sorry to continue this, but I just have to know... On Oct 30, 2003, at 6:32 PM, Chris W. Parker wrote: But seriously folks... The reason I don't like Macs is not because they don't perform well but it's because they have a retarded UI. It looks like crap and it works like crap. They do some of the most stupid things as far as user interface goes. You mean you're looking forward to this: http://www.neowin.net/staff/creamhackered/longhornbuild4051/ie.jpg and this: http://imac.taxrecords.com/mstearne/foghorn/explorer.jpg ? -- Chris Garaffa [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tips on books and tutorials
Tore E. Mackay wrote: Hi! I have just started to look at the exciting world og PHP and MySQL. Anyone that can inform me of good books to buy or free tutorials on the net that can guide me through building a good dynamic website. Thanx!!! TEM Tore - I have a few good beginner tutorials up on phpexamples.net, a couple of my other favorites are phpbuilder.com, phpfreaks.com, and weberdev.com. Rolf Brusletto www.phpExamples.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tips on books and tutorials
Anyone that can inform me of good books to buy or free tutorials on the net that can guide me through building a good dynamic website. People seem to think my books are pretty good (http://www.amazon.com/exec/obidos/ASIN/0321186486/dmcinsiinc-20/002 -8800445-6161652). PHP and MySQL Web Development is also a great book. For tutorials, there are plenty out there. Check out Zend.com, PHPBuilder.com, and, of course, the manuals at PHP.net and MySQL.com, which will get you started with installation and such. Both PHP and MySQL are free, so you can get going right now at no expense. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echo issue RESOLVED!
However, I don't see the point in discussing this topic any longer. You won't change your opinion and Apple afficionados won't change their opinion either. I would like to suggest that you try Linux, BSD or OS X before you speak. On the bright side, Linux, Windows, and Mac OS X all run PHP. And this IS a PHP mailing list. So might I be so bold as to suggest the end of the Mac vs Windows vs Linux thread? (Since this is, um, a *PHP* mailing list.) Larry PS This thread also stopped being about ECHO a long, long time ago. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tips on books and tutorials
Hi, On Fri, 2003-10-31 at 00:48, Tore E. Mackay wrote: Thanx for your quick reply. No problem :) I have had a look at some of the web sites you are refering to and they are great, but I feel that they have info for the beginners and the advanced. I need the one in between. I guess that 60% of the PHP coders are between these two stages, so you are not alone. However the only way to get trough this is experience and practice, in other words: write code, drink coffee and write more code. Of course you will run into problems, but with the manual and the many other excellent resources you will gain experience. What I guess I'm looking for is a book that can guide me throug and explain in detail the entire process of building a dynamic site with different kinds of modules (publisher, forum, shopping cart, user accounts, etc etc.). There are many books that have what you need, so I suggest that you'll go to your local bookstore or Amazon.com and pick one. I can't think of an exact title, but you might want to check what Wrox are still available. Regards, Filip de Waard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tips on books and tutorials
Filip de Waard wrote: Hi, There are many great websites, for instance: http://www.phpdeveloper.org http://www.phpbuilder.com http://www.devshed.com http://www.phpnoise.com/ Shameless self-promotional plug of the day: And also don't forget php|architect (http://www.phparch.com), a magazine dedicate PHP. We also host a complete searchable archive of the PHP mailing lists (http://www.phparch.com/mailinglists). Cheers! Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP4.3.3 problem with configure
Hi all, since I felt that my previous message got buried beneath this avalanche of postings, I propose it again hoping someone can give me a clue. I am istalling php4.3.3 on a linux suse8.1 distribution withand when I run configure, the script stops right before the end with a message saying it can't find main/build-defs.h.in the previous messages are creating php4.spec creating main/build-defs.h but there isn't any such build-def.h file in the main directory. Has anybody found him/her-self in the same situation? Thanks Antonio = === PermaCultura-es http://www.permacultura-es.org Centro Ki Aikido Barcelona http://www.geocities.com/kiaikidobcn __ Yahoo! Mail: 6MB di spazio gratuito, 30MB per i tuoi allegati, l'antivirus, il filtro Anti-spam http://it.yahoo.com/mail_it/foot/?http://it.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP, dynamic class extention
Hey guys, you can extend a _class_ from an existing _class_ but not from a _string_constant_ (Ex1 - MY_BASE_CLASS is evaluated to constant of type string) neither from a _string_variable_ (Ex2 - $my_base_class_var is a variable of type string). To be able to use different base classes with the same name just change the reference to the different settings files that contain the class declared with the same name but with different functionality, perhaps in the following way: ?php $a = 1; // blah blah if ($a==1) { include_once(settingsfile1.php); } else { inclide_once(settingsfile2.php); } ? Or even (much) better create a single base class in a single configuration file and different modified instances of that class used for each of the different configurations you may have. Boyan Jackson Miller wrote: On Thursday 30 October 2003 02:15 pm, Marek Kilimajer wrote: Can you show it once again. In your first email you use a constant, not variable. Sure. In my first email I said that I had tried with a variable too (but didn't show the code). Ex1 gives a cannot inherit from undefined class error Ex2 gives a parse error, expecting T_STRING Ex1 (with constants): ?php // settings to be set on install of the app define(MY_BASE_CLASS,base_class); define(MY_BASE_CLASSFILE,base_class.php); // require the class file require_once(MY_BASE_CLASSFILE); class my_child_class extends MY_BASE_CLASS { // yada yada } ? Ex2 (with variables): ?php // settings to be set on install of the app define(MY_BASE_CLASS,base_class); define(MY_BASE_CLASSFILE,base_class.php); $my_base_class_var = MY_BASE_CLASS; // require the class file require_once(MY_BASE_CLASSFILE); class my_child_class extends $my_base_class_var { // yada yada } ? Also, just to be clear: base_class.php ?php class base_class { function base_class() { echo it works; return true; } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object References Problem
On Thu, 30 Oct 2003 22:54:49 +0100, you wrote: Hi there, I'm having trouble with passing objects as references. What I want to do is something like this: [snip code] The above code give the output: instance: parent: test where I want it to give: instance: test parent: test I don't pretend to fully understand PHP references, or the strange and mysterious ways that they work in regards to PHP objects, but I can tell you how to acheive the results you desire. Someone else will have to explain it. :) First of all, you need to use the = operator inside the constructor for object_2. Secondly, you need to use the same = operator when creating the new instance of object_1. Full code follows: class object_1 { var $my_child; var $my_array; function object_1() { $this-my_array = array('id' = 0, 'name'=''); $this-my_child = new object_2($this); } } class object_2 { var $my_parent; function object_2($parent_object) { $this-my_parent = $parent_object; } function set_parent() { $this-my_parent-my_array['id'] = 1; $this-my_parent-my_array['name'] = 'test'; } } $instance = new object_1(); $instance-my_child-set_parent(); echo instance: .$instance-my_array['name'].br; echo parent: .$instance-my_child-my_parent-my_array['name'].br; This outputs (on PHP 4.3.3): instance: test parent: test Alternatively, you can forgo the = operator when creating a new instance of object_1 if you move the creation of the object_2 child out of object_1's constructor and into another method. Say we add this method to object_1: function create_my_child() { $this-my_child = new object_2($this); } Then you can do this: $instance = new object_1(); $instance-create_my_child(); $instance-my_child-set_parent(); echo instance: .$instance-my_array['name'].br; echo parent: .$instance-my_child-my_parent-my_array['name'].br; This also outputs: instance: test parent: test I really can't explain why either of these approaches work, but I suspect that it has something to do with the phenomenon described here: http://www.php.net/manual/en/language.oop.newref.php The headache I currently have prevents me from fully understanding this, hopefully it will be clearer to you. :) If someone sees that I'm leading Gareth astray here, feel free to jump in and correct me... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object References Problem
I don't pretend to fully understand PHP references, or the strange and mysterious ways that they work in regards to PHP objects, but I can tell you how to acheive the results you desire. Someone else will have to explain it. :) snip If someone sees that I'm leading Gareth astray here, feel free to jump in and correct me... Your explanation squares with my experience. My understanding from dealing with some fairly complex OOP interactions is that PHP operators generally favor passing-by-value to passing-by-reference, and the underlying language engine is optimized to perform well under those circumstances. Which is great, if you're new to programming, have never used Java or C, and are tossing arrays around and don't want to be bothered with premature optimization, but it's a royal pain when you need to maintain some degree of referential integrity. I frequently find myself using '' all over the place to cut down on accidental returns-by-value. I have not yet had a chance to play with PHP5's beta versions, but its strong focus on OOP makes me wonder, what kind of language changes (if any) were required to help ease this situation? -mike. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Oh, for a sureset() (orthogonal to isset())
function sureset($var) { if(!isset($var) || empty($var)) return ''; else return $var; } Of course, when you've got strict checking on, the above doesn't work, because if the variable is unset you get caught on the fact before the function call happens. One change will make your code work: just pass the $var argument by reference, ie. function sureset ($var) { ...code... } I wrote a similar function a while ago, with a little added functionality: function get_if_set ( $testVar, $falseValue = NULL) { if ( isset( $testVar ) ) { return $testVar; } else { return $falseValue; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PPTs and thumbnails
Vijaya_manda [EMAIL PROTECTED] wrote: Is it possible to retrieve the first slide from a presentation and display it as a thumbnail on my site. Users will upload ppt's which should be displayed in form of thumbnails on my site. On clicking a particular thumbnail the presentation (.ppt or .pps) file should be displayed. In short: not with PHP. You're going to need a program that can read and render PHP files, and save them as a static image (i.e. gif, jpg, etc). You can run this program (if you find one) using PHP, and then use PHP to resize and manipulate the output image, but PHP cannot natively manipulate PPT files, nor are there any PEAR packages for that purpose. Good luck, Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PPTs and thumbnails
In short: not with PHP. You're going to need a program that can read and render PHP files, and save them as a static image (i.e. gif, jpg, etc). Al Apologies, the 2nd sentence should read You're going to need a program that can read and render PPT files ... Arrrgh, I hate tpyos! :) Al -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing constructor values to functions in a class
Dear List, I've been struggling with this for some time now and can't for the life of me figure out why the output is GeorgeGeorge and not GeorgeBush ?php class StaffDetails { var $staff_name; var $staff_surname; function StaffDetails() { $this-$staff_name=George; $this-$staff_surname=Bush; } function StaffName() { echo $this-$staff_name; } function StaffSurname() { echo $this-$staff_surname; } } $sd = new StaffDetails(); $sd-StaffName(); $sd-StaffSurname(); ? References to links or tutorials most welcome :) Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing constructor values to functions in a class
On Fri, 31 Oct 2003 11:38:47 +0800, you wrote: I've been struggling with this for some time now and can't for the life of me figure out why the output is GeorgeGeorge and not GeorgeBush $this-$staff_name=George; Try this instead $this-staff_name=George; (superfluous $). Same goes for the other 3 instances. Sometimes it just takes a fresh pair of eyes. If you had your error reporting level set to E_ALL, you would have got a (somewhat cryptic) notice. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing constructor values to functions in a class
* Thus wrote Terence ([EMAIL PROTECTED]): Dear List, I've been struggling with this for some time now and can't for the life of me figure out why the output is GeorgeGeorge and not GeorgeBush ?php class StaffDetails { var $staff_name; var $staff_surname; function StaffDetails() { $this-$staff_name=George; syntax is: $this-staff_name=George; (note: no $ before the class variable) Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php