Re: [PHP] dreading OOP

2003-01-21 Thread Chris Worth
On Tue, 21 Jan 2003 09:47:28 -0600, Chris Boget wrote:

  equates an object to a function
 You'd be better off trying to equate an object to a data type.

Why is that?  Please explain?

my 2 cents are as follows.

Objects have functions that return data types as many objects contain data.  and the 
functions just tell the object how to manipulate and display or give some of the 
data 
back.

I hope that helps.   OOP kinda threw me for a loop when I first started wrapping my 
mind 
around it.


I do not mean to sound trite.  I do not know and am very curious
to hear more.

Chris


-- 
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] breaking out of two loops

2002-02-06 Thread Chris Worth


Dang... That is so cool.  i'd never noticed that before.

well I've learned enough for today.  maybe my boss'l let me go home.

LOL

On 04 Feb 2002 16:00:53 -0800, Lars Torben Wilson wrote:

On Mon, 2002-02-04 at 15:54, Erik Price wrote:
 Short and sweet:
 
 If I have an if statement inside a switch statement, how can I 
 break out of both blocks that I am in?  Will one break end 
 everything?  Or should I use one for each level deep that I am?
 
 
 Erik

From the manual:

   break accepts an optional numeric argument which tells it how
   many nested enclosing structures are to be broken out of

You can find this at http://www.php.net/break (which will take you
to http://www.php.net/manual/en/control-structures.break.php).


Hope this helps,

Torben

 
 
 Erik Price
 Web Developer Temp
 Media Lab, H.H. Brown
 [EMAIL PROTECTED]

-- 
 Torben Wilson [EMAIL PROTECTED]
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506


-- 
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] check box help.

2001-09-10 Thread Chris Worth


Hey gang I'm using a checkbox in a form that has its values dumped into a mysql 
database.  for some odd reason, the checkbox information is lost

It worked earlier so I'm guessing I introduced a typo someplace.

this is the code in the form.  I figure if this looks ok to you all. I just need to go 
search 
through my code more carefully.

H2
Recurring Seminar:input type=\checkbox\ 
name=\recur\ value=\$recur\/H2 Recurring 
seminars are displayed with a different color text in 
listings BR


I create the form as a variable that is displayed.

thanks,

chris



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP_SELF

2001-08-14 Thread Chris Worth

Michael,

I've got a program set up like you describe.

the problem is I've noticed that my variables are NOT stable

this is it in a nutshell

1) show 3 options with radio buttons for each

2) based on above  query a database and show a list of the records
(now it just dawned on my that I've been doing this with URL's and that might be the 
problem)

3) show all of the fields in the record to edit as necessary.

4) update the table

1,2,3 work fine.  I save the id number of the record.  however, it isn't persistent.  
IOW, 
suddenly the variable is set to null.

am I just not understanding how php scripts work?

or is my usage of URL's in appropriate.  I'm new to the world of php.

thanks 

chris




On Mon, 30 Jul 2001 17:14:53 -0700, Michael J. Seely wrote:

I do this sort of thing all the time.  The format I use typically 
follows this logic.

The PHP file has four IF-ELSEIF-ELSE sections.
pg=1 or blank  is the initial form
pg=2 is the error check looking at input values.
   If it passes, pg is set to 3.
   If not, set to 1. The advantage of this is the original input 
values can be saved and displayed with Value=? ECHO..? sequences so 
the use doesn't have to input everything if they make a mistake.  The 
error can be highlighted with a color or text!!!.
pg=3 shows a visual verification page. The user can scan the input 
and use the back button to make changes or click OK to proceed.
pg=4 is the action step - send an e-mail including the input, post 
input to a database or ???

The sections are written in this order - 2, 4, 3, 1.

IF($pg=2)
   { do the error checking
   e.g., if fields A, B, and C are not blank = OK
   e.g., if a value is  100 = not OK
  IF OK, $pg=3;  IF not OK, $pg=1;
   }
ELSEIF($pg=4)
   { do the action stuff.
   }
ELSEIF($pg=3)
   { show an html page in a nice format showing the input values
  IF they like it, the form submit button sets pg=4, and 
uses hidden fields to copy all of the input values to pg 4.
   }
ELSE
   { Show the initial input form.
   use INPUT TYPE=HIDDEN NAME=pg VALUE=2
   }


The form can include error check and input tags like this:

? IF(($pg=1) and ($val3==))
 { ECHOFONT COLOR=REDRequired./FONTBR; } ?
TEXTAREA WRAP=SOFT NAME=val3 COLS=50 ROWS=5? ECHO 
$val3; 
?/TEXTAREA

INPUT TYPE=RADIO NAME=v2 VALUE=6 ?IF($v2==6) { ECHO 
CHECKED; } ? 6
INPUT TYPE=RADIO NAME=v2 VALUE=7 ?IF($v2==7) { ECHO 
CHECKED; } ? 7

and so on.  Hope this is useful...



Im trying to introduce some logic into a form.I am unsing $PHP_SELF 
as the target.
form action=\$PHP_SELF\ method=\POST\ type=\multipart/form-data\

I have a text area that the user inputs their age.  What I want is 
that if the field is blank, to stop the script and send the user 
back to fill in their age.  My problem now is that if I go to the 
blank application form, The script interprets the form as being 
blank and spits out the error.  Ideal scenario, a blank form is 
presented to the user, and when the form is submitted, do the logic 
check and act accordingly.  Is it possible using $PHP_SELF as the 
target, or do I have to use 2 files: a form 'front end' with the php 
logic in the 'backend'??


if ($Age =  ) {
 echo Please go back and enter your age.; } exit();

Thanks
Gerard


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Michael Seely  408-777-9949




 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] SQL syntax error in PHP script. dunno what's wrong

2001-08-03 Thread Chris Worth


Thanks everybody, and Sam, that makes sense WRT the multiple words causing 
troubles.



On Wed, 1 Aug 2001 12:54:01 -0400, Sam Masiello wrote:


You will need to put single quotes around your variables in your SQL
statement.  Like this:

$sql = UPDATE TABLE seminar SET
title='$title',speaker='$speaker',event_date='$tdate',time='$time',bldg='$bu
ilding'
,rm='$room'  WHERE id='$id';

Without the quotes, SQL doesn't know that Something Amazing is supposed to
go together in the same string.

HTH

Sam Masiello
Software Quality Assurance Engineer
Synacor
(716) 853-1362 x289
[EMAIL PROTECTED]

 -Original Message-
From:  Chris Worth [mailto:[EMAIL PROTECTED]]
Sent:  Wednesday, August 01, 2001 12:36 PM
To:[EMAIL PROTECTED]
Subject:   [PHP] SQL syntax error in PHP script.  dunno what's wrong



hey gang.

here is my sql statement from my php script.

$sql = UPDATE TABLE seminar SET
title=$title,speaker=$speaker,event_date=$tdate,time=$time,bldg=$building
,rm=$room  WHERE id=$id;


it appears just like that in my code.

here is the $sql string echoed to the screen to verify the variables.


UPDATE TABLE seminar SET title=Something amazing,speaker=Mr.
Black,event_date=2001-08-05,time=11:00:am,bldg=BCC ,rm=201 WHERE id=48

all of the variable are valid.

here is my error.

1064: You have an error in your SQL syntax near 'TABLE seminar SET
title=Something
amazing,speaker=Mr.
Black,event_date=2001-08' at line 1

I'm baffled.


and I couldn't find error 1064 in the mysql manual.pdf either.

any ideas.  I know this is going to turn out to be something silly.

thanks,

chris




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] PHP_SELF

2001-08-01 Thread Chris Worth


LOL,

Jon, you just made me realize the typo I had in my script.
Thanks a bunch.  I had some ==, but there were two = which was making my head 
hurt.

thanks for the post.

On Tue, 31 Jul 2001 09:16:26 +0100, Jon Haworth wrote:

 if ($post = 1  $Age =  ) {echo NO;}
 else {echo YES;}
 Now here is what happens.  On a first time view of the page it outputs 
 'NO' (Good).  If I dont enter anything in the age field and submit the 
 form it outputs 'NO' (Good).  If I enter a value into the age field and 
 submit, it outputs 'NO' (Not Good).

You are assigning these values, not comparing them

$post = 1// puts 1 in the variable $post
$post == 1   // compares $post to 1

you need to change your code to 

if ($post == 1  $age ==  ) { blah blah blah

HTH
Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Groupwise calendar interface?

2001-07-10 Thread Chris Worth



Hello All,

is there anyway to get a PHP script to talk to Groupwise?  I'd like to be able to 
make
some of my web info be able to be entered into a groupwise calendar.

I really don't use Gwise but I've had people ask about this.

any suggestions are appreciated.

chris worth



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Free Database Design Program

2001-05-16 Thread Chris Worth

That's a good plan.

promote THEFT.

maybe somebody will think if they crack your front door they then realize all the 
stuff in 
your house is free?





On Sun, 13 May 2001 17:18:45 -0300 (EST), Augusto Cesar Castoldi wrote:

The software can be really a freeware (better) or...

can be cracked..., than he becomes free.

regards,

Augusto Cesar Castoldi

On Fri, 11 May 2001, Anuradha Ratnaweera wrote:

 
 On Sat, 5 May 2001, Augusto Cesar Castoldi wrote:
 
  Anyone know a Free database Design program? I'm needing to organize my
  MySQL databases and design new databases.
 
 In what sence do you mean Free? Just curious;
 
 Anuradha
 
 
 --
 a href=http://www.bee.lk/people/anuradha/;home page/a
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Want a Good Book for Ref on PHP

2001-04-24 Thread Chris Worth


I started with the Pro php programming book.

very useful and well written.

punt the baby book :)



On Mon, 16 Apr 2001 07:53:16 +0200, Martin Skj”ldebrand wrote:

Kath wrote:

 Professional PHP Programming:

http://www.amazon.com/exec/obidos/ASIN/1861002963/qid=987388364/sr=1-12/ref=
 sc_b_13/002-2263539-0333643

I've got Beginning PHP 4 (recommended) on the back cover of which it says
that the next book could be Professional PHP Programming..
However from what I saw in the book shop they cover lots of the same
ground. I (and my employer) wouldn't like to pay for the same stuff again.
Is there a significant difference between the two?

Martin S.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Supplied argument is not a valid MySQL result resource

2001-04-11 Thread Chris Worth


This happened to me when I used _affected_rows instead of _count

make sure you're using the right function.

that drove me nuts before I got it working, AND I followed the durn directions.

chris



On Tue, 10 Apr 2001 09:02:32 -0700, elias wrote:

can you show me some code?
basically when you provide an invalid link to any MySql function this error
occur.

-elias
http://www.kameelah.org/eassoft

""Nathan Roberts"" [EMAIL PROTECTED] wrote in message
9atdps$kgv$[EMAIL PROTECTED]">news:9atdps$kgv$[EMAIL PROTECTED]...
 I am trying to get to grips with managing data in mysql, am am currentky
 working on deleting records

 I have worked through a turorial - no problems, but now I am trying to
apply
 it to my own database, I am getting the error
 Warning: Supplied argument is not a valid MySQL result resource in  on
 line 14

 I cannot see what is causing it - if anyone can it would be much
 appreciated.

 thanks

 Nathan

 For clarity/brevity I have cut the page back to what i beleive to be the
 relivant part. Code for page is:-

 html

 body

 ?php

 $db = mysql_connect("localhost", "username", "pasword");

 mysql_select_db("catalogue",$db);


 $result = mysql_query("SELECT * FROM SECTIONS",$db);

 while ($myrow = mysql_fetch_array($result)) {

   printf("a href=\"%s?section_id=%s\"%s %s/a \n", $PHP_SELF,
 $myrow["section_id"], $myrow["section_name"], $myrow["section"]);

printf("a href=\"%s?id=%sdelete=yes\"(DELETE)/abr", $PHP_SELF,
 $myrow["section_id"]);

 }


   ?



 /body

 /html


 SQL for the table is

 CREATE TABLE SECTIONS (
section_name varchar(25) NOT NULL,
section_id tinyint(3) unsigned DEFAULT '0' NOT NULL auto_increment,
section char(1) NOT NULL,
PRIMARY KEY (section_id),
UNIQUE section (section_name, section_id, section)




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Script FLOW-- branching and subroutines/functions

2001-04-09 Thread Chris Worth


Hello all.

I'm relatively new to the world of PHP, but I've programmed in C, C++, Rexx, in the 
past.

What I'm working on is this and I wanted to clarify some things about how PHP "runs"

I've got a function that contains a form and depending on the entry to the form, which 
is 
then checked against a database(to avoid duplicates in the list).  once a non 
duplicate 
is determined it advances to the next form for data entry.  I had the whole thing in a 
while 
loop but that was a disaster.

I pass $PHP_SELF to the functions, am I to understand that once the script returns 
from 
the function it starts executing at the beginning?


While( Not stopping)
{

do first form()
check against database()

if(above check is OK)
do the information form()


if(form entered)
put data into database()




}


as it is structured above it just runs and runs through the first form.

I put a break into the while loop, but the script still seems to run right to the end.

I suppose to phrase another way. 

how do I do this

call form
wait there until it is completed
call check
look for duplicate

then if ok
I then commit to database after entereing data


PHP doesn't seem to stop execution and wait for user input. it seems to merrily plug 
away.


thanks for any input gang,

Chris



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Script FLOW-- branching and subroutines/functions

2001-04-09 Thread Chris Worth

Thanks, Michael


You've reinforced how I've come learn that php does things.  When I first tried the 
script 
it simply printed the first form over and over. it was kind of funny in a way.  I'll 
restructure 
my program now to account for how PHP does things.  thanks again,

chris



On Mon, 9 Apr 2001 22:34:36 +0930 (CST), Michael Hall wrote:


Here's what I'd do (pseudocode):

?php

if ($submit) {
   check for duplicate;
   if (everything OK) {
   commit to db;
   }
}
else {
   display form with submit button named 'submit';
}

?

Mick

 how do I do this
 
 call form
  wait there until it is completed
 call check
  look for duplicate
 
 then if ok
  I then commit to database after entereing data






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] data entry validation

2001-03-27 Thread Chris Worth


I'm working with some forms that need the data validated.  Dates, times etc.

my question is, how do I "reset" the form back to the original screen with variables 
intact so they can make the changes?

is there a code snippet some place i can work with?

thanks,

chris



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Simple PHP 4 and MySQL question about query

2001-03-21 Thread Chris Worth



To follow on, one thing this newbie learned is that it is usually best
to build the query string and then pass it to the mysql_query funcion.

i had some odd results when I had several ( ) in there  for my where clause
I made it a separate string and presto it works every time.

chris



On Tue, 20 Mar 2001 13:08:20 +1030, David Robley wrote:

On Tue, 20 Mar 2001 12:45, SED wrote:
 Hi,

 I'm trying to get a result from the following query:

  $result = mysql_query("SELECT 'islname' FROM $table WHERE id='$id'");

 Because "id" is a unique key in my table, I know it has only one value.
 What mysql_funtion should I use to echo the result and with what
 parameters?

 (I have tried many most of the functions but I don't get the correct
 result, and the manual is not helping me :)

 Regards,
 Sumarlidi Einar Dadason

If id is an integer type field, you will not get a result using the query 
you show. Remove the single quotes around $id as they indicate a text 
type value. Also you shouldn't need single quotes around islname - so 
your query might look more like:

$result = mysql_query("SELECT islname FROM $table WHERE id=$id");

Then you can use mysql_fetch_array to get row[s] containing an array of 
all the fields (one!) in your query, and then use extract to put the 
field values in a variable named as the field. (The example for 
mysql_fetch_array shows another way of displaying the fetched values.)
So:

$row = mysql_fetch_array($result);
extract($row);
echo $islname;

-- 
David Robley| WEBMASTER  Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet| http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] weeks revisited

2001-03-19 Thread Chris Worth


OK I did this below and it works just great.  I had stumbled across the message 
earlier.

my next question would be.  I'm working on a list of meetings.  I return a list for 
the 
current month, what I would like to do is make the current week meetings show in red.  
However, I'm not sure of the best approach to do this.

do I look at each date with a function of my own? or is there a php function I can use 
that 
I'm not aware of?

thanks for any and all help

chris


for MySQL add a WHERE (WEEK(yourtimefield) = WEEK(NOW()))

this will have the problem that it will show all of week X even if you're 
on 23:55 on the last day of that week

WHERE ((yourtimefield = NOW()) AND (yourtimefield = DATE_ADD(NOW(), 
INTERVAL 1 WEEK))

might be better

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

...1000100011010101101010110100111010113...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]