[PHP-DB] Determining if checkbox is selected in PHP

2003-09-09 Thread Keith Wilkinson
I'm storing the values from a groups of checkboxes
in an array keyword[], but $_POST['keyword'] is
undefined if none of the checkboxes is checked.
I tried using in_array() with $_POST to determine
if any of the group of 'keyword' checkboxes is checked,
but can't get it to work;  does anyone have any
suggestions?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Determining if checkbox is selected in PHP

2003-09-09 Thread jeffrey_n_Dyke


you could first check for isset($_POST['keyword']) and then if that passes
check what keywords you have.  or you could write an additional html tag to
the page like.  input type=hidden name=keyword[] value=NA.  This
would force the $_POST['keyword'] array to exist and then you'd have to
strip that from your array when processing it

hth
Jeff


   
 
  Keith Wilkinson  
 
  [EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  be.ne.jpcc: 
 
   Subject:  [PHP-DB] Determining if 
checkbox is selected in PHP
  09/09/2003 08:09 
 
  AM   
 
   
 
   
 




I'm storing the values from a groups of checkboxes
in an array keyword[], but $_POST['keyword'] is
undefined if none of the checkboxes is checked.
I tried using in_array() with $_POST to determine
if any of the group of 'keyword' checkboxes is checked,
but can't get it to work;  does anyone have any
suggestions?

--
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] Determining if checkbox is selected in PHP

2003-09-09 Thread Chris Boget
 I'm storing the values from a groups of checkboxes
 in an array keyword[], but $_POST['keyword'] is
 undefined if none of the checkboxes is checked.

The fact that it is undefined if none of the checkboxes
are checked is expected behavior.  Just do:

if( isset( $_POST['keyword'] ) {
}

to determine if you need to do any further processing.

 I tried using in_array() with $_POST to determine
 if any of the group of 'keyword' checkboxes is checked,
 but can't get it to work;  does anyone have any
 suggestions?

if( isset( $_POST['keyword'] ) {
  foreach( $_POST['keyword'] as $checkboxValue ) {
echo 'Checkbox ' . $checkboxValue . ' was checkedbr';

  }
}

Chris

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



[PHP-DB] Creating an autonumber setup

2003-09-09 Thread Richi Watts
Hi,

Could someone explain to me how this could be done? I have seen something similar 
using Access on a local machine and would like to know if it is posible to do it in 
PHP and Mysql
In a project management web based applicaton using PHP and Mysql I would need to allow 
the user to create

Quote
Project
Customer
Supplier
Invoice

Each time one of the above will be created it needs to be assigned an autonumber. So 
If 3 quotes were created today each quote would receive an autonumber, maybe something 
like the fllowing:
yy/MM/dd-01
yy/MM/dd-02
yy/MM/dd-03

Creating the autonumber isn't the problem if I want to have a set way of numbering, 
however, is it possible for me to allow the user to enter a setup page or something 
and define the way the autonumbers will look like and be created for quotes, projects, 
customers, suppliers or invoice. 

let's say I have five Project Managers each working with a seperate version of the 
app. The app currently sets each new project created with a default autonumber (let's 
say yy/MM/dd-01, -02, 03 and so on), however, each Project Manager wants their 
database to number new projects differently:

PM1 = yy/MM/dd-a
PM2 = dd/MM/yy-01
PM3=  YY- (Number being the amount of projects this year)
PM4 = PROJ- (Number being the amount of projects ever)
PM5 = P-yyMMdd1

Instead of me creating a different application for each project manager can I allow 
them to setup their own number system in a set up page?

Many thanks for any ideas
Richi



Re: [PHP-DB] Creating an autonumber setup

2003-09-09 Thread Mark
--- Richi Watts [EMAIL PROTECTED] wrote:
 Hi,
 
 Could someone explain to me how this could be done? I have seen
 something similar using Access on a local machine and would like to
 know if it is posible to do it in PHP and Mysql
 In a project management web based applicaton using PHP and Mysql I
 would need to allow the user to create
 
 Quote
 Project
 Customer
 Supplier
 Invoice
 
 Each time one of the above will be created it needs to be assigned
 an autonumber. So If 3 quotes were created today each quote would
 receive an autonumber, maybe something like the fllowing:
 yy/MM/dd-01
 yy/MM/dd-02
 yy/MM/dd-03
 
 Creating the autonumber isn't the problem if I want to have a set
 way of numbering, however, is it possible for me to allow the user
 to enter a setup page or something and define the way the
 autonumbers will look like and be created for quotes, projects,
 customers, suppliers or invoice. 
 
 let's say I have five Project Managers each working with a seperate
 version of the app. The app currently sets each new project created
 with a default autonumber (let's say yy/MM/dd-01, -02, 03 and so
 on), however, each Project Manager wants their database to number
 new projects differently:
 
 PM1 = yy/MM/dd-a
 PM2 = dd/MM/yy-01
 PM3=  YY- (Number being the amount of projects this year)
 PM4 = PROJ- (Number being the amount of projects ever)
 PM5 = P-yyMMdd1
 
 Instead of me creating a different application for each project
 manager can I allow them to setup their own number system in a set
 up page?
 
 Many thanks for any ideas
 Richi
 

I'd suggest not mixing display with data storage. That is, use
MySQL's autoincrement function to give each row in the table a unique
ID. Then have a prefix/suffix combo for each proect manager. So if
they want their numbering to be Fred's project #234 for this year,
the prefix could be Fred's project # and the suffix would be  for
this year. You could have variables in there as well, and you can do
number- text translation if necessary (a,b,c rather than 1,2,3). But
do the translation in the application (or your query), not within the
database.

That way if a project manager takes over another one's work, you
don't need to change the data, just the function that handles the
numbering schemes.


=
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.
***

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



[PHP-DB] foreach() db brainiacs please help?

2003-09-09 Thread Peter Sharpe
I have a database full of names. each name could be linked to any number of
sub-names, each sub-name could be linked to any number of sub-sub-names, to
infinity (unlikely but possible).

I need to iterate through this nest of names starting with a main name; lets
call the main name Peter. Peter could have John, Tim  Mike working for him.
Tim could have Greg working for him.

function select_names($current_top_name){
global $dbh;

$sql = 
SELECT
 name_id_fk
FROM
 name_relation
WHERE
 top_name_id_fk = '.$current_top_name.'
;
$rs = pg_query($dbh, $sql);

if(($num_rows = pg_num_rows($rs))  0){

for($i=0;$i$num_rows;$i++){
$row = pg_fetch_row($rs, $i, PGSQL_ASSOC);
$associated_names[] = $row['name_id_fk'];
}

pg_free_result($rs);

} // end if(($num_rows = pg_num_rows($rs))  0)

return $associated_names;

} // end function select_names()

$current_top_name = 'Peter';

while(!$stop){

$assoc_names = select_names($current_top_name);

foreach($assoc_names as $key = $val){
print($val);
$more_assoc_names = select_names($val);
if($more_assoc_names){
ARG HELP IM NOT SMART ENOUGH
}

} // end while(!$stop)

} // end foreach($assoc_names as $key = $val)

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



Re: [PHP-DB] foreach() db brainiacs please help?

2003-09-09 Thread jeffrey_n_Dyke

couldn't this be accomplished with a Left Join? Depending on how your
tables are arranged you should be able to get all (sub)sub-names out and in
the same result set using the top_name with a Left Join.  any key that
relates to the parent key would be returned.

it looks like you have them all in the same table thoughwhich may
furuther complicate things, if so, how is the relatoinship maintained in
the table(s)?

Jeff


   
 
  Peter Sharpe   
 
  [EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  .comcc: 
 
   Subject:  [PHP-DB] foreach()  db 
brainiacs please help? 
  09/09/2003 03:17 
 
  PM   
 
  Please respond to
 
  Peter Sharpe   
 
   
 
   
 




I have a database full of names. each name could be linked to any number of
sub-names, each sub-name could be linked to any number of sub-sub-names, to
infinity (unlikely but possible).

I need to iterate through this nest of names starting with a main name;
lets
call the main name Peter. Peter could have John, Tim  Mike working for
him.
Tim could have Greg working for him.

function select_names($current_top_name){
global $dbh;

$sql = 
SELECT
 name_id_fk
FROM
 name_relation
WHERE
 top_name_id_fk = '.$current_top_name.'
;
$rs = pg_query($dbh, $sql);

if(($num_rows = pg_num_rows($rs))  0){

for($i=0;$i$num_rows;$i++){
$row = pg_fetch_row($rs, $i, PGSQL_ASSOC);
$associated_names[] = $row['name_id_fk'];
}

pg_free_result($rs);

} // end if(($num_rows = pg_num_rows($rs))  0)

return $associated_names;

} // end function select_names()

$current_top_name = 'Peter';

while(!$stop){

$assoc_names = select_names($current_top_name);

foreach($assoc_names as $key = $val){
print($val);
$more_assoc_names = select_names($val);
if($more_assoc_names){
ARG HELP IM NOT SMART ENOUGH
}

} // end while(!$stop)

} // end foreach($assoc_names as $key = $val)

--
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



[PHP-DB] RH 8.0 Mysql help

2003-09-09 Thread Robin Kopetzky
Would some kind soul who has installed MySql on a RH8.0 box please email me
(off list) and help me get this running?? I have installed it a dozen times,
followed the post-installation and testing from the Mysql manual and STILL
can't make this run. I need this for a e-commerce site like yesterday!!

Please help...

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020

[EMAIL PROTECTED]

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



Re: [PHP-DB] RH 8.0 Mysql help

2003-09-09 Thread David Smith
One comand and you are done:

   apt-get install mysql-server httpd php php-mysql

Don't have apt for RedHat? Download this:

   
http://ftp.freshrpms.net/pub/freshrpms/redhat/8.0/apt/apt-0.5.5cnc6-fr0.rh80.1.i386.rpm

and run 'rpm -i' on it. There's no better way to install software than 
apt. Prefer a graphical installer? Do this:

   apt-get install synaptic

Good luck!

--Dave

Robin Kopetzky wrote:

Would some kind soul who has installed MySql on a RH8.0 box please email me
(off list) and help me get this running?? I have installed it a dozen times,
followed the post-installation and testing from the Mysql manual and STILL
can't make this run. I need this for a e-commerce site like yesterday!!
Please help...

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020
[EMAIL PROTECTED]

 

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