[PHP] OO PHP question

2003-08-26 Thread Mike Zornek
I'm just beginning a new PHP system and would like to do it in an OO way.
I'm having trouble getting my head around how I should store the data in the
MySQL db. I mean do I build model objects in PHP and put logic right in the
model so anytime I set a property of the object it makes the change to the
DB right there and then (which may get chatty) or do I build model objects
and then on pages, initialize them from the DB, do my work and send all the
data to the db in one shot?

Everything I've done in PHP has been procedural till this point so I'm up
for any advice, articles, links, etc.

~ Mike
-- 
Mike Zornek
Extreme geek in training
http://MikeZornek.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Parse error?

2003-09-05 Thread Mike Zornek
I'm trying to give PEAR a try and am currently following it's tutorial at:
http://pear.php.net/manual/en/package.database.db.intro-fetch.php

Now when I put this code into a PHP file I get a parse error on line 49
which has:

while ($row = $result-fetchRow()) {

I don't see what would cause the error, maybe the object syntax? I'm new to
PHP objects so little help.

~ Mike
-- 
Mike Zornek
Extreme geek in training
http://MikeZornek.com 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] [SOLVED] Re: [PHP] Parse error?

2003-09-05 Thread Mike Zornek
On 9/5/03 1:50 PM, Mike Zornek [EMAIL PROTECTED] wrote:

 I'm trying to give PEAR a try and am currently following it's tutorial at:
 http://pear.php.net/manual/en/package.database.db.intro-fetch.php
 
 Now when I put this code into a PHP file I get a parse error on line 49
 which has:
 
 while ($row = $result-fetchRow()) {
 
 I don't see what would cause the error, maybe the object syntax? I'm new to
 PHP objects so little help.
 
 ~ Mike

Ok, the reason I was getting this error seems to be related to Safari on OS
X. When I copy code segments in Safari and paste them in BBEdit they
generally looked ok, although there were extra spaces inserted in some
places. I then turned on show invisible characters and it made it even more
clear that something was up.

I'll detail it more later in my blog and then forward it to apple in a bug
report. For now I'll move to Mozilla for this.

~ Mike
-- 
Mike Zornek
Extreme geek in training
http://MikeZornek.com 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Best way to approach object construction errors?

2003-09-18 Thread Mike Zornek
I've created a class called university, it has a constructor which can
accept an id. If the id is sent during construction the constructor will
connect to a MySQL db to set all of the objects member variables to the
MySQl counterparts.

I'd like to include some error notification so if I send it an id and let's
say that record doesn't exist in the db I get some notification and can
write a message out to log (or screen). But what is the best way to do this?
Any recommendations? Tutorials? URLs?

~ Mike

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Quick snippet to convert text files to unix based line endings

2003-03-24 Thread Mike Zornek
I'm writing a little script that is parcing a excel generated csv file.
While all the users will be using windows I'd like to make it safe for all
file types.

Any one have a quick snippet that I could use to convert a temp file to use
all \n based line endings for consistency?

Thanks.

~ Mike
-- 
Mike Zornek
http://MikeZornek.com 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Question, what to do when finding an error while validating data

2004-04-05 Thread Mike Zornek
I'm making a conscience effort to improve my PHP skills, that being making
objects, unit testing, better error handling etc. So I have a questions.

I have a database that is storing all of my records. One column is of type
enum where the two legal values currently are home and work; work is
default. I'm building a PHP object that will be my interface to the DB. In
the object I have a variable called $EmailType which will hold the value of
the database column. I wrote some set and get methods to work with the
variable and am now asking myself: What should I do if someone tries to set
$EmailType to a value that is not listed in the enum set?

Please give me some advice. Thanks!

~ Mike
-
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: http://MikeZornek.com
New Project: http://WebDevWiki.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question, what to do when finding an error while validating data

2004-04-05 Thread Mike Zornek
Thanks the feedback so far. To expand the scope of my issue past enums
(which by their limited nature are easy to check and set defaults) let me
ask this...

There is a column called Address in my email table, Thus I am creating a PHP
object called Email to interact with it. The Address variable of this object
will hold a string like [EMAIL PROTECTED].

In the setAddress method should I check for a valid email address and throw
a warning then? And if so how?

Or should I simply create a method isValidAddress and do the verification in
my own interface code?

~ Mike
-
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: http://MikeZornek.com
New Project: http://WebDevWiki.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] require_once '../config.php'; doesn't work?

2004-04-09 Thread Mike Zornek
Is it true I can't include a file up a dir like this:

require_once '../config.php';

This seems to work though:

require_once 'settings/db.php';

Strange.

~ Mike
-
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: http://MikeZornek.com
New Project: http://WebDevWiki.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Command line include path?

2004-04-13 Thread Mike Zornek
I'm getting started with PEAR's DB_DataObject and am trying to follow along
with the tutorial:

http://pear.php.net/manual/en/package.database.db-dataobject.intro-purpose.p
hp

It tells me to create the ini file (which I did) and then run
createTables.php from the command line to generate my class files. I'm
trying to run it and am running into an include issue:

zorn$ php -f createTables.php
/Library/WebServer/Websites/ASMP/config/DB_DataObject.ini

Warning: main(DB/DataObject/Generator.php): failed to open stream: No such
file or directory in /usr/local/php/lib/php/DB/DataObject/createTables.php
on line 22

Fatal error: main(): Failed opening required 'DB/DataObject/Generator.php'
(include_path='.:/usr/lib/php') in
/usr/local/php/lib/php/DB/DataObject/createTables.php on line 22

-- Does the command line have it's own include path. Based on my phpinfo()
mine is: .:/usr/local/php/lib/php

~ Mike
-
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: http://MikeZornek.com
New Project: http://WebDevWiki.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to disable output buffer per script

2004-06-08 Thread Mike Zornek
I wrote an importer script in PHP that outputs the percentage of items
finished in 5% chunks. When I run the script however (web or command line) I
don¹t get incremental output .. I get it all in one fell swoop.

I have a feeling PHP is buffering it or something. It there any command I
can use to disable such buffering for just this script so I can see some
useful feedback. Thanks!
 
~ Mike
-
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: http://MikeZornek.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to disable output buffer per script

2004-06-08 Thread Mike Zornek
On 6/8/04 11:15 AM, Michael Sims [EMAIL PROTECTED] wrote:

 Try calling ob_end_flush() at the top of your script.  Although I believe some
 browsers will still buffer a portion of the output before displaying.  But if
 you're
 running from the command line it should display in real time.

I did this and it works well. I saw some of the other responses and they
seem useful as well. Thanks to all for your help.

~ Mike
-
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: http://MikeZornek.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] info@astralsecurityandfinancebv.com emails every time I post

2004-06-08 Thread Mike Zornek
I'm sorry to be 0t but I couldn't find anyone specific to contact on the web
or in the email source.

Every time I post to this (and the PEAR list if I recall) I get an email
from Information Desk [EMAIL PROTECTED]

 Thanks for contacting Astral Security and Finance BV. Your request is being
 processed, we will get back to you shortly. Information Desk

Best Google knows they are a fraud/scam thing:
http://www.google.com/search?q=Astral+Security+and+Finance+BVie=UTF-8oe=UT
F-8

Can someone who has admin access PLEASE look into it. Thanks.

~ Mike
-
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: http://MikeZornek.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Can I set a different include path per Apache Virtual host?

2004-06-09 Thread Mike Zornek
Can I set a different PHP include path per Apache Virtual host?

I am trying this:

VirtualHost *
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /Library/WebServer/Websites/stage/content
ServerName stage.asmpweb.org
ErrorLog /Library/WebServer/Websites/stage/logs/error_log
CustomLog /Library/WebServer/Websites/stage/logs/access_log common
IfModule mod_php4.c
php_value include_path
.:/usr/local/php/lib/php:/Library/WebServer/Websites/stage/content/includes

/IfModule
/VirtualHost

VirtualHost *
ServerAdmin [EMAIL PROTECTED]
DocumentRoot /Library/WebServer/Websites/dev/content
ServerName dev.asmpweb.org
ErrorLog /Library/WebServer/Websites/dev/logs/error_log
CustomLog /Library/WebServer/Websites/dev/logs/access_log common
IfModule mod_php4.c
php_value include_path
.:/usr/local/php/lib/php:/Library/WebServer/Websites/dev/content/includes
/IfModule
/VirtualHost

But I don¹t think its working.

~ Mike
-
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: http://MikeZornek.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can I set a different include path per Apache Virtual host?

2004-06-10 Thread Mike Zornek
On 6/10/04 11:01 AM, John Nichel [EMAIL PROTECTED] wrote:

 What version of Apache?  I currently have multiple boxes running with
 configurations like this, all on Apache 1.3.x, without any problems (one
 of them's a Mac...looks like you're using a Mac above).

Ghen:~ zorn$ httpd -v
Server version: Apache/1.3.29 (Darwin)
Server built:   Feb  4 2004 10:31:58

Ghen:~ zorn$ /usr/local/php/bin/php -v
PHP 4.3.4 (cli) (built: Dec  8 2003 16:22:32)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

Apache is default from Apple and PHP is from Marc:
http://www.entropy.ch/software/macosx/php/

~ Mike
-
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: http://MikeZornek.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [SOLVED] Can I set a different include path per Apache Virtual host?

2004-06-10 Thread Mike Zornek
On 6/10/04 11:56 AM, John Nichel [EMAIL PROTECTED] wrote:

 Our info file is here...
 
 http://www.kegworks.com/phpinfo.php
 
 Couldn't see yours, as it wanted  a username/password (HTTP auth).

Sorry.
 
 According to your httpd.conf, php isn't running a a module...
 
 #LoadModule php4_modulelibexec/httpd/libphp4.so
 
 That line (and the corresponding AddModule line) would need to be
 uncommented if php was installed as a module.

It is actually loaded with an include file at the bottom:

Include /usr/local/php/httpd.conf.php has:

 #
 # Additional PHP Apache directives,
 # part of the entropy.ch PHP package for Mac OS X
 # 
 # For more information, go to http://www.entropy.ch/software/macosx/php/
 #
 
 LoadModule php4_module/usr/local/php/libphp4.so
 AddModule mod_php4.c

Anyways .. I found a work around. I set up the Directory to AllowOverride
Options and then in my .htaccess file put:

# PHP 
php_value include_path
.:/usr/local/php/lib/php:/Library/WebServer/Websites/dev/content/includes

And it seems to be working. Thanks for all your help.

~ Mike
-
Mike Zornek
Web Designer, Media Developer, Programmer and Geek
Personal site: http://MikeZornek.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php