Re: [PHP] classes in php5
Thank you all for your responses. It was indeed an error elsewhere in my code. Daniel Watrous - Original Message - From: Matthew Fonda [EMAIL PROTECTED] To: Curt Zirzow [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, September 28, 2004 8:30 PM Subject: Re: [PHP] classes in php5 ?php class Foo { } $className = Foo; $fooInstance = new $className; ? Works fine for me. It still works if you add methods or properties to Foo as well, I'm not sure why it wouldn't work for you, possibly you have another error along the lines somewhere. I am on PHP 5.0.1 BTW On Tue, 2004-09-28 at 19:42, Curt Zirzow wrote: * Thus wrote Daniel Watrous: Hello all, I have a class Foo. In PHP4 I could create an instance of Foo in the following manner: $className = Foo; $fooInstance = new $className; This would yield the same result as: $fooInstance = new Foo; Can you provide the definition of your class Foo. what you describe works find in php5. Curt -- The above comments may offend you. flame at will. -- 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] classes in php5
Hello all, I have a class Foo. In PHP4 I could create an instance of Foo in the following manner: $className = Foo; $fooInstance = new $className; This would yield the same result as: $fooInstance = new Foo; In my efforts to port this over to PHP5 I am having trouble. Not only do I not get back an instance of my Foo class, but the script execution stops entirely without so much as a warning. Is this a bug? Is there a new mechanism in PHP5, such as a getInstance function (i.e. object getInstance (string className))? Thanks in advance for any comments! Daniel
[PHP] Re: problem with file upload script
Someone sent you a link earlier to a php page explaining how to upload files. I think that you will find as you read that page that you are missing SOME HTML in the way you build your form. If in doubt, try to copy and paste from that page exactly to see if it works! DW
Re: [PHP] Images in PHP and MySQL
I don't. I have used it on several projects. One caveat I would offer is that this is much slower than one might think. Three possible advantages come from using this approach: 1) there is no need to fiddle with directory permissions to write images. 2) if the content is sensitive you have the added security of the database password (and the fact that the database is ususally not directly accessible). 3) a mysqldump gives a backup of all images along with other persistent data Other disadvantages follow: 1) excessive load on the server for loading each image 2) the load mentioned above causes a slow down in the script 3) images usually need to be written to file before using GD for manipulation, inclusion in PDFs, etc. I have found that when I decide to store image data in the database I will usually also store a copy of the image on the server (as a file) also, primarily for performance reasons. - Original Message - From: GH [EMAIL PROTECTED] To: Daniel Watrous [EMAIL PROTECTED] Cc: GH [EMAIL PROTECTED] Sent: Monday, September 27, 2004 4:31 PM Subject: Re: [PHP] Images in PHP and MySQL Do you know of a good tutorial on this topic. On Mon, 27 Sep 2004 16:25:15 -0600, Daniel Watrous [EMAIL PROTECTED] wrote: consider using a blob field type. you will need to prepare your data on the way in, but not on the way out of DB: $content = addslashes(fread(fopen($_FILES[imgb_sizedesc][tmp_name], r), filesize($_FILES[imgb_sizedesc][tmp_name]))); then instert $content into your DB using insert! - Original Message - From: GH [EMAIL PROTECTED] To: php-general [EMAIL PROTECTED] Sent: Monday, September 27, 2004 4:19 PM Subject: [PHP] Images in PHP and MySQL I was wondering how to get images into and out of a Mysql database with in php... I do not have anything in my book... but was told it was possible. I have PHP 4.3.4 and mysql 4.0.18 Thanks -- 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