Re: [PHP-DB] Function questions...

2002-12-06 Thread Ignatius Reilly
I would replace
$query = SELECT * FROM accounts WHERE verifyurl='$safe_verify_string';

by
$query = SELECT * FROM accounts WHERE verifyurl='{$safe_verify_string}';
to force interpolation of variable $safe_verify_string

HTH
Ignatius

- Original Message -
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, December 06, 2002 6:04 PM
Subject: [PHP-DB] Function questions...


 I am trying to convert something that I have working in a PHP script
 to be a function in a library type of file.  The code contained in the
 function works fine in another script, but I am currently getting no
output
 from the function.  I have a question about the nature of functions that
may
 help clear up my problems.

 Do 'echo' commands within functions actually work to directly
 display information?  I have only used functions up to this point that use
 the 'return' command to pass a variable back to the script that called the
 function.  I am pretty confused on how to actually use a function that
 formats data to be displayed.  This is my primary source of confusion.

 Below is the function that is giving me trouble:

 function CheckboxList($query) {
   $result1 = mysql_query($query);
   do {
 $sys = split('-', $list['id-sys']);
 if ($cnt == 1) {
   $cnt = 2;
   echo trtd width=\161\input name=\system[]\
type=\checkbox\
 value=\$sys\;
   echo $sys./td;
 } elseif ($cnt == 2) {
   $cnt = 3;
   echo trtd width=\161\input name=\system[]\
type=\checkbox\
 value=\$sys\;
   echo $sys./td;
 } elseif ($cnt == 3) {
   $cnt = 4;
   echo trtd width=\161\input name=\system[]\
type=\checkbox\
 value=\$sys\;
   echo $sys./td;
 } elseif ($cnt == 4) {
   $cnt = 1;
   echo trtd width=\161\input name=\system[]\
type=\checkbox\
 value=\$sys\;
   echo $sys./td/tr;
 }
   } while ($list = mysql_fetch_assoc($result1));
 }

 Here is also the way I am calling this function:
 snip...
 $query = SELECT * FROM accounts WHERE verifyurl='$safe_verify_string';
 snip...
 CheckboxList($query);
 snip...

 Is there something wrong with the way in which I am calling this
 function?  Thanks in advance for all the help.


 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com



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




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




Re: [PHP-DB] Function questions...

2002-12-06 Thread Mark
$sys is an array, so echoing $sys will cause problems.

Are you trying to get a 4xN table of values and checkboxes? There's
got to be an easier way...

--- NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] wrote:
   I am trying to convert something that I have working in a PHP
 script
 to be a function in a library type of file.  The code contained in
 the
 function works fine in another script, but I am currently getting
 no output
 from the function.  I have a question about the nature of functions
 that may
 help clear up my problems.
 
   Do 'echo' commands within functions actually work to directly
 display information?  I have only used functions up to this point
 that use
 the 'return' command to pass a variable back to the script that
 called the
 function.  I am pretty confused on how to actually use a function
 that
 formats data to be displayed.  This is my primary source of
 confusion.
 
   Below is the function that is giving me trouble:
 
 function CheckboxList($query) {
   $result1 = mysql_query($query);
   do {
 $sys = split('-', $list['id-sys']);
 if ($cnt == 1) { 
   $cnt = 2; 
   echo trtd width=\161\input name=\system[]\
 type=\checkbox\
 value=\$sys\;
   echo $sys./td;
 } elseif ($cnt == 2) { 
 $cnt = 3;
   echo trtd width=\161\input name=\system[]\
 type=\checkbox\
 value=\$sys\;
   echo $sys./td;
 } elseif ($cnt == 3) { 
 $cnt = 4;
   echo trtd width=\161\input name=\system[]\
 type=\checkbox\
 value=\$sys\;
   echo $sys./td;
   } elseif ($cnt == 4) { 
 $cnt = 1;
   echo trtd width=\161\input name=\system[]\
 type=\checkbox\
 value=\$sys\;
   echo $sys./td/tr;
   }
   } while ($list = mysql_fetch_assoc($result1));
 }
 
   Here is also the way I am calling this function:
 snip...
 $query = SELECT * FROM accounts WHERE
 verifyurl='$safe_verify_string';
 snip...
 CheckboxList($query);
 snip...
 
   Is there something wrong with the way in which I am calling this
 function?  Thanks in advance for all the help.
 
 
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to death to 
defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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




RE: [PHP-DB] Function questions...

2002-12-06 Thread NIPP, SCOTT V (SBCSI)
Thanks guys.  I was able to work through this issue pretty much on
my own.  I got this portion of things working nicely except for a form
button that is appearing at the top rather than the bottom of the page.

-Original Message-
From: Mark [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 1:58 PM
To: '[EMAIL PROTECTED]'
Subject: Re: [PHP-DB] Function questions...


$sys is an array, so echoing $sys will cause problems.

Are you trying to get a 4xN table of values and checkboxes? There's
got to be an easier way...

--- NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] wrote:
   I am trying to convert something that I have working in a PHP
 script
 to be a function in a library type of file.  The code contained in
 the
 function works fine in another script, but I am currently getting
 no output
 from the function.  I have a question about the nature of functions
 that may
 help clear up my problems.
 
   Do 'echo' commands within functions actually work to directly
 display information?  I have only used functions up to this point
 that use
 the 'return' command to pass a variable back to the script that
 called the
 function.  I am pretty confused on how to actually use a function
 that
 formats data to be displayed.  This is my primary source of
 confusion.
 
   Below is the function that is giving me trouble:
 
 function CheckboxList($query) {
   $result1 = mysql_query($query);
   do {
 $sys = split('-', $list['id-sys']);
 if ($cnt == 1) { 
   $cnt = 2; 
   echo trtd width=\161\input name=\system[]\
 type=\checkbox\
 value=\$sys\;
   echo $sys./td;
 } elseif ($cnt == 2) { 
 $cnt = 3;
   echo trtd width=\161\input name=\system[]\
 type=\checkbox\
 value=\$sys\;
   echo $sys./td;
 } elseif ($cnt == 3) { 
 $cnt = 4;
   echo trtd width=\161\input name=\system[]\
 type=\checkbox\
 value=\$sys\;
   echo $sys./td;
   } elseif ($cnt == 4) { 
 $cnt = 1;
   echo trtd width=\161\input name=\system[]\
 type=\checkbox\
 value=\$sys\;
   echo $sys./td/tr;
   }
   } while ($list = mysql_fetch_assoc($result1));
 }
 
   Here is also the way I am calling this function:
 snip...
 $query = SELECT * FROM accounts WHERE
 verifyurl='$safe_verify_string';
 snip...
 CheckboxList($query);
 snip...
 
   Is there something wrong with the way in which I am calling this
 function?  Thanks in advance for all the help.
 
 
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to
death to defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

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




RE: [PHP-DB] Function questions...

2002-12-06 Thread NIPP, SCOTT V (SBCSI)
OK.  Stumped once again.  This function is now properly generating
and displaying the form as I intend it to.  The only problem is that the
optional text and button at the end of the function is actually displaying
above the choices provided in the while loop from the database.  Please let
me know what you think.

function CheckboxList($query, $CheckboxText) {
  $cnt = 1;
  $result1 = mysql_query($query);
  echo form name=\form1\ method=\post\ action=\test_display.php\;
  echo table border=\0\ align=\center\;
  while ($list = mysql_fetch_assoc($result1)) {
$sys = split('-', $list['id-sys']);
if ($cnt == 1) { 
  $cnt = 2; 
  echo trtd width=\161\input name=\system[]\ type=\checkbox\
value=\$sys[1]\;
  echo $sys[1]./td;
} elseif ($cnt == 2) { 
  $cnt = 3;
  echo td width=\161\input name=\system[]\ type=\checkbox\
value=\$sys[1]\;
  echo $sys[1]./td;
} elseif ($cnt == 3) { 
  $cnt = 4;
  echo td width=\161\input name=\system[]\ type=\checkbox\
value=\$sys[1]\;
  echo $sys[1]./td;
} elseif ($cnt == 4) { 
  $cnt = 1;
  echo td width=\161\input name=\system[]\ type=\checkbox\
value=\$sys[1]\;
  echo $sys[1]./td/tr;
}
  }
  if ($CheckboxText) {
echo p align=\center\font size=\4\$CheckboxText/font/p;
  }
  echo div align=\center\input type=\submit\ name=\Submit\
value=\Submit\/div/form;
}

One other question while I am at it...  I am wanting to provide a
button that selects all of the checkboxes automatically and refreshes the
page.  You know, a select all button.  I know nothing of Javascript, but
this is what should do this, correct?  Once again, any and all help is most
appreciated.

-Original Message-
From: Mark [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 1:58 PM
To: '[EMAIL PROTECTED]'
Subject: Re: [PHP-DB] Function questions...


$sys is an array, so echoing $sys will cause problems.

Are you trying to get a 4xN table of values and checkboxes? There's
got to be an easier way...

--- NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] wrote:
   I am trying to convert something that I have working in a PHP
 script
 to be a function in a library type of file.  The code contained in
 the
 function works fine in another script, but I am currently getting
 no output
 from the function.  I have a question about the nature of functions
 that may
 help clear up my problems.
 
   Do 'echo' commands within functions actually work to directly
 display information?  I have only used functions up to this point
 that use
 the 'return' command to pass a variable back to the script that
 called the
 function.  I am pretty confused on how to actually use a function
 that
 formats data to be displayed.  This is my primary source of
 confusion.
 
   Below is the function that is giving me trouble:
 
 function CheckboxList($query) {
   $result1 = mysql_query($query);
   do {
 $sys = split('-', $list['id-sys']);
 if ($cnt == 1) { 
   $cnt = 2; 
   echo trtd width=\161\input name=\system[]\
 type=\checkbox\
 value=\$sys\;
   echo $sys./td;
 } elseif ($cnt == 2) { 
 $cnt = 3;
   echo trtd width=\161\input name=\system[]\
 type=\checkbox\
 value=\$sys\;
   echo $sys./td;
 } elseif ($cnt == 3) { 
 $cnt = 4;
   echo trtd width=\161\input name=\system[]\
 type=\checkbox\
 value=\$sys\;
   echo $sys./td;
   } elseif ($cnt == 4) { 
 $cnt = 1;
   echo trtd width=\161\input name=\system[]\
 type=\checkbox\
 value=\$sys\;
   echo $sys./td/tr;
   }
   } while ($list = mysql_fetch_assoc($result1));
 }
 
   Here is also the way I am calling this function:
 snip...
 $query = SELECT * FROM accounts WHERE
 verifyurl='$safe_verify_string';
 snip...
 CheckboxList($query);
 snip...
 
   Is there something wrong with the way in which I am calling this
 function?  Thanks in advance for all the help.
 
 
 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a right unless you are willing to fight to
death to defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

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




Re: [PHP-DB] Function questions...

2002-12-06 Thread Jason Wong
On Saturday 07 December 2002 04:12, NIPP, SCOTT V (SBCSI) wrote:
 OK.  Stumped once again.  This function is now properly generating
 and displaying the form as I intend it to.  The only problem is that the
 optional text and button at the end of the function is actually displaying
 above the choices provided in the while loop from the database.  Please let
 me know what you think.

Your table doesn't seem to be closed.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
Never volunteer for anything.
-- Lackland
*/


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




RE: [PHP-DB] Function questions...

2002-12-06 Thread NIPP, SCOTT V (SBCSI)
Duh, OK.  That fixed me right up.  Thanks.  Now if I can just figure
out the 'Select All' option.

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 2:28 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Function questions...


On Saturday 07 December 2002 04:12, NIPP, SCOTT V (SBCSI) wrote:
 OK.  Stumped once again.  This function is now properly generating
 and displaying the form as I intend it to.  The only problem is that the
 optional text and button at the end of the function is actually displaying
 above the choices provided in the while loop from the database.  Please
let
 me know what you think.

Your table doesn't seem to be closed.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
Never volunteer for anything.
-- Lackland
*/


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

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