[PHP-DB] Array problem...

2005-09-16 Thread NIPP, SCOTT V \(SBCSI\)
I am migrating a web app from an old server running PHP 4.2.3 to
a new server running 4.3.8.  The problem I am running into at the moment
is building an array and passing it to another page.  This code works
fine on the old server, but the array is not coming across to the new
page on the new server.  Help...

mysql_select_db($database, $Prod);
$shell_list = getEnumOptions('accounts','shell');
$shell_tmp = select size=\1\ name=\shell[]\\n;
$shell_tmp .= optionDefault Shell/option\n;
$shell_tmp .= option-/option\n;
foreach ($shell_list as $item) {
  $shell_tmp .= option$item/option\n;
}
$shell_tmp .= /select\n;

$query_groups = SELECT name FROM grps;
$groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error());
$grp_list = select size=\1\ name=\grp[]\\n;
$grp_list .= optionPrimary Group/option\n;
$grp_list .= option---/option\n;
while($item2 = mysql_fetch_row($groups_tmp)) {
  $grp_list .= option$item2[0]/option\n;
}
$grp_list .= /select\n;

SNIP

?php
  while (isset($_POST['system'][$cntr])) { 
echo td width=\20%\div align=\center\font
class=\style3\.$_POST['system'][$cntr]./font/div/td;
echo td width=\20%\div
align=\center\.$shell_tmp./div/td;
echo td width=\20%\div
align=\center\.$grp_list./div/td;
echo td width=\20%\div align=\center\input
type=\text\ name=\other[]\ value=\\ size=\15\/div/td/tr;
$tmp = $sbcuid.-.$_POST['system'][$cntr];
$cntr++;
array_push( $accnts, $tmp );
  }
?
/table
p align=centerfont class=style3strongIf the systems listed
above are correct, please 
proceed. Otherwise, please hit the Back button on your browser and
review your 
system selections again./strong/font/pp
align=centernbsp;/p
?php
  session_register(accnts, shell, grp, other, cntr);
?

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-DB] Problem with foreach looping...

2005-04-07 Thread NIPP, SCOTT V \(SBCSI\)
I am attempting to use a simple foreach loop on a query result,
and I am only getting the first element of the array back.  Here is the
code...

$exclude_query = SELECT hostname FROM exclusion;
$exclude_results = mysql_query($exclude_query, $Prod);
$exclude = mysql_fetch_array($exclude_results, MYSQL_NUM);

foreach ($exclude as $row) {
  echo $row\n;
}

I don't understand how I am just getting a single item back from
this.  The query actually returns all 13 entries in the exclusion table.
I have tested the query via the mysql client.  I also get all 13
elements back if I loop via the following.

while ($test = mysql_fetch_array($results, MYSQL_NUM)) {
  echo $test[0]\n;
}

Is my PHP somehow broke, or am I just missing something here?
Thanks.

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-DB] MySQL Subquery problems...

2005-03-30 Thread NIPP, SCOTT V \(SBCSI\)
I am working with one of our Oracle DBAs to have him try and
help me get a couple of queries working.  The problem is that in looking
at the documentation for MySQL it seems that what we are attempting
should work.  Unfortunately, it doesn't.  Here is what we are trying...

mysql SELECT CPU_Hostname FROM AllMid_Data
- WHERE CPU_Hostname NOT IN
- (SELECT hostname FROM exclusion);
ERROR 1064: You have an error in your SQL syntax.  Check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'SELECT hostname FROM exclusion)' at line 3

This is an error returned from the mysql client.  Any help would
be most appreciated.

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



RE: [PHP-DB] MySQL Subquery problems...

2005-03-30 Thread NIPP, SCOTT V \(SBCSI\)
Yup...  Thanks, I just discovered that myself.  Thankfully the
docs have instructions on how to write a subquery for earlier versions
that don't support subqueries.

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



-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 30, 2005 9:35 AM
To: NIPP, SCOTT V (SBCSI); php-db@lists.php.net
Subject: RE: [PHP-DB] MySQL Subquery problems...


only mysql 4.1+ supports subqueries..if you version is lower it won;t
work

Bastien

From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] MySQL Subquery problems...
Date: Wed, 30 Mar 2005 09:25:36 -0600

   I am working with one of our Oracle DBAs to have him try and
help me get a couple of queries working.  The problem is that in
looking
at the documentation for MySQL it seems that what we are attempting
should work.  Unfortunately, it doesn't.  Here is what we are trying...

mysql SELECT CPU_Hostname FROM AllMid_Data
 - WHERE CPU_Hostname NOT IN
 - (SELECT hostname FROM exclusion);
ERROR 1064: You have an error in your SQL syntax.  Check the manual
that
corresponds to your MySQL server version for the right syntax to use
near 'SELECT hostname FROM exclusion)' at line 3

   This is an error returned from the mysql client.  Any help would
be most appreciated.

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



[PHP-DB] Further MySQL query problems...

2005-03-28 Thread NIPP, SCOTT V \(SBCSI\)
I am having trouble in the following code.  Basically, I want to
query two separate database tables and then generate an array from these
two queries.  The first query will return a list of ALL systems.  The
second query will return a list of systems that should be excluded.  The
problem is that this is getting me nowhere.  Here is the pertinent
code...

$query = SELECT CPU_Hostname FROM AllMid_Data
  WHERE CPU_IN_SVC = \Y\
  AND CPU_DNS = \sbcld.sbc.com\
  ORDER BY CPU_Hostname ASC;
$results = mysql_query($query, $Prod) or die(mysql_error());
$system = mysql_fetch_array($results, MYSQL_NUM);
$exclude_query = SELECT hostname FROM exclusion;
$exclude_results = mysql_query($exclude_query, $Prod);
$exclude = mysql_fetch_array($exclude_results, MYSQL_NUM);
$temp = array_diff($system, $exclude);
?php do {
$sys = $blah[0];
echo tr; ?
 ?php echo $sys; ?
  ?php echo /tr; } ?
?php } while ($blah = mysql_fetch_array($exclude_results)); ?

I have cut out a lot of extraneous stuff that I don't think is
pertinent.  Please let me know if you see something causing my problems.
The first query table has about 900 entries and the query returns about
90 hostnames.  The exclude table query has only 13 hostnames and
obviously returns all.  I am looking for a way to display the
approximately 77 entries that are NOT in the exclude table.  Thanks
again.

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-DB] RE: Further MySQL query problems...

2005-03-28 Thread NIPP, SCOTT V \(SBCSI\)
Oops...  Correction to the last line of the script.
?php } while ($blah = mysql_fetch_array($exclude_results)); ?

Should be...
  ?php } while ($blah = array_shift($temp)); ?
Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com


  -Original Message-
 From: NIPP, SCOTT V (SBCSI)  
 Sent: Monday, March 28, 2005 10:47 AM
 To:   'php-db@lists.php.net'
 Subject:  Further MySQL query problems...
 
   I am having trouble in the following code.  Basically, I want to
 query two separate database tables and then generate an array from
 these two queries.  The first query will return a list of ALL systems.
 The second query will return a list of systems that should be
 excluded.  The problem is that this is getting me nowhere.  Here is
 the pertinent code...
 
 $query = SELECT CPU_Hostname FROM AllMid_Data
 WHERE CPU_IN_SVC = \Y\
 AND CPU_DNS = \sbcld.sbc.com\
 ORDER BY CPU_Hostname ASC;
 $results = mysql_query($query, $Prod) or die(mysql_error());
 $system = mysql_fetch_array($results, MYSQL_NUM);
 $exclude_query = SELECT hostname FROM exclusion;
 $exclude_results = mysql_query($exclude_query, $Prod);
 $exclude = mysql_fetch_array($exclude_results, MYSQL_NUM);
 $temp = array_diff($system, $exclude);
 ?php do {
   $sys = $blah[0];
   echo tr; ?
  ?php echo $sys; ?
   ?php echo /tr; } ?
 ?php } while ($blah = mysql_fetch_array($exclude_results)); ?
 
   I have cut out a lot of extraneous stuff that I don't think is
 pertinent.  Please let me know if you see something causing my
 problems.  The first query table has about 900 entries and the query
 returns about 90 hostnames.  The exclude table query has only 13
 hostnames and obviously returns all.  I am looking for a way to
 display the approximately 77 entries that are NOT in the exclude
 table.  Thanks again.
 
 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



RE: [PHP-DB] RE: Further MySQL query problems...

2005-03-28 Thread NIPP, SCOTT V \(SBCSI\)
If I could figure out how to structure the query, I would be
happy to do so.  The problem is that I am working with 3 different
tables for this.  Additionally, I ran into a brick wall when trying to
structure the query to remove/eliminate the entries in the exclusion
table.  The exclusion table has 13 entries currently, and the last thing
I tried with the query was outputting 13 entries of every system.  Here
is the query that was yielding this...

#$query = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, exclusion
# WHERE AllMid_Data.CPU_IN_SVC = \Y\ 
# AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\ 
# AND AllMid_Data.CPU_Hostname != exclusion.hostname
# ORDER BY CPU_Hostname ASC;

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



-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 28, 2005 11:13 AM
To: NIPP, SCOTT V (SBCSI); php-db@lists.php.net
Subject: RE: [PHP-DB] RE: Further MySQL query problems...


why wouldn't you just run a query to return only the elements that you
want?

Bastien

From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] RE: Further MySQL query problems...
Date: Mon, 28 Mar 2005 10:49:24 -0600

   Oops...  Correction to the last line of the script.
   ?php } while ($blah = mysql_fetch_array($exclude_results)); ?

   Should be...
   ?php } while ($blah = array_shift($temp)); ?
Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com


   -Original Message-
  From:   NIPP, SCOTT V (SBCSI)
  Sent:   Monday, March 28, 2005 10:47 AM
  To: 'php-db@lists.php.net'
  Subject:Further MySQL query problems...
 
  I am having trouble in the following code.  Basically, I want to
  query two separate database tables and then generate an array from
  these two queries.  The first query will return a list of ALL
systems.
  The second query will return a list of systems that should be
  excluded.  The problem is that this is getting me nowhere.  Here is
  the pertinent code...
 
  $query = SELECT CPU_Hostname FROM AllMid_Data
WHERE CPU_IN_SVC = \Y\
AND CPU_DNS = \sbcld.sbc.com\
ORDER BY CPU_Hostname ASC;
  $results = mysql_query($query, $Prod) or die(mysql_error());
  $system = mysql_fetch_array($results, MYSQL_NUM);
  $exclude_query = SELECT hostname FROM exclusion;
  $exclude_results = mysql_query($exclude_query, $Prod);
  $exclude = mysql_fetch_array($exclude_results, MYSQL_NUM);
  $temp = array_diff($system, $exclude);
  ?php do {
  $sys = $blah[0];
  echo tr; ?
   ?php echo $sys; ?
?php echo /tr; } ?
  ?php } while ($blah = mysql_fetch_array($exclude_results)); ?
 
  I have cut out a lot of extraneous stuff that I don't think is
  pertinent.  Please let me know if you see something causing my
  problems.  The first query table has about 900 entries and the query
  returns about 90 hostnames.  The exclude table query has only 13
  hostnames and obviously returns all.  I am looking for a way to
  display the approximately 77 entries that are NOT in the exclude
  table.  Thanks again.
 
  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] RE: Further MySQL query problems...

2005-03-28 Thread NIPP, SCOTT V \(SBCSI\)
OK.  Maybe I am going about this in the wrong manner.  Here is
the SQL statement that I am starting out with.

$query = SELECT Hostname FROM Data
  WHERE CPU_IN_SVC = \Y\
  AND CPU_DNS = \blah.com\
  ORDER BY Hostname ASC;
This query provides me a complete list of all the systems in our
organization.  The following query provides me with a list of systems in
an exclusion table that should not be displayed.

$exclude_query = SELECT hostname FROM exclusion;

This one is obviously quite simple and straight-forward.  The
next query is one that will generate a list of systems on which the user
already has an account.

$query2= SELECT Data.Hostname FROM Data, acct_db
   WHERE Data.CPU_IN_SVC = \Y\
   AND Data.CPU_DNS = \blah.com\
   AND acct_db.key1 LIKE '$var%'
   AND acct_db.key1 LIKE CONCAT(\%\, Data.Hostname)
   ORDER BY Hostname ASC;
This query is very much like the first, but it also looks into
the acct_db table to match userids and hostnames.  This is currently a
separate query because this data is used to display information in a
separate section of the web page.

$query3= SELECT Data.Hostname FROM Data, accounts
   WHERE Data.CPU_IN_SVC = \Y\
   AND Data.CPU_DNS = \sbcld.sbc.com\
   AND accounts.uid = '$var'
   AND accounts.system = Data.Hostname
   AND accounts.ctime IS NULL
   ORDER BY Hostname ASC;
This query is also similar to the first , but it looks into the
accounts table to determine if the user has already submitted an account
request for the server, AND that this account has not yet been created
(ctime IS NULL).  Like the query above, this is a separate query since
it is used to populate a different section of the web page.

I do not know if it is possible to somehow combine all 4 of
these queries into a single complex query.  This would be preferred in
my mind as it would let the server do more work in fewer queries.  What
I would like to do is have a single query that would return the
hostnames with some kind of key that could then be used to determine
what criteria the query matched to specifically.  I am guessing that
this would be a numeric value that would be a secondary array element
associated with the hostname.  I would then write my display code to
check the value of this element to determine how/where to display the
data.
Thanks in advance for any help in this.  I have no idea if this
is possible, but I am guessing that it is.

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



-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 28, 2005 11:13 AM
To: NIPP, SCOTT V (SBCSI); php-db@lists.php.net
Subject: RE: [PHP-DB] RE: Further MySQL query problems...


why wouldn't you just run a query to return only the elements that you
want?

Bastien

From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] RE: Further MySQL query problems...
Date: Mon, 28 Mar 2005 10:49:24 -0600

   Oops...  Correction to the last line of the script.
   ?php } while ($blah = mysql_fetch_array($exclude_results)); ?

   Should be...
   ?php } while ($blah = array_shift($temp)); ?
Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com


   -Original Message-
  From:   NIPP, SCOTT V (SBCSI)
  Sent:   Monday, March 28, 2005 10:47 AM
  To: 'php-db@lists.php.net'
  Subject:Further MySQL query problems...
 
  I am having trouble in the following code.  Basically, I want to
  query two separate database tables and then generate an array from
  these two queries.  The first query will return a list of ALL
systems.
  The second query will return a list of systems that should be
  excluded.  The problem is that this is getting me nowhere.  Here is
  the pertinent code...
 
  $query = SELECT CPU_Hostname FROM AllMid_Data
WHERE CPU_IN_SVC = \Y\
AND CPU_DNS = \sbcld.sbc.com\
ORDER BY CPU_Hostname ASC;
  $results = mysql_query($query, $Prod) or die(mysql_error());
  $system = mysql_fetch_array($results, MYSQL_NUM);
  $exclude_query = SELECT hostname FROM exclusion;
  $exclude_results = mysql_query($exclude_query, $Prod);
  $exclude = mysql_fetch_array($exclude_results, MYSQL_NUM);
  $temp = array_diff($system, $exclude);
  ?php do {
  $sys = $blah[0];
  echo tr; ?
   ?php echo $sys; ?
?php echo /tr; } ?
  ?php } while ($blah = mysql_fetch_array($exclude_results)); ?
 
  I have cut out a lot of extraneous stuff that I don't think is
  pertinent.  Please let me know if you see something causing my
  problems.  The first query table has about 900 entries and the query
  returns about 90

RE: [PHP-DB] MySQL query problems...

2005-03-24 Thread NIPP, SCOTT V \(SBCSI\)
OK.  I think I have resolved this issue.  The problem I am
having now is that I have a simple table that is a list of systems to
exclude from the display.  I am having trouble figuring out how to
structure my query to actually exclude the systems in this table.  Here
is what I tried, and it gives me 13 instances of every entry, 13 is the
number of hostnames in the exclusion table.

$query = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, exclusion
  WHERE AllMid_Data.CPU_IN_SVC = \Y\ 
  AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\ 
  AND AllMid_Data.CPU_Hostname != exclusion.hostname
  ORDER BY CPU_Hostname ASC;
$results = mysql_query($query, $Prod) or die(mysql_error());
$system = mysql_fetch_assoc($results);

Additionally, what I am actually working towards is that if a
system shows up in either of the other queries it gets excluded from
this one.  I have not tried anything to make that happen yet.  I will
tackle that challenge once I can resolve this part.  Thanks again.

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



-Original Message-
From: J. Connolly [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 24, 2005 7:36 AM
Cc: php-db@lists.php.net
Subject: Re: [PHP-DB] MySQL query problems...


yeah...errora are important. I do not escape my quotation marks in a 
query. I use single quotes within my insert and select statements.
If it says No valis MySQL resource then you are returning 0 records 
which may be caused by escaping the quotations.

I follow this pattern
$sql =INSERT INTO table VALUES ('some value','another value','etc');

NIPP, SCOTT V (SBCSI) wrote:

   I am getting errors for the following queries.  This query seems
to work fine in phpMyAdmin.

$query2 = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, accounts
  WHERE AllMid_Data.CPU_IN_SVC = \Y\
  AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\
  AND accounts.sbcuid = $sbcuid
  AND accounts.system = AllMid_Data.CPU_Hostname
  AND accounts.ctime IS NULL
  ORDER BY CPU_Hostname ASC;
$results2 = mysql_query($query2, $Prod) or die(mysql_error());
$system2 = mysql_fetch_assoc($results2);
$query3 = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, acct_db
  WHERE AllMid_Data.CPU_IN_SVC = \Y\
  AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\
  AND acct_db.key1 LIKE \$sbcuid%\
  AND acct_db.key1 LIKE \%\.AllMid_Data.CPU_Hostname
  ORDER BY CPU_Hostname ASC;
$results3 = mysql_query($query3, $Prod) or die(mysql_error());
$system3 = mysql_fetch_assoc($results3);

   I am assuming that I have an issue with query3.  Thanks in
advance.
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



[PHP-DB] MySQL query problems...

2005-03-23 Thread NIPP, SCOTT V \(SBCSI\)
I am getting errors for the following queries.  This query seems
to work fine in phpMyAdmin.

$query2 = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, accounts
   WHERE AllMid_Data.CPU_IN_SVC = \Y\
   AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\
   AND accounts.sbcuid = $sbcuid
   AND accounts.system = AllMid_Data.CPU_Hostname
   AND accounts.ctime IS NULL
   ORDER BY CPU_Hostname ASC;
$results2 = mysql_query($query2, $Prod) or die(mysql_error());
$system2 = mysql_fetch_assoc($results2);
$query3 = SELECT AllMid_Data.CPU_Hostname FROM AllMid_Data, acct_db
   WHERE AllMid_Data.CPU_IN_SVC = \Y\
   AND AllMid_Data.CPU_DNS = \sbcld.sbc.com\
   AND acct_db.key1 LIKE \$sbcuid%\
   AND acct_db.key1 LIKE \%\.AllMid_Data.CPU_Hostname
   ORDER BY CPU_Hostname ASC;
$results3 = mysql_query($query3, $Prod) or die(mysql_error());
$system3 = mysql_fetch_assoc($results3);

I am assuming that I have an issue with query3.  Thanks in
advance.
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-DB] Working with multiple tables...

2005-03-21 Thread NIPP, SCOTT V \(SBCSI\)
I am working on revising a web request app that I have already
developed.  The app basically provides a list of system names with
checkboxes for a user to select to request accounts on the systems.  One
feature I am intending to add is that the app should check a separate
database of user accounts to see if the user already has an account on
the system.  I think I could get it to work by making a query of the
userid for each system, but this seems quite inefficient.  I would
rather somehow have a single query that gets a list of system names and
also checks the user account database at the same time to determine if
the user already has an account.  Then I would like to display ALL of
the systems, but grey out the ones that the user already has accounts
on.  Can someone help me figure out the best way to go about this?
Thanks in advance.

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



RE: [PHP-DB] Working with multiple tables...

2005-03-21 Thread NIPP, SCOTT V \(SBCSI\)
Within the same server, even the same database, just a different
table.

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



-Original Message-
From: Micah Stevens [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 21, 2005 1:47 PM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Working with multiple tables...



Seperate on another MySQL server, or seperate within the same MySQL
server?

On Monday 21 March 2005 11:44 am, NIPP, SCOTT V (SBCSI) wrote:
  I am working on revising a web request app that I have already
 developed.  The app basically provides a list of system names with
 checkboxes for a user to select to request accounts on the systems.
One
 feature I am intending to add is that the app should check a separate
 database of user accounts to see if the user already has an account on
 the system.  I think I could get it to work by making a query of the
 userid for each system, but this seems quite inefficient.  I would
 rather somehow have a single query that gets a list of system names
and
 also checks the user account database at the same time to determine if
 the user already has an account.  Then I would like to display ALL of
 the systems, but grey out the ones that the user already has
accounts
 on.  Can someone help me figure out the best way to go about this?
 Thanks in advance.

 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] MySQL error...

2004-12-10 Thread NIPP, SCOTT V \(SBCSI\)
No...  That is just some strange error generated by the cut and
paste.  The IS NOT NU LL that is...
The other issue with 'tablename'...  I simply typed 'tablename'
in the e-mail because I didn't remember the exact tablename when I was
typing the e-mail.  It does actually provide the name of the table that
the script is working with.
Thanks for the feedback.

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



-Original Message-
From: Norland, Martin [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 10, 2004 2:34 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL error...


 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] 
   I have been using a PHP page to update a database table for a
long time now.  
 Unfortunately, I have noticed that frequently when I perform an update
I get back an error
 saying Table 'tablename' doesn't exist.  This is becoming more and
more annoying.
[snip]
 $query = SELECT `id_sys`, atime, gid, shell FROM accounts WHERE atime
IS NOT NU LL AND ctime 
 IS NULL ORDER BY rtime ASC; $result = mysql_query($query, $Prod) or
die(mysql_error()); ?
snip

Strange behavior, can't say I've ever heard of/seen it - however...

IS NOT NU LL is not, strictly speaking, valid sql.  If that's not just
a weird line wrapping issue - that may point to part of your problem.

If the error you're getting back is literally Table 'tablename' doesn't
exist - then you're looking in the wrong code, and somewhere you have
code that says tablename instead of $tablename.  You may want to
grep for tablename to try to track that down.

Cheers,
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

-- 
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] MySQL error...

2004-12-10 Thread NIPP, SCOTT V \(SBCSI\)
I have been using a PHP page to update a database table for a
long time now.  Unfortunately, I have noticed that frequently when I
perform an update I get back an error saying Table 'tablename' doesn't
exist.  This is becoming more and more annoying.  The table obviously
exists as the page that I hit the update button on is populated from
this same page.  Additionally, if I backout and reload the page most of
the time it will work.  Any help would be greatly appreciated.

Mysql   3.23.49
PHP 4.2.3

?php require_once('useraccounts.lib.php');
session_start();
if (!isset($_SESSION['valid_user']))
{
  echo You must be logged in to use this application.  br;
  $return_url = $_SERVER['PHP_SELF'];
  session_register(return_url);
  echo Please a href=\../sa_login.php\ login/a now.  br;
  exit();
} else {
  $sbcuid = $valid_user;
}
while(isset($entry[0])) {
  $tmp = $entry[0];
  $update = UPDATE accounts SET ctime=NOW() WHERE id_sys='.$tmp.';
  $results = mysql_query($update, $Prod) or die(mysql_error());
  array_shift($entry);
}
mysql_select_db($database, $Prod);
$query = SELECT `id_sys`, atime, gid, shell FROM accounts WHERE atime
IS NOT NU
LL AND ctime IS NULL ORDER BY rtime ASC;
$result = mysql_query($query, $Prod) or die(mysql_error());
?

html
head
titleSBCLD User Account Request System/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body bgcolor=#CC
p align=centerfont color=#0033CC
size=6strongAdministration/strong
/font/p
p align=centerfont size=4Here are the details for the accounts
approved
and pending creation:/font/p
p align=center

form method=post action=account_details.php
table width=90% bgcolor=#CC cellspacing=0
  tr bordercolor=#CC
td width=20% height=23div align=centerfont
color=#CC size=
3Requesting
  User/font/div/td
td width=10% valign=topdiv align=centerfont
color=#CCSyste
m/font/div/td
td width=10% valign=topdiv align=centerfont
color=#CCPrima
ry Group/font/div/td
td width=10% valign=topdiv align=centerfont
color=#CCD
efault Shell/font/div/td
td width=30% valign=topdiv align=centerfont
color=#CCReque
st Time/font/div/td
td width=10% valign=topdiv align=centerfont
color=#CCC
ompleted/font/div/td
  /tr

?php
  do {
$entry = $list['id_sys'];
$id = split('-', $list['id_sys']);
$sbcuid = $id[0];
$sys = $id[1];
if (isset($list['id_sys'])) {
  echo trtd width=\20%\div
align=\center\.$sbcuid./div/t
d;
  echo td width=\10%\div
align=\center\.$sys./div/td;
  echo td width=\15%\div
align=\center\.$list['gid']./div/
td;
  echo td width=\15%\div
align=\center\.$list['shell']./div
/td;
  echo td width=\30%\div
align=\center\.$list['atime']./div
/td;
  echo td width=\10%\div align=\center\input
name=\entry[]\
type=\checkbox\ value=$entry/div/td/tr;
}
  } while ($list = mysql_fetch_assoc($result));
?

/table

  p align=centerPlacing a check in the completed box will update the
databas
e entry for
this request with a completed time and remove this entry from this
page upon
clicking the Update button below./p
  div align=center
  input type=submit value=Update
  /div
/form

/body
/html

Thanks in advance.  This is really beginning to bug the crap out
of me.

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


RE: [PHP-DB] Time Field

2004-10-28 Thread NIPP, SCOTT V \(SBCSI\)
Why would you not simply use a 'datetime' field type?  This gets
you exactly what you are looking for unless I am misreading what you are
doing here...

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



-Original Message-
From: Bomgardner, Mark A [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 28, 2004 10:10 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Time Field


When creating a time field in MySQL, its purpose is for elapsed time,
not time of day.  Is it better to use this field or to combine it with
the date field when looking at inserting the start date and time of an
event? 

 

Mark A. Bomgardner 
Technology Specialist 
KLETC 

 

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



[PHP-DB] Auto-increment questions...

2004-10-05 Thread NIPP, SCOTT V \(SBCSI\)
I am working on a database application for Unix user accounts.
I want to be able to have a system that will provide me the next
available numeric user ID.  I have created a 2 column index table that
simply includes UID and user name.  This field is autoincrement and the
primary key for the table.  Currently this field only contains a very
small sample of users.  Basically, I have numeric IDs 3000, 3001, 3008,
and 3028.  My problem is that I am not sure how to query this table to
get the next available numeric ID which is 3002.  If I do an insert into
this table without specifying a value for the auto_increment column it
comes up with 3029.  Is there a way to query and/or insert such that it
comes up with the next unused numeric value?

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



RE: [PHP-DB] Auto-increment questions...

2004-10-05 Thread NIPP, SCOTT V \(SBCSI\)
OK.  The problem is I don't want the next highest number.
There are gaps in the UID sequence.  I need to find the next UNUSED
number in the sequence which is rarely the highest number.

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



-Original Message-
From: Bastien Koert [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 05, 2004 12:45 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Auto-increment questions...


If its an autoincrement, the next highest number will be assigned by the
db. 
There is no need to query the db to find it. Simply insert the record
and 
leave the id field out of the insert statement.

bastien


From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Auto-increment questions...
Date: Tue, 5 Oct 2004 11:58:41 -0500

   I am working on a database application for Unix user accounts.
I want to be able to have a system that will provide me the next
available numeric user ID.  I have created a 2 column index table that
simply includes UID and user name.  This field is autoincrement and the
primary key for the table.  Currently this field only contains a very
small sample of users.  Basically, I have numeric IDs 3000, 3001, 3008,
and 3028.  My problem is that I am not sure how to query this table to
get the next available numeric ID which is 3002.  If I do an insert
into
this table without specifying a value for the auto_increment column it
comes up with 3029.  Is there a way to query and/or insert such that it
comes up with the next unused numeric value?

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


_
Scan and help eliminate destructive viruses from your inbound and
outbound 
e-mail and attachments. 
http://join.msn.com/?pgmarket=en-capage=byoa/premxAPID=1994DI=1034SU
=http://hotmail.com/encaHL=Market_MSNIS_Taglines 
  Start enjoying all the benefits of MSN(r) Premium right now and get
the 
first two months FREE*.

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



[PHP-DB] LAST_INSERT_ID?????

2004-07-15 Thread NIPP, SCOTT V (SBCSI)
OK.  I know that a BUNCH of people have had this question, and I
have read numerous Google threads on this, but nothing really seems to
point out the resolution...  I have a table with the Primary Key as an
auto_increment field.  Once I insert a new row of data into the table I
want to direct the user to a Submitted page.  I am trying to pull the
entry number to display for the user as a ticket number.  I would
assume that I should use the LAST_INSERT_ID function for this.
Unfortunately, I am getting either failures or all zeroes for this
output.
I can't even get this function to work in a SQL query window.
Please help!!!  I would attach code to this, but I am not sure what to
attach.

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-DB] Array sorting question...

2004-01-23 Thread NIPP, SCOTT V (SBCSI)
I am trying to populate an array from a MySQL database.  I think I
have the code correct to populate the array, but I need to somehow sort the
array eliminating duplicate values.  I think I can loop through the array
doing a comparison and building a new array by discarding the value if it is
a duplicate, but I was not sure if there was a more efficient way of doing
this.  I am already looping through the database query results, and I am
just thinking about efficiency here.
Here is a code sample with a little more description of what I am
attempting...

?php
  do {
$entry = $list['id_sys'];
$id = split('-', $list['id_sys'], 1);
$sbcuid = $id[0];
$users[] = '$sbcuid';  
  } while ($list = mysql_fetch_assoc($result));
?

This query pulls a value from the database that is a
username-hostname value.  What I am working on is building a page that has a
unique list of usernames that link to a second page of user account
information.  There may be twenty user account on different hosts for the
same username.  I only want to have the username link created once on this
page.  I hope that makes since to everyone.  Thanks in advance for any 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-DB] Parse Errors...

2003-10-09 Thread NIPP, SCOTT V (SBCSI)
I keep receiving a parse error every time I try and view the page I
am working on.  I am developing this very simple application in DreamWeaver
MX 2004.  Here are lines 3-16:

?php
mysql_select_db($database_Prod, $Prod);
$query_Host = SELECT Name FROM systems;
$Host = mysql_query($query_Host, $Prod) or die(mysql_error());
$row_Host = mysql_fetch_assoc($Host);
$totalRows_Host = mysql_num_rows($Host);

mysql_select_db($database_ProdUsers, $ProdUsers);
$query_UserMod = SELECT shell, home_dir FROM modification;
$UserMod = mysql_query($query_UserMod, $ProdUsers) or die(mysql_error());
$row_UserMod = mysql_fetch_assoc($UserMod);
$totalRows_UserMod = mysql_num_rows($UserMod);

?

I am simply attempting to pull data from two separate tables in two
separate databases.  Every time I try to view my work, I am getting a parse
error on the 'mysql_select_db($database_ProdUsers, $ProdUsers);' regardless
of whether this is the first or second mysql_select_db.  I imagine that I am
simply doing something obviously wrong here.  Please help.  Thanks.


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



RE: [PHP-DB] Logic Help...

2003-08-28 Thread NIPP, SCOTT V (SBCSI)
Thanks for all the help.  I was finally able to get this working
properly by viewing the variable data as suggested.  I then ran into another
minor issue with session variables keeping their old values on a second pass
through the application, but I resolved this by unregistering these
variables before sending the user back through the application.  One strange
thing I noticed was that you can register multiple variables with a single
session_register, but you have to unregister only a single variable at a
time.  Anyone know anything more about this?  Am I doing something wrong, or
is it this way by design?  Thanks.

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 27, 2003 4:10 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Logic Help...


From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]


 Thanks for the feedback.  This seems to have helped, but something
 is still not working with the logic.  Here is the updated code:

 ?php
   while($cntr != 0) {
 $cntr--;
 if (($shell[$cntr] == ) || ($grp[$cntr] == )) {
   echo p align=\center\font color=\#99\
 size=\4\Sorry, but your request was not filled out completely.  Please
 resubmit this request ensuring that you have selected a Primary Group and
 Default Shell./font/p;
   echo p align=\center\font color=\#99\ size=\4\Please
 follow this a
 href=\http://ldsa.sbcld.sbc.com/DW/NewUser/newuser.php\;link/a to
return
 to the beginning of the request process./font/p;
   exit;
 }
   }
 ?

 Now, the test conditions never seem to enter into this portion of
 code.  I am unable to figure out why at this point.  Thanks again for the
 help.

Okay... let's do some basic debugging now. What does print_r($shell) and
print_r($grp) display? Are there any entries that are equal to an empty
string?

---John Holmes...

-- 
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] Logic Help...

2003-08-27 Thread NIPP, SCOTT V (SBCSI)
Thanks for the feedback.  This seems to have helped, but something
is still not working with the logic.  Here is the updated code:

?php
  while($cntr != 0) {
$cntr--;
if (($shell[$cntr] == ) || ($grp[$cntr] == )) {
  echo p align=\center\font color=\#99\
size=\4\Sorry, but your request was not filled out completely.  Please
resubmit this request ensuring that you have selected a Primary Group and
Default Shell./font/p;
  echo p align=\center\font color=\#99\ size=\4\Please
follow this a
href=\http://ldsa.sbcld.sbc.com/DW/NewUser/newuser.php\;link/a to return
to the beginning of the request process./font/p;
  exit;
}
  }
?

Now, the test conditions never seem to enter into this portion of
code.  I am unable to figure out why at this point.  Thanks again for the
help.

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 26, 2003 9:15 AM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Logic Help...


From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]


 This isn't specifically a DB related question, but...  The following
 code snippet is not functioning for me.  I keep receiving a parse error on
 the if line.  Basically I want to stop execution of this page if either
of
 the conditions in the if statement exist.  Thanks in advance.


 #  while($cntr != 0) {
 #if (($shell[$cntr] eq ) || ($grp[$cntr] eq Primary Gr)) {

Umm... you don't use 'eq' in PHP, you use == (that's two equal signs).

---John Holmes...

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



[PHP-DB] Logic Help...

2003-08-26 Thread NIPP, SCOTT V (SBCSI)
This isn't specifically a DB related question, but...  The following
code snippet is not functioning for me.  I keep receiving a parse error on
the if line.  Basically I want to stop execution of this page if either of
the conditions in the if statement exist.  Thanks in advance.


#  while($cntr != 0) {
#if (($shell[$cntr] eq ) || ($grp[$cntr] eq Primary Gr)) {
# echo p align=\center\font color=\#99\
size=\4\Sorry, but your request was not filled out completely.  Please
resubmit this request ensuring that you have selected a Primary Group and
Default Shell./font/p;
#  echo p align=\center\font color=\#99\ size=\4\Please
follow this a
href=\http://ldsa.sbcld.sbc.com/sa_bulletin/sa_board.htm\;link/a to
return to the beginning of the request process./font/p;
# exit;
#   }
#  }


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-DB] PHP/MySQL Default Field Value...

2003-08-20 Thread NIPP, SCOTT V (SBCSI)
I have a script that is going into semi-production and during this
process a new problem was uncovered.  I have the table a couple of table
fields setup  as Not NULL with a Default value.  The problem is that if
the user fails to select anything I get garbage in one of the fields and
nothing in the other.  I think this might be due to the PHP variable
grabbing something, but I am not sure what.  Here is the pertinent code.

{ Code snippet  }
$a = 0;
$accnts = array();
$shells = array();
$grps = array();
$others = array();

mysql_select_db($database, $Prod);
$shell_list = getEnumOptions('accounts','shell');
$shell_tmp = select size=\1\ name=\shell[]\\n;
$shell_tmp .= optionDefault Shell/option\n;
foreach ($shell_list as $item) {
  $shell_tmp .= option$item/option\n;
}
$shell_tmp .= /select\n;

$query_groups = SELECT name FROM grps;
$groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error());
$grp_list = select size=\1\ name=\grp[]\\n;
$grp_list .= optionPrimary Group/option\n;
$grp_list .= option---/option\n;
while($name = mysql_fetch_row($groups_tmp)) {
  $grp_list .= option$name[0]/option\n;
}
$grp_list .= /select\n;

{ Code snippet  }
form name=form1 method=post action=account_final.php

?php
  while (isset($_POST['system'][$a])) { 
echo td width=\20%\div align=\center\font
color=\99\.$_POST['system'][$a]./font/div/td;
echo td width=\20%\div
align=\center\.$shell_tmp./div/td;
echo td width=\20%\div
align=\center\.$grp_list./div/td;
echo td width=\20%\div align=\center\input type=\text\
name=\other[]\ value=\\ size=\15\/div/td/tr;
$tmp = $sbcuid.-.$_POST['system'][$a];
$a++;
array_push( $accnts, $tmp );
  }
?

Thanks in advance for any 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-DB] RE: Session help...

2003-07-30 Thread NIPP, SCOTT V (SBCSI)
Thanks for the responses.  I ended up resolving this by fixing the
form destination.  I had hard coded a location in there, and did not realize
this.  Once I replaced this with the PHP variable everything magically
started to work.  My bad on that.  Thanks again for the feedback though.

-Original Message-
From: Ow Mun Heng [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 29, 2003 11:13 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: Session help...


As mentioned previously in this list,

$_SESSION and session_register, session_is_register, is not compatible with
each other.

Anyway, I used your idea as inspiration for my own code.. My code works.. 

Try to change From:
if (!session_is_registered(valid_user)) {

To:
if ($_SESSION['valid_user']){
//your code
}

Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168


-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 29, 2003 9:19 PM
To: [EMAIL PROTECTED]
Subject: Session help...


Sorry for the slightly off-topic post...  I have a couple pages that
use a login page.  If the user tries to bring up one of these pages without
being logged in, then the pages redirects him to the login page.  After
successful login, the user is directed back to the page they were attempting
to originally load.  For some reason, this is not working and I have been
looking at this off and on for two days now without much luck.  The first
section of code is the snippet that directs users to the login page, and the
second snippet is the code from the login page that sends users back.

First code snippet...

session_start();
if ($sbcuid  $passwd) {
  mysql_select_db($database, $Prod);
  $query = select * from contacts_sa 
   . where sbcuid='$sbcuid' and passwd='$passwd';
  $result = mysql_query($query, $Prod) or die(mysql_error());
  # $data = mysql_fetch_assoc($result);
  $test = mysql_num_rows($result);
  if (mysql_num_rows($result) 0 )
  {
$valid_user = $sbcuid;
$_SESSION['valid_user'] = $sbcuid;
  }
}

if (!session_is_registered(valid_user)) {
  $return_url = $_SERVER['PHP_SELF'];
  $_SESSION['return_url'] = $return_url;
  header('Location: http://ldsa.sbcld.sbc.com/DW/sa_login.php');
  exit();
} else {
  $sbcuid = $valid_user;
}

End of first snippet...

Second code snippet...

session_start();
if ($sbcuid  $passwd) {
  if (isset($_SESSION['return_url'])) {
$link = $_SESSION['return_url'];
} else {
  $link = 'oncall_log.php';
  }
  mysql_select_db($database, $Prod);
  $query = select * from contacts_sa 
   . where sbcuid='$sbcuid' and passwd='$passwd';
  $result = mysql_query($query, $Prod) or die(mysql_error());
  # $data = mysql_fetch_assoc($result);
  $test = mysql_num_rows($result);
  if (mysql_num_rows($result) 0 ) {
$valid_user = $sbcuid;
# session_register(valid_user);
$_SESSION['valid_user'] = $sbcuid;
header(Location: http://.$_SERVER['HTTP_HOST'].$link);
  }
}

End of second snippet...

Thanks in advance for any 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-DB] Session help...

2003-07-29 Thread NIPP, SCOTT V (SBCSI)
Sorry for the slightly off-topic post...  I have a couple pages that
use a login page.  If the user tries to bring up one of these pages without
being logged in, then the pages redirects him to the login page.  After
successful login, the user is directed back to the page they were attempting
to originally load.  For some reason, this is not working and I have been
looking at this off and on for two days now without much luck.  The first
section of code is the snippet that directs users to the login page, and the
second snippet is the code from the login page that sends users back.

First code snippet...

session_start();
if ($sbcuid  $passwd) {
  mysql_select_db($database, $Prod);
  $query = select * from contacts_sa 
   . where sbcuid='$sbcuid' and passwd='$passwd';
  $result = mysql_query($query, $Prod) or die(mysql_error());
  # $data = mysql_fetch_assoc($result);
  $test = mysql_num_rows($result);
  if (mysql_num_rows($result) 0 )
  {
$valid_user = $sbcuid;
$_SESSION['valid_user'] = $sbcuid;
  }
}

if (!session_is_registered(valid_user)) {
  $return_url = $_SERVER['PHP_SELF'];
  $_SESSION['return_url'] = $return_url;
  header('Location: http://ldsa.sbcld.sbc.com/DW/sa_login.php');
  exit();
} else {
  $sbcuid = $valid_user;
}

End of first snippet...

Second code snippet...

session_start();
if ($sbcuid  $passwd) {
  if (isset($_SESSION['return_url'])) {
$link = $_SESSION['return_url'];
} else {
  $link = 'oncall_log.php';
  }
  mysql_select_db($database, $Prod);
  $query = select * from contacts_sa 
   . where sbcuid='$sbcuid' and passwd='$passwd';
  $result = mysql_query($query, $Prod) or die(mysql_error());
  # $data = mysql_fetch_assoc($result);
  $test = mysql_num_rows($result);
  if (mysql_num_rows($result) 0 ) {
$valid_user = $sbcuid;
# session_register(valid_user);
$_SESSION['valid_user'] = $sbcuid;
header(Location: http://.$_SERVER['HTTP_HOST'].$link);
  }
}

End of second snippet...

Thanks in advance for any 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



RE: [PHP-DB] MySQL Date insert

2003-07-28 Thread NIPP, SCOTT V (SBCSI)
I actually think I know part of this answer...  I don't think you
need to define a variable to insert into your date field.  Inserting an
empty value into this filed will populate the field in the database with the
current time, which it appears from your code is what you are trying to do
here.  Try changing the field name and give that a shot.  I think I am
actually right here though.

Scott

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
Sent: Monday, July 28, 2003 1:19 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] MySQL Date insert


Don't know about your date format, but you have named your table column DATE
which is a reserved keyword in MySQL. Try naming that something different
and see if you still get the error.

 -Original Message-
 From: Andrew D. Luebke [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 28, 2003 2:17 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] MySQL Date insert
 
 
 Hello,
 I have the following PHP code:
 
  $date = date(Y-m-d H:i:s);
  $result = mysql_query(INSERT INTO Boats (Make, 
 Model, Serial, 
 Stock, Extension, Cust_Name, Store, Date) VALUES
  ('$make', '$model', '$serial', '$stock', 
 '$extension', 
 '$name', '$store', '$date')
  or die(Invalid query:  . mysql_error() . 
 /body/html);
 
 The problem is with the Date column.  It is of type DATETIME. 
  I get an 
 error on the second line of the insert statement.  I assume 
 I'm not putting 
 formatting the date-time variable correctly but I've tried 
 everything I can 
 think of, so any help is very much appreciated.  Thanks.
 
 Andrew. 
 

-- 
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] 4.2.3 session login problem...

2003-06-17 Thread NIPP, SCOTT V (SBCSI)
I have an application that is currently working fine under 4.1.2,
and I am in the process of upgrading to 4.2.3.  The problem is that after
upgrading PHP the application login no longer works.  Additionally, this
same application works fine on another machine running 4.2.3.  The only
difference in the machines is that the working one uses PHP as a static
module and the broken one uses PHP as a loadable module.  Anyone run into
this problem before?  Thanks in advance.

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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-06 Thread NIPP, SCOTT V (SBCSI)
I have actually discovered that the $td value is blank.  The reason
appears to be that the page is reloading when a button is pushed, and that
is when the $td value is being lost.  My question now is, how do I keep the
$td value after the page is reloaded?  I would rather keep the value from
the original query than perform another database query to populate this
value yet again.  Thanks yet again for the help.

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 2:14 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Datetime help in an INSERT...


  I am stumbling across something that I thought I have done before,
  and I am not having any luck finding an example of this.  Basically, I
am
  wanting to timestamp the date and time into new entries in a simple
 database
  table.  The following section is the actual code for this, and I cannot
  figure out how to get the date/time stamp to populate into the database.
  Thanks in advance for the help.  I suspect this is a very simple fix.
 
  $denylog = INSERT INTO deny (account, td, date) VALUES ($tmp, $td,
 NOW());
  $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error());

 The error I am receiving is:

 You have an error in your SQL syntax near ' NOW())' at line 1

Are you sure $td has a value? If it's blank, you'd get an error like that.

---John Holmes...

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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-06 Thread NIPP, SCOTT V (SBCSI)
OK.  I guess the next question would be what is the best option for
performance?  This portion of the app currently doesn't have any session
functionality built in.  I would be setting up the session for this sole
purpose.  I haven't worked with cookies yet.  I suppose the URL method might
work, I have just never like it because I think it looks unclean, just
personal preference there.
As to the $td question...  This is a variable that holds the userid
of the Technical Director who is the account approver.  This portion of
the app is simply an approval mechanism to an account request system that I
am developing.  The TD receives an e-mail with a link back to the approval
page to approve the requested accounts.  This approval then fires off an
e-mail to the SA responsible for user accounts to inform him to create the
newly approved account.
Well, thanks again for the feedback.  Hopefully I can get this going
pretty quick.  We are currently planning on rolling this app out to our user
community on Monday.  This is the last issue I have that I am aware of.

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 9:06 AM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Datetime help in an INSERT...


 I have actually discovered that the $td value is blank.  The reason
 appears to be that the page is reloading when a button is pushed, and that
 is when the $td value is being lost.  My question now is, how do I keep
the
 $td value after the page is reloaded?  I would rather keep the value from
 the original query than perform another database query to populate this
 value yet again.  Thanks yet again for the help.

Stick it in the session? cookie? URL? What is $td?

---John Holmes...

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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-06 Thread NIPP, SCOTT V (SBCSI)
Not sure exactly how I would implement this.  Currently the reload URL
is being provided via the $PHP_SELF variable.  I like using this, but
suppose I could change this if truly necessary.  Also, the $td is not
currently being passed into the function that generates the two buttons and
hence defines the reload URL.  I would rather not pass any additional
variables into this function as I just feel this is unclean.  Thanks again
for the idea, and any additional advice or suggestions are most appreciated.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 9:01 AM
To: NIPP, SCOTT V (SBCSI)
Subject: RE: [PHP-DB] Datetime help in an INSERT...



You could alway place it as a GET 

echo a href=\yourscript.com/yourpage.php?td=$td\; 


Gary Every 
Sr. UNIX Administrator 
Ingram Entertainment 
(615) 287-4876 
Pay It Forward 
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  
http://accessingram.com http://accessingram.com  


 -Original Message- 
 From: NIPP, SCOTT V (SBCSI) [ mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] ] 
 Sent: Thursday, June 05, 2003 8:57 AM 
 To: 'CPT John W. Holmes'; [EMAIL PROTECTED] 
 Cc: [EMAIL PROTECTED] 
 Subject: RE: [PHP-DB] Datetime help in an INSERT... 
 
 
   I have actually discovered that the $td value is blank. 
  The reason 
 appears to be that the page is reloading when a button is 
 pushed, and that 
 is when the $td value is being lost.  My question now is, how 
 do I keep the 
 $td value after the page is reloaded?  I would rather keep 
 the value from 
 the original query than perform another database query to 
 populate this 
 value yet again.  Thanks yet again for the help. 
 
 -Original Message- 
 From: CPT John W. Holmes [ mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] ] 
 Sent: Wednesday, June 04, 2003 2:14 PM 
 To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] 
 Cc: [EMAIL PROTECTED] 
 Subject: Re: [PHP-DB] Datetime help in an INSERT... 
 
 
   I am stumbling across something that I thought I have done before, 
   and I am not having any luck finding an example of this.  
 Basically, I 
 am 
   wanting to timestamp the date and time into new entries 
 in a simple 
  database 
   table.  The following section is the actual code for 
 this, and I cannot 
   figure out how to get the date/time stamp to populate 
 into the database. 
   Thanks in advance for the help.  I suspect this is a very 
 simple fix. 
   
   $denylog = INSERT INTO deny (account, td, date) VALUES 
 ($tmp, $td, 
  NOW()); 
   $denylog_result = mysql_query($denylog, $Prod) or 
 die(mysql_error()); 
  
  The error I am receiving is: 
  
  You have an error in your SQL syntax near ' NOW())' at line 1 
 
 Are you sure $td has a value? If it's blank, you'd get an 
 error like that. 
 
 ---John Holmes... 
 
 -- 
 PHP Database Mailing List ( http://www.php.net/ http://www.php.net/ ) 
 To unsubscribe, visit: http://www.php.net/unsub.php
http://www.php.net/unsub.php  
 



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-06 Thread NIPP, SCOTT V (SBCSI)
I just responded to a separate but similar suggestion.  The form
elements, including the buttons, are all generated in a separate function.
I am currently passing about 5 variables into this function and I am a
little hesitant to pass any others.  I am not sure about complexity,
performance, etc. in passing so many variables into a function.  Please let
me know if anyone has any ideas on this.  I doubt that this is happening,
but I would really like for the code to be as easily maintainable as
possible.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 9:48 AM
To: NIPP, SCOTT V (SBCSI)
Subject: RE: [PHP-DB] Datetime help in an INSERT...


a button is being pressed?
so it is processing a form?
if its in a form just pass along the value of $td via hidden input data...

input type=hidden name=td value=? echo $td; ?

jay merritt
[EMAIL PROTECTED]
[EMAIL PROTECTED]


   OK.  I guess the next question would be what is the best option for
 performance?  This portion of the app currently doesn't have any session
 functionality built in.  I would be setting up the session for this sole
 purpose.  I haven't worked with cookies yet.  I suppose the URL method
might
 work, I have just never like it because I think it looks unclean, just
 personal preference there.
   As to the $td question...  This is a variable that holds the userid
 of the Technical Director who is the account approver.  This portion of
 the app is simply an approval mechanism to an account request system that
I
 am developing.  The TD receives an e-mail with a link back to the
approval
 page to approve the requested accounts.  This approval then fires off an
 e-mail to the SA responsible for user accounts to inform him to create the
 newly approved account.
   Well, thanks again for the feedback.  Hopefully I can get this going
 pretty quick.  We are currently planning on rolling this app out to our
user
 community on Monday.  This is the last issue I have that I am aware of.
 
 -Original Message-
 From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 05, 2003 9:06 AM
 To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Datetime help in an INSERT...
 
 
  I have actually discovered that the $td value is blank.  The reason
  appears to be that the page is reloading when a button is pushed, and
that
  is when the $td value is being lost.  My question now is, how do I keep
 the
  $td value after the page is reloaded?  I would rather keep the value
from
  the original query than perform another database query to populate this
  value yet again.  Thanks yet again for the help.
 
 Stick it in the session? cookie? URL? What is $td?
 
 ---John Holmes...
 



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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-06 Thread NIPP, SCOTT V (SBCSI)
Thought I was on track, but stumped again...

I am now getting a completely different error that I cannot figure
out how it is related.  I have passed the $td variable into the function and
then get it back as a POST variable from a hidden field within the function.
Here is the error I am now seeing;

Unknown column 'sn4265' in 'field list'

This one is really throwing me at the moment as the only place the
value sn4265 is stored is in the $sbcuid variable.  This $sbcuid variable is
not a part of the INSERT that I am performing which I think is generating
this error.  I am guessing that you guys will need more info to help out
with this now.  Just let me know what you want.  Thanks again.

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 10:07 AM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: [PHP-DB] Datetime help in an INSERT...


Just pass the variable to your function. If you're using a form, then make
it a hidden element.

---John Holmes...

- Original Message - 
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: 'CPT John W. Holmes' [EMAIL PROTECTED]
Sent: Thursday, June 05, 2003 10:53 AM
Subject: RE: [PHP-DB] Datetime help in an INSERT...


 Do you think URL propagation is a better option than passing another
 variable into the function and then passing it back out through a hidden
 form element?  Here was another snippet from another suggestion on this.

 a button is being pressed?
 so it is processing a form?
 if its in a form just pass along the value of $td via hidden input data...

 input type=hidden name=td value=? echo $td; ?

 jay merritt
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]

 -Original Message-
 From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 05, 2003 9:53 AM
 To: NIPP, SCOTT V (SBCSI)
 Subject: Re: [PHP-DB] Datetime help in an INSERT...


 Propagating it in the URL is probably the best method.

 ---John Holmes...

 - Original Message - 
 From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
 To: 'CPT John W. Holmes' [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Thursday, June 05, 2003 10:44 AM
 Subject: RE: [PHP-DB] Datetime help in an INSERT...


  OK.  I guess the next question would be what is the best option for
  performance?  This portion of the app currently doesn't have any session
  functionality built in.  I would be setting up the session for this sole
  purpose.  I haven't worked with cookies yet.  I suppose the URL method
 might
  work, I have just never like it because I think it looks unclean, just
  personal preference there.
  As to the $td question...  This is a variable that holds the userid
  of the Technical Director who is the account approver.  This portion
of
  the app is simply an approval mechanism to an account request system
that
 I
  am developing.  The TD receives an e-mail with a link back to the
 approval
  page to approve the requested accounts.  This approval then fires off an
  e-mail to the SA responsible for user accounts to inform him to create
the
  newly approved account.
  Well, thanks again for the feedback.  Hopefully I can get this going
  pretty quick.  We are currently planning on rolling this app out to our
 user
  community on Monday.  This is the last issue I have that I am aware of.
 
  -Original Message-
  From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
  Sent: Thursday, June 05, 2003 9:06 AM
  To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP-DB] Datetime help in an INSERT...
 
 
   I have actually discovered that the $td value is blank.  The reason
   appears to be that the page is reloading when a button is pushed, and
 that
   is when the $td value is being lost.  My question now is, how do I
keep
  the
   $td value after the page is reloaded?  I would rather keep the value
 from
   the original query than perform another database query to populate
this
   value yet again.  Thanks yet again for the help.
 
  Stick it in the session? cookie? URL? What is $td?
 
  ---John Holmes...
 
  -- 
  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] PHP Upgrade question...

2003-06-06 Thread NIPP, SCOTT V (SBCSI)
I know there is another mailing list for installation questions, but
I am hoping for some help here.  I get enough mail from this list alone
without having to join another.  Anyway, while attempting to compile version
4.3.2 I am running into the following error during the configure...


checking whether byte ordering is bigendian... configure: error: can not run
tes
t program while cross compiling

At this point the configure simply dies.  I have no idea on how to
proceed from this.
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-DB] Datetime help in an INSERT...

2003-06-05 Thread NIPP, SCOTT V (SBCSI)
I am stumbling across something that I thought I have done before,
and I am not having any luck finding an example of this.  Basically, I am
wanting to timestamp the date and time into new entries in a simple database
table.  The following section is the actual code for this, and I cannot
figure out how to get the date/time stamp to populate into the database.
Thanks in advance for the help.  I suspect this is a very simple fix.

$denylog = INSERT INTO deny (account, td, date) VALUES ($tmp, $td, NOW());
$denylog_result = mysql_query($denylog, $Prod) or die(mysql_error());

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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread NIPP, SCOTT V (SBCSI)
The error I am receiving is:

You have an error in your SQL syntax near ' NOW())' at line 1

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:45 PM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: [PHP-DB] Datetime help in an INSERT...


what kind of error are you getting?

   I am stumbling across something that I thought I have done before,
 and I am not having any luck finding an example of this.  Basically, I am
 wanting to timestamp the date and time into new entries in a simple
database
 table.  The following section is the actual code for this, and I cannot
 figure out how to get the date/time stamp to populate into the database.
 Thanks in advance for the help.  I suspect this is a very simple fix.
 
 $denylog = INSERT INTO deny (account, td, date) VALUES ($tmp, $td,
NOW());
 $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error());
 
 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] Datetime help in an INSERT...

2003-06-05 Thread NIPP, SCOTT V (SBCSI)
No, the field is a Datetime field rather than a Timestamp field.

-Original Message-
From: Rankin, Randy [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:59 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Datetime help in an INSERT...


Correction ( I typed this in a hurry ) ...

If you are using MySql and the date field is of type timestamp, you should
_not_
have to insert anything using the query. It will update automatically when
the record is inserted and/or updated.

ie; $denylog = INSERT INTO deny (account, td ) VALUES ($tmp, $td );

Randy

-Original Message-
From: Rankin, Randy [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:56 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Datetime help in an INSERT...


If you are using MySql with the date field is of type timestamp, you should
have to insert anything using the query. It will update automatically when
the record is inserted and/or updated.

ie; $denylog = INSERT INTO deny (account, td ) VALUES ($tmp, $td );

Randy

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:47 PM
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Datetime help in an INSERT...


The error I am receiving is:

You have an error in your SQL syntax near ' NOW())' at line 1

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 1:45 PM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: [PHP-DB] Datetime help in an INSERT...


what kind of error are you getting?

   I am stumbling across something that I thought I have done before,
 and I am not having any luck finding an example of this.  Basically, I am
 wanting to timestamp the date and time into new entries in a simple
database
 table.  The following section is the actual code for this, and I cannot
 figure out how to get the date/time stamp to populate into the database.
 Thanks in advance for the help.  I suspect this is a very simple fix.
 
 $denylog = INSERT INTO deny (account, td, date) VALUES ($tmp, $td,
NOW());
 $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error());
 
 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

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



RE: [PHP-DB] Datetime help in an INSERT...

2003-06-05 Thread NIPP, SCOTT V (SBCSI)
I think this is the real problem.  Basically, the $td variable is
defined intially, but upon clicking a button the page reloads itself and I
believe that at this time it is losing the $td variable.  I am not quite
sure how to prevent this from occurring.  Thanks again for all the help so
far.

-Original Message-
From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 04, 2003 2:14 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Datetime help in an INSERT...


  I am stumbling across something that I thought I have done before,
  and I am not having any luck finding an example of this.  Basically, I
am
  wanting to timestamp the date and time into new entries in a simple
 database
  table.  The following section is the actual code for this, and I cannot
  figure out how to get the date/time stamp to populate into the database.
  Thanks in advance for the help.  I suspect this is a very simple fix.
 
  $denylog = INSERT INTO deny (account, td, date) VALUES ($tmp, $td,
 NOW());
  $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error());

 The error I am receiving is:

 You have an error in your SQL syntax near ' NOW())' at line 1

Are you sure $td has a value? If it's blank, you'd get an error like that.

---John Holmes...

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



[PHP-DB] Design question...

2003-03-26 Thread NIPP, SCOTT V (SBCSI)
Anyone have an links to websites that offer good tutorials on web
design?  I am most interested in learning about templates and how to design
these for use with PHP pages.  I am using DreamWeaver MX as a development
environment and would really like some help with DreamWeaver templates if
anyone knows of any.  Any good book recommendations would be most
appreciated too.  Thanks, and sorry for the slightly off topic post.

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



RE: [PHP-DB] Re: Empty display loop...

2003-03-26 Thread NIPP, SCOTT V (SBCSI)
OK...  I moved the form tag up before the table tag and added a tr
tag to the beginning of the first line of display in the loop.  No
difference in the output.  The first line of the output loop is still a
completely empty line.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 6:30 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Empty display loop...


Scott V Nipp [EMAIL PROTECTED] wrote:
I am working on a page that displays a line of information with a
 checkbox at the end.  I began by getting all of the information I wanted
 displayed working properly and now I am adding the checkbox.  Everything
is
 going find with the exception that all  of a sudden with the checkbox code
 in I am getting an empty line and checkbox at the beginning of the loop.
I
 cannot figure out where this is coming from.  Please let me know where I
 have gone wrong.

Snipping a lot so you can see the problem: 

 table width=90% bgcolor=#CC cellspacing=0
 form method=post action=account_details.php
 /table
 /form

Your nesting is bad. Put the form tag before the table.
And you don't have a tr in your loop.

Regards...
Michael

-- 
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] Empty display loop...

2003-03-25 Thread NIPP, SCOTT V (SBCSI)
I am working on a page that displays a line of information with a
checkbox at the end.  I began by getting all of the information I wanted
displayed working properly and now I am adding the checkbox.  Everything is
going find with the exception that all  of a sudden with the checkbox code
in I am getting an empty line and checkbox at the beginning of the loop.  I
cannot figure out where this is coming from.  Please let me know where I
have gone wrong.


table width=90% bgcolor=#CC cellspacing=0
  tr 
td width=20% height=23div align=centerRequesting User
ID/div/td
td width=10% valign=topdiv align=centerSystem Name/div/td
td width=10% valign=topdiv align=centerPrimary
Group/div/td
td width=10% valign=topdiv align=centerDefault
Shell/div/td
td width=30% valign=topdiv align=centerRequest Time/div/td
td width=10% valign=topdiv
align=centerCompleted/div/td
  /tr

form method=post action=account_details.php
?php
  do {
$entry = $list['id_sys'];
$id = split('-', $list['id_sys']);
$sbcuid = $id[0];
$sys = $id[1];
echo td width=\20%\div
align=\center\.$sbcuid./div/td;
echo td width=\10%\div align=\center\.$sys./div/td;
echo td width=\15%\div
align=\center\.$list['gid']./div/td;
echo td width=\15%\div
align=\center\.$list['shell']./div/td;
echo td width=\30%\div
align=\center\.$list['atime']./div/td;
echo td width=\10%\div align=\center\input
name=\entry[]\ type=\checkbox\ value=$entry/div/td/tr;
  } while ($list = mysql_fetch_assoc($result));
?

/table

  div align=center
  input type=submit value=Details
  /div
/form

This is the code for all of the section dealing with the data
display.  The rest of the page is just some extra text and formatting, as
well as the actual query code.  Thanks again.
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



RE: [PHP-DB] compare php and perl

2003-03-20 Thread NIPP, SCOTT V (SBCSI)
In response to your bullet points...

1. Built in mysql_ functions in php (does perl have this?)
Perl does not have built in functions for MySQL or any
other database.  The Perl functions are all added through modules.  This is
somewhat annoying as compared to PHP in that if you want to keep things
current, for the sake of keeping current, you have to update not only Perl,
but the DBI module and the DBD driver module also.  This is not to say that
you need to keep all of these individual components current.

2. Php may be faster.
This is true, more so in some situations than in others.  If
you are dealing with Apache, you can compile Perl directly into the web
server as a module.  This is very efficient.  However, my understanding is
that getting Perl compiled into Apache is very tricky.

3. Embedded in html - no separate cgi directory needed.
Yes.  The PHP code can be directly imbedded into your HTML
pages, but this is not always the best way to go.  Often you will want to
extract some information like database user IDs and passwords and store
these in an alternate directory location for security reasons.  You can also
include other files with commonly used functions and these may or may not
reside in your regular website structure.

4. Perl is more mature - more support - more depth to language.
Yes.  Perl is more mature in that it has most definitely
been around much longer.  In fact, PHP was derived from the authors
frustrations with using certain aspects of Perl.  That said, remember that
Perl is NOT a web scripting language, it is a multipurpose scripting
language that has been extended to handle web scripting.  PHP on the other
hand is a dedicated web scripting language.

The key thing to remember is that Perl and PHP are both tools.  Some
people may prefer one tool over another for their own personal reasons.
Pick the tool that best suits your purpose, and the one that you feel most
comfortable with.  If you have a LOT of Perl CGI experience, I don't know
that PHP would really offer you a great reason to go out and learn another
language (thought PHP is quite similar).  I would recommend PHP if you are
new to web scripting though, simply because this is exactly what PHP has
been developed for from the ground up.
Good luck, and I hope this helps.  I am sure that some of the other
experts, of which I am not one, will chime in to add their opinions and
correct any of my errors.  One other big advantage of PHP is this mailing
list.  The people in this list are quite knowledgeable and extremely
helpful.  I honestly have not found a group this supportive and responsive
for my Perl scripting.  (This last may sound like sucking up, but it's the
honest truth.)

-Original Message-
From: Mignon Hunter [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 12:43 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] compare php and perl


Can anyone out there compare these two using with mysql and web apps -
What I can gather so far from my limited experience with both and a
little googling:

1. Built in mysql_ functions in php (does perl have this?)
2. Php may be faster.
3. Embedded in html - no separate cgi directory needed.
4. Perl is more mature - more support - more depth to language.

Thx

-- 
Mignon Hunter
Web Developer
Toshiba International
713.466.0277 x 3461


-- 
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] Login and link back...

2003-03-19 Thread NIPP, SCOTT V (SBCSI)
I am curious about what you guys may have along the lines of best
practices for forwarding from a URL to a login, and then jumping back to the
original URL automatically.  I have several separate applications that all
need to utilize the same login mechanism.  I want the user to be able to
enter the URL for the application and if they are not logged in it redirects
them to a login screen.  I already have the sessions junk setup and
understand all of that portion.  I am mainly interested in how people are
handling the return to a URL after successful login.
I have done some research on this, and discovered the $HTTP_REFERER
variable however the PHP site discourages using this.  I have also thought
of adding code to each page to export an origin variable to be passed to
the login page such that it can be used to return the user.  I thought of
this method, but I am not real clear on how to manage this.  Does anyone
have any suggestion on implementing this, or another alternative that I have
not touched on yet?  Thanks in advance.

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-DB] Easy array question...

2003-03-12 Thread NIPP, SCOTT V (SBCSI)
I create an array on one page and then process it on the next page
as I have registered the array as a session variable.  I need to basically
process one of these arrays twice, so I want to make a copy of the array.
The question is how do I do this?  I have tried the following:

$array2 = $array1;

This doesn't seem to do the trick for me.  Is this correct and I am
just missing something elsewhere, or is there another way to copy an array?
Thanks.

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



RE: [PHP-DB] Easy array question...

2003-03-12 Thread NIPP, SCOTT V (SBCSI)
I don't think that is the case because I am able to access the
original array in this same page without having to use the session variable
reference.  Won't hurt to give it a try though.  Thanks for the feedback.

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 10:40 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Easy array question...


Are you using:

$array2 = $_SESSION[array1];

Not sure that will do the trick, but it was my first inclination.

Rich

 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 11:37 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] Easy array question...
 
 
   I create an array on one page and then process it on 
 the next page
 as I have registered the array as a session variable.  I need 
 to basically
 process one of these arrays twice, so I want to make a copy 
 of the array.
 The question is how do I do this?  I have tried the following:
 
 $array2 = $array1;
 
   This doesn't seem to do the trick for me.  Is this 
 correct and I am
 just missing something elsewhere, or is there another way to 
 copy an array?
 Thanks.
 
 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

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



RE: [PHP-DB] Easy array question...

2003-03-12 Thread NIPP, SCOTT V (SBCSI)
Here is basically what I have and what I am getting...

The section of code to copy and then process the copied array:

$other2 = array();
array_push($other2, $other);

foreach ($other2 as $test) {
if ($test == ) {
echo NOTHING.br;
} else {
echo $test.br;
}
}

Basically, what I want is if the array element is nothing, then
output as a test NOTHING.  If the array element has some value, then output
as a test that value.  Currently, from this code the output I am actually
getting is:

Array

Thanks again.

-Original Message-
From: Jonathan Villa [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 10:58 AM
To: [EMAIL PROTECTED]; NIPP, SCOTT V (SBCSI); 'Hutchins, Richard';
[EMAIL PROTECTED]
Subject: RE: [PHP-DB] Easy array question...


Sorry, I just reread your post

$array_copy = array();
array_push($array_copy, $original_array);

echo $array_copy[0];//or whatever to test

 
--- Jonathan
 
 
 

-Original Message-
From: Jonathan Villa [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2003 10:56 AM
To: 'NIPP, SCOTT V (SBCSI)'; 'Hutchins, Richard'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Easy array question...

$array_copy = array();
array_push($array_copy, $_SESSION['original_array']);

echo $array_copy[0];//or whatever to test

 
--- Jonathan
 
 
 
-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2003 10:43 AM
To: 'Hutchins, Richard'; '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Easy array question...

I don't think that is the case because I am able to access the
original array in this same page without having to use the session
variable
reference.  Won't hurt to give it a try though.  Thanks for the
feedback.

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 10:40 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Easy array question...


Are you using:

$array2 = $_SESSION[array1];

Not sure that will do the trick, but it was my first inclination.

Rich

 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 11:37 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] Easy array question...
 
 
   I create an array on one page and then process it on 
 the next page
 as I have registered the array as a session variable.  I need 
 to basically
 process one of these arrays twice, so I want to make a copy 
 of the array.
 The question is how do I do this?  I have tried the following:
 
 $array2 = $array1;
 
   This doesn't seem to do the trick for me.  Is this 
 correct and I am
 just missing something elsewhere, or is there another way to 
 copy an array?
 Thanks.
 
 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

-- 
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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Easy array question...

2003-03-12 Thread NIPP, SCOTT V (SBCSI)
GREAT.  This does the trick for me.  Thanks a lot.  I am now getting
the output I want, so I can now feel confident about inputting this into the
actual database.

-Original Message-
From: Katie Evans-Young [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 11:21 AM
To: NIPP, SCOTT V (SBCSI)
Subject: RE: [PHP-DB] Easy array question...


It's actually putting the whole of the array $other as the first element of
the array $other2. You're going to have to step through the array to copy
it.

foreach($other as $element) {
$other2[] = $element;
} //end foreach

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 11:10 AM
To: '[EMAIL PROTECTED]'; 'Hutchins, Richard'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Easy array question...


Here is basically what I have and what I am getting...

The section of code to copy and then process the copied array:

$other2 = array();
array_push($other2, $other);

foreach ($other2 as $test) {
if ($test == ) {
echo NOTHING.br;
} else {
echo $test.br;
}
}

Basically, what I want is if the array element is nothing, then
output as a test NOTHING.  If the array element has some value, then output
as a test that value.  Currently, from this code the output I am actually
getting is:

Array

Thanks again.

-Original Message-
From: Jonathan Villa [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 10:58 AM
To: [EMAIL PROTECTED]; NIPP, SCOTT V (SBCSI); 'Hutchins, Richard';
[EMAIL PROTECTED]
Subject: RE: [PHP-DB] Easy array question...


Sorry, I just reread your post

$array_copy = array();
array_push($array_copy, $original_array);

echo $array_copy[0];//or whatever to test


--- Jonathan




-Original Message-
From: Jonathan Villa [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 10:56 AM
To: 'NIPP, SCOTT V (SBCSI)'; 'Hutchins, Richard'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Easy array question...

$array_copy = array();
array_push($array_copy, $_SESSION['original_array']);

echo $array_copy[0];//or whatever to test


--- Jonathan



-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 10:43 AM
To: 'Hutchins, Richard'; '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Easy array question...

I don't think that is the case because I am able to access the
original array in this same page without having to use the session
variable
reference.  Won't hurt to give it a try though.  Thanks for the
feedback.

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 12, 2003 10:40 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Easy array question...


Are you using:

$array2 = $_SESSION[array1];

Not sure that will do the trick, but it was my first inclination.

Rich

 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 12, 2003 11:37 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] Easy array question...


   I create an array on one page and then process it on
 the next page
 as I have registered the array as a session variable.  I need
 to basically
 process one of these arrays twice, so I want to make a copy
 of the array.
 The question is how do I do this?  I have tried the following:

 $array2 = $array1;

   This doesn't seem to do the trick for me.  Is this
 correct and I am
 just missing something elsewhere, or is there another way to
 copy an array?
 Thanks.

 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

--
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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 1/21/2003

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.445 / Virus Database: 250 - Release Date: 1/21/2003

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



[PHP-DB] Stumped again...

2003-03-11 Thread NIPP, SCOTT V (SBCSI)
OK...  I have once again thought of something cool to do, and can't
quite figure out how to make it happen.  I am developing a user account
request system for work.  Things are coming along nicely.  The user logs
into the system, kind of, selects the systems that he wants to have accounts
added on, and then the next page is where the problems begin.  Once the user
selects the systems, the next page lists the systems selected along with a
dropdown for Default Shell and another dropdown for Primary Group and a
small text box for Other Group.  The dropdowns are populating fine, and
everything is displaying on the screen as expected.  The problem I am having
is that the selections don't seem to work.  I have this page feed a final
page that also displays the selections as a result test.  I am seeing the
system names, but no shell or group information.  
Here are some pertinent portions of the code with comments:

  Above code snipped  
$shell_list = getEnumOptions('accounts','shell');
$shell_tmp = select size=\1\ name=\shell\\n;
$shell_tmp .= optionDefault Shell/option\n;
foreach ($shell_list as $item) {
  $shell_tmp .= option$item/option\n;
}
$shell_tmp .= /select\n;

mysql_select_db($database, $Prod);
$query_groups = SELECT name FROM grps;
$groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error());
$grp_list = select size=\1\ name=\grp\\n;
$grp_list .= optionPrimary Group/option\n;
$grp_list .= option---/option\n;
while($name = mysql_fetch_row($groups_tmp)) {
  $grp_list .= option$name[0]/option\n;
}
$grp_list .= /select\n;
  Code snipped  

This section of code creates the Default Shell dropdown list and
the Primary Group dropdown list.  One of these lists is derived from the
ENUM values of the field, the other is derived from the values of a seperate
table.

  Code snipped  
form name=form1 method=post action=account_final.php

?php
  while (isset($_POST['system'][$a])) { 
echo td width=\20%\div
align=\center\.$_POST['system'][$a]./div/td;
echo td width=\20%\div
align=\center\.$shell_tmp./div/td;
echo td width=\20%\div
align=\center\.$grp_list./div/td;
echo td width=\20%\div align=\center\input type=\text\
name=\other\ value=\\ size=\15\/div/td/tr;
$tmp = $sbcuid.-.$_POST['system'][$a];
$a++;
array_push( $accnts, $tmp );
array_push( $shells, $shell );
array_push( $grps, $grp );
array_push( $others, $other );
 }
?
  Code snipped  

This section of code actually displays one line for each system
previously selected with additional input items for Default Shell,
Primary Group, and Other Group.  This code also creates arrays of the
systems, shells, groups, and others which are passed onto the next page.
This system array is used to display the results as well as populate the
database, and the system array data is the only data actually being
displayed.  I do not think that the data for the other arrays is actually
getting populated.

  Code snipped  
?php
  session_register(accnts, shells, grps, others);
?

div align=center
input type=submit name=Submit value=Submit
/div
/form
  Code snipped  

This section of code simply registers the arrays for use on the next
page.

Thanks in advance for any help.  Please let me know if you need any
other information to help figure out what is wrong with this.

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-DB] RE: Stumped again...

2003-03-11 Thread NIPP, SCOTT V (SBCSI)
I don't really understand this suggestion.  Could someone possibly
expound on this further?  Maybe an example?  Thanks.

-Original Message-
From: Ben Walling [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 11, 2003 12:19 PM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: Stumped again...


You need the value parameter for the option tags:

OPTION VALUE=1First
OPTION VALUE=2Second

Scott V Nipp [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
   OK...  I have once again thought of something cool to do, and can't
 quite figure out how to make it happen.  I am developing a user account
 request system for work.  Things are coming along nicely.  The user logs
 into the system, kind of, selects the systems that he wants to have
accounts
 added on, and then the next page is where the problems begin.  Once the
user
 selects the systems, the next page lists the systems selected along with a
 dropdown for Default Shell and another dropdown for Primary Group and
a
 small text box for Other Group.  The dropdowns are populating fine, and
 everything is displaying on the screen as expected.  The problem I am
having
 is that the selections don't seem to work.  I have this page feed a final
 page that also displays the selections as a result test.  I am seeing the
 system names, but no shell or group information.  
   Here are some pertinent portions of the code with comments:
 
   Above code snipped  
 $shell_list = getEnumOptions('accounts','shell');
 $shell_tmp = select size=\1\ name=\shell\\n;
 $shell_tmp .= optionDefault Shell/option\n;
 foreach ($shell_list as $item) {
   $shell_tmp .= option$item/option\n;
 }
 $shell_tmp .= /select\n;
 
 mysql_select_db($database, $Prod);
 $query_groups = SELECT name FROM grps;
 $groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error());
 $grp_list = select size=\1\ name=\grp\\n;
 $grp_list .= optionPrimary Group/option\n;
 $grp_list .= option---/option\n;
 while($name = mysql_fetch_row($groups_tmp)) {
   $grp_list .= option$name[0]/option\n;
 }
 $grp_list .= /select\n;
   Code snipped  
 
   This section of code creates the Default Shell dropdown list and
 the Primary Group dropdown list.  One of these lists is derived from the
 ENUM values of the field, the other is derived from the values of a
seperate
 table.
 
   Code snipped  
 form name=form1 method=post action=account_final.php
 
 ?php
   while (isset($_POST['system'][$a])) { 
   echo td width=\20%\div
 align=\center\.$_POST['system'][$a]./div/td;
   echo td width=\20%\div
 align=\center\.$shell_tmp./div/td;
   echo td width=\20%\div
 align=\center\.$grp_list./div/td;
   echo td width=\20%\div align=\center\input type=\text\
 name=\other\ value=\\ size=\15\/div/td/tr;
   $tmp = $sbcuid.-.$_POST['system'][$a];
   $a++;
   array_push( $accnts, $tmp );
 array_push( $shells, $shell );
 array_push( $grps, $grp );
 array_push( $others, $other );
  }
 ?
   Code snipped  
 
   This section of code actually displays one line for each system
 previously selected with additional input items for Default Shell,
 Primary Group, and Other Group.  This code also creates arrays of the
 systems, shells, groups, and others which are passed onto the next page.
 This system array is used to display the results as well as populate the
 database, and the system array data is the only data actually being
 displayed.  I do not think that the data for the other arrays is actually
 getting populated.
 
   Code snipped  
 ?php
   session_register(accnts, shells, grps, others);
 ?
 
 div align=center
 input type=submit name=Submit value=Submit
 /div
 /form
   Code snipped  
 
   This section of code simply registers the arrays for use on the next
 page.
 
   Thanks in advance for any help.  Please let me know if you need any
 other information to help figure out what is wrong with this.
 
 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-DB] RE: Stumped again...

2003-03-11 Thread NIPP, SCOTT V (SBCSI)
OK...  I think I understand what you are getting at here, but I
don't think this actually addresses the problem that I am having.  I have,
in other places, the direct value successfully passing from one page to
another.  In this case, what I am lacking is the selected data actually
getting populated into the array in the first place.

-Original Message-
From: Ben Walling [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 11, 2003 1:48 PM
To: NIPP, SCOTT V (SBCSI)
Cc: [EMAIL PROTECTED]
Subject: RE: Stumped again...


Your code:
while($name = mysql_fetch_row($groups_tmp)) {
  $grp_list .= option$name[0]/option\n;
}

should be changed to:
while($name = mysql_fetch_row($groups_tmp)) {
  $grp_list .= option value=.$name[0].$name[0]/option\n;
}

The value property of the option tag is actually what gets submitted to the
next page.  The text that immediately follows option value=x is what is
displayed to the user.

So, for this (HTML) code:
SELECT NAME=Test
OPTION VALUE=1Thing One
OPTION VALUE=2Thing Two
/SELECT

The user would see a list with:
Thing One
Thing Two

The next page would get either 1 or 2 as the value for Test.

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 11, 2003 2:43 PM
To: Ben Walling; '[EMAIL PROTECTED]'
Subject: RE: Stumped again...


I don't really understand this suggestion.  Could someone possibly
expound on this further?  Maybe an example?  Thanks.

-Original Message-
From: Ben Walling [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 11, 2003 12:19 PM
To: NIPP, SCOTT V (SBCSI)
Subject: Re: Stumped again...


You need the value parameter for the option tags:

OPTION VALUE=1First
OPTION VALUE=2Second

Scott V Nipp [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
   OK...  I have once again thought of something cool to do, and can't
 quite figure out how to make it happen.  I am developing a user account
 request system for work.  Things are coming along nicely.  The user logs
 into the system, kind of, selects the systems that he wants to have
accounts
 added on, and then the next page is where the problems begin.  Once the
user
 selects the systems, the next page lists the systems selected along with a
 dropdown for Default Shell and another dropdown for Primary Group and
a
 small text box for Other Group.  The dropdowns are populating fine, and
 everything is displaying on the screen as expected.  The problem I am
having
 is that the selections don't seem to work.  I have this page feed a final
 page that also displays the selections as a result test.  I am seeing the
 system names, but no shell or group information.  
   Here are some pertinent portions of the code with comments:
 
   Above code snipped  
 $shell_list = getEnumOptions('accounts','shell');
 $shell_tmp = select size=\1\ name=\shell\\n;
 $shell_tmp .= optionDefault Shell/option\n;
 foreach ($shell_list as $item) {
   $shell_tmp .= option$item/option\n;
 }
 $shell_tmp .= /select\n;
 
 mysql_select_db($database, $Prod);
 $query_groups = SELECT name FROM grps;
 $groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error());
 $grp_list = select size=\1\ name=\grp\\n;
 $grp_list .= optionPrimary Group/option\n;
 $grp_list .= option---/option\n;
 while($name = mysql_fetch_row($groups_tmp)) {
   $grp_list .= option$name[0]/option\n;
 }
 $grp_list .= /select\n;
   Code snipped  
 
   This section of code creates the Default Shell dropdown list and
 the Primary Group dropdown list.  One of these lists is derived from the
 ENUM values of the field, the other is derived from the values of a
seperate
 table.
 
   Code snipped  
 form name=form1 method=post action=account_final.php
 
 ?php
   while (isset($_POST['system'][$a])) { 
   echo td width=\20%\div
 align=\center\.$_POST['system'][$a]./div/td;
   echo td width=\20%\div
 align=\center\.$shell_tmp./div/td;
   echo td width=\20%\div
 align=\center\.$grp_list./div/td;
   echo td width=\20%\div align=\center\input type=\text\
 name=\other\ value=\\ size=\15\/div/td/tr;
   $tmp = $sbcuid.-.$_POST['system'][$a];
   $a++;
   array_push( $accnts, $tmp );
 array_push( $shells, $shell );
 array_push( $grps, $grp );
 array_push( $others, $other );
  }
 ?
   Code snipped  
 
   This section of code actually displays one line for each system
 previously selected with additional input items for Default Shell,
 Primary Group, and Other Group.  This code also creates arrays of the
 systems, shells, groups, and others which are passed onto the next page.
 This system array is used to display the results as well as populate the
 database, and the system array data is the only data actually being
 displayed.  I do not think that the data for the other arrays is actually
 getting populated.
 
   Code snipped  
 ?php
   session_register(accnts, shells, grps, others);
 ?
 
 div align=center

[PHP-DB] Query Help...

2003-03-10 Thread NIPP, SCOTT V (SBCSI)
I am having a lot of trouble with a query that works fine from a
basic SQL command line, but fails in my web script.  Here is the portion of
code including the query:

mysql_select_db($database, $Prod);
$query_groups = SELECT name FROM group;
$groups = mysql_query($query_groups, $Prod) or die(mysql_error());

Here is the error I am receiving:

You have an error in your SQL syntax near 'group' at line 1

I am wondering if for some reason group is trying to be
interperetted as the GROUP BY MySQL function?  I am running PHP 4.2.3
against a MySQL DB on an Apache 1.3.27 server.  Thanks in advance for 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



RE: [PHP-DB] Query Help...

2003-03-10 Thread NIPP, SCOTT V (SBCSI)
Thanks for all the advice, I thought it might have something to do
with being a reserved word.  I changed the table name from group to grps,
and everything works fine now.

-Original Message-
From: Rob Bryant [mailto:[EMAIL PROTECTED]
Sent: Monday, March 10, 2003 11:39 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Query Help...


- Original Message -
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, March 10, 2003 9:23 AM
Subject: [PHP-DB] Query Help...


 I am having a lot of trouble with a query that works fine from a
 basic SQL command line, but fails in my web script.  Here is the
portion of
 code including the query:

 mysql_select_db($database, $Prod);
 $query_groups = SELECT name FROM group;
 $groups = mysql_query($query_groups, $Prod) or die(mysql_error());

 Here is the error I am receiving:

 You have an error in your SQL syntax near 'group' at line 1


Have you tried using backticks in your query? E.g.,

$query_groups = SELECT name FROM `group`;

--
rob


-- 
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] Code for drop down lists

2003-02-11 Thread NIPP, SCOTT V (SBCSI)
I would most definitely recommend pulling them from a DB table
rather than hard coding these into a page.  Here is a code snippet that I
use to do this on one of my pages:

mysql_select_db($Prod, $Prod);
$query_systems = SELECT Name FROM systems ORDER BY Name ASC;
$systems = mysql_query($query_systems, $Prod) or die(mysql_error());
# $row_systems = mysql_fetch_assoc($systems);
$totalRows_systems = mysql_num_rows($systems);
$sys_list = select size=\1\ name=\system\\n;
$sys_list .= optionSystem Name/option\n;
$sys_list .= option---/option\n;
while($name = mysql_fetch_row($systems)) {
  $sys_list .= option$name[0]/option\n;
}
$sys_list .= /select\n;

  snip...HTML portion below 

td width=124 valign=topdiv align=rightSystem Name:/div/td
  td colspan=2 valign=top 
?=$sys_list?

 snip 

I also do this with Enum field selections using the following
function that someone passed on to me:

function getEnumOptions($table, $field) {
   global $finalResult;
   $finalResult = array();

   if (strlen(trim($table))  1) return false;
   $query  = show columns from $table;
   $result = mysql_query($query);
   while ($row = mysql_fetch_array($result)){
if ($field != $row[Field]) continue;
//check if enum type
if (ereg('enum.(.*).', $row['Type'], $match)) {
$opts = explode(',', $match[1]);
foreach ($opts as $item)
$finalResult[] = substr($item, 1, strlen($item)-2);
}
else
return false;
   }
   return $finalResult;

You can then use code similar to the first example to create your
dropdown list from Enum field values.  I hope this helps.

-Original Message-
From: Roland Perez [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 11:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Code for drop down lists


I am a novice to PHP and am trying toget a survey with drop down lists.
I am stuck as to if I should connect to the DB (MySQL DB) to get the
values from a table or do I imbed them in the php file?

Thanks for any help in advance.
Roland Perez
[EMAIL PROTECTED]

-- 
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] Weird PHP behavior...

2003-02-06 Thread NIPP, SCOTT V (SBCSI)
I developed some dynamic content for a larger web page, and once I
pasted the code into the appropriate area of the page I am seeing the
strangest error.  Here is the error:

Warning: Failed opening '/www/DW/index1.htm' for inclusion
(include_path='.:/usr/local/lib/php') in Unknown on line 0

I have tried this on 2 different servers running 2 different
versions of PHP, 4.1.2 and 4.2.3.  The code was developed and tested in a
blank page and then inserted into a much larger page developed in FrontPage
2002.  Any ideas?  Thanks in advance.

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




RE: [PHP-DB] Weird PHP behavior...

2003-02-06 Thread NIPP, SCOTT V (SBCSI)
Here is the working code...
 
?php 
 require_once(/www/DW/prod.lib.php);
 $hr = date(G);
 if ($hr  7) {
  $sql = mysql(Calendar2,SELECT B.Title, UNIX_TIMESTAMP(A.StartDate),
UNIX_TIMESTAMP(A.StopDate) FROM  `phpCalendar_Details`  AS B,
`phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID
AND CURDATE()  BETWEEN A.StartDate AND A.StopDate) or die(mysql_error());
  $mid = mktime (0,0,0,date(m)  ,date(d)+1,date(Y));
 } else {
  $sql = mysql(Calendar2,SELECT B.Title, UNIX_TIMESTAMP(A.StartDate),
UNIX_TIMESTAMP(A.StopDate) FROM  `phpCalendar_Details`  AS B,
`phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID
AND CURDATE()-2  BETWEEN A.StartDate AND A.StopDate) or die(mysql_error());
  $sql2 = mysql(Calendar2,SELECT B.Title FROM  `phpCalendar_Details`  AS
B,  `phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID =
B.CalendarDetailsID AND CURDATE()  BETWEEN A.StartDate AND A.StopDate) or
die(mysql_error());
  $res2 = mysql_fetch_row($sql2);
  $new = $res2[0];
  $mid = mktime (0,0,0,date(m)  ,date(d)-2,date(Y));
 }
 $res = mysql_fetch_row($sql);
 $sa = $res[0];
 $start = $res[1];
 $stop = $res[2];
 $day1 = date(l, $start);
 $date1 = date(jS, $start);
 $month1 = date(F, $start);
 $day3 = date(l, $stop);
 $date3 = date(jS, $stop);
 $month3 = date(F, $stop);
 if ($day1 == Friday) {
  $day2 = date(l, $mid);
  $date2 = date(jS, $mid);
  $month2 = date(F, $mid);
  if ($month1 != $month2) {
   $line2 = $month1 $date1, $month2 $date2 and $date3;
  } elseif ($month2 != $month3) {
   $line2 = $month1 $date1 and $date2, and $month3 $date3;
  } else {
   $line2 = $month1 $date1, $date2, and $date3;
  }
  $line1 = ONCALL SA for Friday, Saturday, and Sunday;
 } else {
  if ($month1 != $month3) {
   $line2 = $month1 $date1 and $date3;
  } else {
   $line2 = $month1 $date1 and $month3 $date3;
  }
  $line1 = ONCALL SA for $day1 and $day3;
 }
 
 mysql_select_db($database, $Prod);
 $query = SELECT name, pager FROM contacts_sa WHERE sbcuid='$sa';
 $said = mysql_query($query, $Prod) or die(mysql_error());
 $row = mysql_fetch_row($said);
 $name = $row[0];
 $pager = $row[1];
 
 if ($date3 == date(jS, $stop)  $hr  8) {
  $query2 = SELECT name FROM contacts_sa WHERE sbcuid='$new';
  $said2 = mysql_query($query2, $Prod) or die(mysql_error());
  $row2 = mysql_fetch_row($said2);
  $name2 = $row2[0];
  $line4 = Please be aware the On-Call turnover occurs at 8AM.  brThe
oncoming SA after 8AM will be $name2.;
 } else {
  $line4 = $name begins On-Call at 8AM on $day1.;
 }
?
html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head
 
body
  h2 align=centerspan lang=en-usCALL 214-741-6961 br
  FOR CURRENT ONCALL STATUS./span/h2
  hr color=#6363C9 size=3 width=50%
  p align=center?php echo $line1; ?br
  /span(span lang=en-us?php echo $line2; ?/span) br
  span lang=en-us?php echo $name; ? /span(pager span
lang=en-us
  ?php echo $pager; ?)br
  ?php echo $line4; ?/span/p
  hr color=#6363C9 size=3 width=50%
/body
/html

The portion of PHP code prior to the HTML is inserted at the top of the
file in the broken page.  Here is how the HTML portion of the PHP is
inserted...
 
snip...
  td background=images/bg_leftside.gif width=20nbsp;/td
  td width=20 background=images/bg_main.gifnbsp;/td
  td width=550 background=images/bg_main.gif valign=top
  p align=left dynamicanimation=fpAnimOutflyBottomRightFP1
id=fpAnimOu
tflyBottomRightFP1 style=position: relative !important
onclick=dynAnimOut(th
is) language=Javascript1.2nbsp;/p
 h2 align=centerspan lang=en-usCALL 214-741-6961 br
 FOR CURRENT ONCALL STATUS./span/h2
 hr color=#6363C9 size=3 width=50%
 p align=center?php echo $line1; ?br
 /span(span lang=en-us?php echo $line2; ?/span) br
 span lang=en-us?php echo $name; ? /span(pager span
lang=en-us

 ?php echo $pager; ?)br
 ?php echo $line4; ?/span/p
 hr color=#6363C9 size=3 width=50%
  h4 align=centerspan lang=en-usFor escalation procedures,
  a href=on-call/escalation.htmclick here./a/span/h4
  h4 align=centerspan lang=en-usFor restore requests call the
Help 
 
  Desk/span/h4
 
...snip

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 11:09 AM
To: NIPP, SCOTT V (SBCSI)
Subject: RE: [PHP-DB] Weird PHP behavior...



well show the working code and then show just a portion of the code that is
broken specifically where you are trying to inslucde the working code. 

K. 



NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED] 


02/06/2003 12:09 PM 



To:'[EMAIL PROTECTED]'
[EMAIL PROTECTED] 
cc: 
Subject:RE: [PHP-DB] Weird PHP behavior...



I can show the code, but do I show the working code?  If I show the
broken code, it is REALLY long. 
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL

RE: [PHP-DB] Weird PHP behavior...

2003-02-06 Thread NIPP, SCOTT V (SBCSI)
It turned out to be just a simple file permissions issue.

-Original Message-
From: Mohammad Saad [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 12:31 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: [PHP-DB] Weird PHP behavior...


Check path on this require
require_once(/www/DW/prod.lib.php);
something is wrong with this
- Original Message -
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, February 06, 2003 10:17 PM
Subject: RE: [PHP-DB] Weird PHP behavior...


 Here is the working code...

 ?php
  require_once(/www/DW/prod.lib.php);
  $hr = date(G);
  if ($hr  7) {
   $sql = mysql(Calendar2,SELECT B.Title, UNIX_TIMESTAMP(A.StartDate),
 UNIX_TIMESTAMP(A.StopDate) FROM  `phpCalendar_Details`  AS B,
 `phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID
 AND CURDATE()  BETWEEN A.StartDate AND A.StopDate) or die(mysql_error());
   $mid = mktime (0,0,0,date(m)  ,date(d)+1,date(Y));
  } else {
   $sql = mysql(Calendar2,SELECT B.Title, UNIX_TIMESTAMP(A.StartDate),
 UNIX_TIMESTAMP(A.StopDate) FROM  `phpCalendar_Details`  AS B,
 `phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID = B.CalendarDetailsID
 AND CURDATE()-2  BETWEEN A.StartDate AND A.StopDate) or
die(mysql_error());
   $sql2 = mysql(Calendar2,SELECT B.Title FROM  `phpCalendar_Details`
AS
 B,  `phpCalendar_Daily`  AS A WHERE A.CalendarDetailsID =
 B.CalendarDetailsID AND CURDATE()  BETWEEN A.StartDate AND A.StopDate) or
 die(mysql_error());
   $res2 = mysql_fetch_row($sql2);
   $new = $res2[0];
   $mid = mktime (0,0,0,date(m)  ,date(d)-2,date(Y));
  }
  $res = mysql_fetch_row($sql);
  $sa = $res[0];
  $start = $res[1];
  $stop = $res[2];
  $day1 = date(l, $start);
  $date1 = date(jS, $start);
  $month1 = date(F, $start);
  $day3 = date(l, $stop);
  $date3 = date(jS, $stop);
  $month3 = date(F, $stop);
  if ($day1 == Friday) {
   $day2 = date(l, $mid);
   $date2 = date(jS, $mid);
   $month2 = date(F, $mid);
   if ($month1 != $month2) {
$line2 = $month1 $date1, $month2 $date2 and $date3;
   } elseif ($month2 != $month3) {
$line2 = $month1 $date1 and $date2, and $month3 $date3;
   } else {
$line2 = $month1 $date1, $date2, and $date3;
   }
   $line1 = ONCALL SA for Friday, Saturday, and Sunday;
  } else {
   if ($month1 != $month3) {
$line2 = $month1 $date1 and $date3;
   } else {
$line2 = $month1 $date1 and $month3 $date3;
   }
   $line1 = ONCALL SA for $day1 and $day3;
  }

  mysql_select_db($database, $Prod);
  $query = SELECT name, pager FROM contacts_sa WHERE sbcuid='$sa';
  $said = mysql_query($query, $Prod) or die(mysql_error());
  $row = mysql_fetch_row($said);
  $name = $row[0];
  $pager = $row[1];

  if ($date3 == date(jS, $stop)  $hr  8) {
   $query2 = SELECT name FROM contacts_sa WHERE sbcuid='$new';
   $said2 = mysql_query($query2, $Prod) or die(mysql_error());
   $row2 = mysql_fetch_row($said2);
   $name2 = $row2[0];
   $line4 = Please be aware the On-Call turnover occurs at 8AM.  brThe
 oncoming SA after 8AM will be $name2.;
  } else {
   $line4 = $name begins On-Call at 8AM on $day1.;
  }
 ?
 html
 head
 titleUntitled Document/title
 meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
 /head

 body
   h2 align=centerspan lang=en-usCALL 214-741-6961 br
   FOR CURRENT ONCALL STATUS./span/h2
   hr color=#6363C9 size=3 width=50%
   p align=center?php echo $line1; ?br
   /span(span lang=en-us?php echo $line2; ?/span) br
   span lang=en-us?php echo $name; ? /span(pager span
 lang=en-us
   ?php echo $pager; ?)br
   ?php echo $line4; ?/span/p
   hr color=#6363C9 size=3 width=50%
 /body
 /html

 The portion of PHP code prior to the HTML is inserted at the top of
the
 file in the broken page.  Here is how the HTML portion of the PHP is
 inserted...

 snip...
   td background=images/bg_leftside.gif width=20nbsp;/td
   td width=20 background=images/bg_main.gifnbsp;/td
   td width=550 background=images/bg_main.gif valign=top
   p align=left dynamicanimation=fpAnimOutflyBottomRightFP1
 id=fpAnimOu
 tflyBottomRightFP1 style=position: relative !important
 onclick=dynAnimOut(th
 is) language=Javascript1.2nbsp;/p
  h2 align=centerspan lang=en-usCALL 214-741-6961 br
  FOR CURRENT ONCALL STATUS./span/h2
  hr color=#6363C9 size=3 width=50%
  p align=center?php echo $line1; ?br
  /span(span lang=en-us?php echo $line2; ?/span) br
  span lang=en-us?php echo $name; ? /span(pager span
 lang=en-us
 
  ?php echo $pager; ?)br
  ?php echo $line4; ?/span/p
  hr color=#6363C9 size=3 width=50%
   h4 align=centerspan lang=en-usFor escalation procedures,
   a href=on-call/escalation.htmclick here./a/span/h4
   h4 align=centerspan lang=en-usFor restore requests call the
 Help

   Desk/span/h4

 ...snip

 -Original Message-
 From: [EMAIL PROTECTED

RE: [PHP-DB] Date Range Question...

2003-02-04 Thread NIPP, SCOTT V (SBCSI)
WOW...  I have never even heard of BETWEEN before.  How does this
look to you?

SELECT StartDate, StopDate, LocationID FROM phpCalendar_Daily WHERE
CURDATE() BETWEEN StopDate AND StopDate

Would the query work like this?  This would mean I don't even have
to care about the difference of 2 or 3 days?

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 10:04 AM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Date Range Question...


 I am working on an app that needs to post information to a website
 based on date.  The tricky part for me is that the date is a range that
 spans either 2 or 3 days.  I want the web page to dynamically populate
this
 information based on a query.  The query will look something like this:
 mysql(Calendar2,SELECT StartDate, StopDate, LocationID FROM
 phpCalendar_Daily WHERE StartDate=CURDATE() )

 My question is say for example the StartDate is actually Jan. 1.
 The page is accessed on Jan. 2 or Jan. 3...  The  StartDate for the next
 entry is Jan. 4.  How do I write this query to select the proper entry?
In
 doing some research, it appears that a MySQL SELECT CASE might do the
 trick, but I have never used this before.  The other option I can envision
 is using PHP to handle the login and simply running the query, testing the
 result, if NULL, run the query again with CURDATE(-1).
 Any hints, ideas, or suggestions would be most appreciated.  Thanks
 in advance.

If I understand you correctly, I think you could use something like this:

SELECT StartDate, StopDate, LocationID FROM phpCalendar_Daily WHERE
StartDate BETWEEN CURDATE() AND CURDATE() - INTERVAL $x DAY

Where $x is 2 or 3, depending on your case.

---John Holmes...

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




RE: [PHP-DB] matching data from one table with another and displaying results?

2003-02-04 Thread NIPP, SCOTT V (SBCSI)
I have a JOIN that is not working, and figured I would piggie-back on this
thread to see if someone could give me a quick answer...  Here is the JOIN
syntax.  This is my very first attempt at a JOIN statement, so I may be
doing something blatantly wrong here.

SELECT 'A.Title'
FROM `phpCalendar_Daily` AS 'B'
JOIN 'phpCalendar_Details' AS 'A' ON 'B.CalendarDetailsID' =
'A.CalendarDetailsID'
WHERE CURDATE( ) 
BETWEEN 'StartDate' AND 'StopDate'

I am attempting this from the SQL window of phpMyAdmin, so this is not
embedded somewhere in a script and failing.  Thanks in advance.

-Original Message-
From: SELPH,JASON (HP-Richardson,ex1) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 10:59 AM
To: Aaron Wolski; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] matching data from one table with another and
displa ying results?


Seek out LEFT JOIN on mysql web site, thats what you want.

Cheers
Jason

-Original Message-
From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 10:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] matching data from one table with another and
displaying results?


Hi All,
 
Having a problem figuring out the logic of something here and hoping
someone can point me in the right direction.
 
I have 2 tables.
 
First table holds a listing of all Provinces and States. Here a brief of
what it looks like:
 
value label 
 
 AB   Alberta 
 BC   British Columbia 
 MB  Manitobia 
 NF   Newfoundland 
 NT   Northwest Territories 
 NS   Nova Scotia  
 
Second Table is an OrderTable which holds all order and customer info
including the province/state. The province/state is dumped from the
value column of the ProvinceTable. Meaning.. an order record would
show the province as AB or NS instead of Alberta or Nova Scotia.
 
I am creating an order report and in this report I want to display the
LABEL name of the Province/State that relates to an the province column
in the OrderTable.
 
I could simply just display all provinces/states from the ProvinceTable
but then there would be entries for selection that had NO orders.
 
Any idea on this? Thanks guys!
 
Aaron
 

-- 
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] A little JOIN help please...

2003-02-04 Thread NIPP, SCOTT V (SBCSI)
This is more of an SQL question, but I am not sure where else to
turn for help.  I am trying a JOIN, for the first time ever, and it is NOT
working for me.  The following is what I am attempting;

SELECT 'A.Title'
FROM `phpCalendar_Daily` AS 'B'
JOIN 'phpCalendar_Details' AS 'A' ON 'A.CalendarDetailsID' =
'B.CalendarDetailsID'
WHERE CURDATE( ) 
BETWEEN 'B.StartDate' AND 'B.StopDate'

This is simply in a SQL command window in phpMyAdmin, and it is
returning an error.  I have tried messing around with the quotes, and
everything else I can think of.  Someone please let me know what I am doing
wrong.  Thanks.

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




RE: [PHP-DB] A little JOIN help please...

2003-02-04 Thread NIPP, SCOTT V (SBCSI)
Thanks...  I was able to figure it out using what my book calls the
old method.  Here is what ended up working for me:

SELECT B.Title FROM  `phpCalendar_Details`  AS B,  `phpCalendar_Daily`  AS A
WHERE A.CalendarDetailsID = B.CalendarDetailsID AND CURDATE(  )  BETWEEN
A.StartDate AND A.StopDate

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 04, 2003 1:36 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: Re: [PHP-DB] A little JOIN help please...


 SELECT 'A.Title'
 FROM `phpCalendar_Daily` AS 'B'
 JOIN 'phpCalendar_Details' AS 'A' ON 'A.CalendarDetailsID' =
 'B.CalendarDetailsID'
 WHERE CURDATE( ) 
 BETWEEN 'B.StartDate' AND 'B.StopDate'

Take out all of those quotes! You're making strings out of everything.

WHERE CURDATE() BETWEEN 'string' AND 'anotherstring' etc...

---John Holmes...

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




RE: [PHP-DB] Send mail with a file

2003-01-16 Thread NIPP, SCOTT V (SBCSI)
Under Unix I don't know that this is possible, but hopefully someone
else will know of a way.  I would love to be able to e-mail some Excel files
that I generate with a Perl cron job, but there does not appear to be any
practical way to do this in Unix.

-Original Message-
From: Bruno Pereira [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 3:47 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Send mail with a file


How can i insert a file on a mail, with the command mail()? It is
possible?

Cumprimentos

Bruno Pereira
[EMAIL PROTECTED]

-Original Message-
From: Bruno Pereira [mailto:[EMAIL PROTECTED]]
Sent: quarta-feira, 15 de Janeiro de 2003 14:48
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Concatenate two strings


How can i join two strings.
My code is something like:
$valor1=bruno;
$valor2=Pereira;
$valor=$valor1 +   + $valor2

Can someone help me. Thanks.

Cumprimentos

Bruno Pereira
[EMAIL PROTECTED]


-- 
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] Duplicate keys...

2003-01-16 Thread NIPP, SCOTT V (SBCSI)
Thanks once again.  I finally figured this out late yesterday.  I
have no idea as to why whoever wrote this calendar to begin with did it this
way.  On suggestion I have for anyone looking at a calendar system to use or
modify is to absolutely NOT use phpCommunityCalendar.  This is a very poorly
coded piece of software, and if I as a relative PHP newbie know this, it is
really bad.

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 15, 2003 10:07 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Duplicate keys...


   OK, I cannot figure out why I keep getting errors about
Duplicate
 entry for key 1.  Someone please come to my rescue here as this is
truly
 kicking my but.

You have a key or unique column in your table that you're trying to
insert a duplicate value into.
 
 if ($dateDiff == 2) {
   mysql($DBName,INSERT INTO phpCalendar_Details VALUES (
   '$said','Comp day for weekend
 On-Call','','','','','','','','','',2,'$CalendarDetailsID')) or
 die(mysql_error());
 
   mysql($DBName,UPDATE Balances SET CompEarned=CompEarned+8,
 CompTaken=CompTaken+8 WHERE said='$said') or die(mysql_error());
   $result = mysql($DBName,SELECT LAST_INSERT_ID() FROM
 phpCalendar_Details) or die(mysql_error());
   while ($row = mysql_fetch_row($result)) {
   $CalendarDetailsID = $row[0];
   }
   mysql($DBName,INSERT INTO Log VALUES(
   '$entryid','$said','Comp',DATE_ADD('$StopDate',INTERVAL 1
 DAY),'Y','','Awarded for weekend On-Call','8','$CalendarDetailsID'))
or
 die(mysql_error());
 
   mysql($DBName,INSERT INTO phpCalendar_Daily VALUES(
   DATE_ADD('$StopDate',INTERVAL 1
DAY),'',1,2,'$CalendarDetailsID'))
 or die(mysql_error());
 }
 
 if ($dateDiff  0) {
 commonHeader($glbl_SiteTitle);
 echo centerfont color=\red\bYour END DATE COMES BEFORE YOUR
START
 DATE. Please complete the form below./b/font/centerp\n\n;
 
 } elseif ($Stop != 1) {
 
 if ($CalendarDetailsID) {
   $CalendarDetailsID = $CalendarDetailsID + 1;
 } else {
   $result = mysql($DBName,SELECT LAST_INSERT_ID() FROM
 phpCalendar_Details) or die(mysql_error());
   while ($row = mysql_fetch_row($result)) {
   $CalendarDetailsID = $row[0];
   }
 }
 
 mysql($DBName,INSERT INTO phpCalendar_Details VALUES (
 '$said','On-Call for $StartDate to
 $StopDate','','','','','','','','','',1,'$CalendarDetailsID')) or
 die(mysql_error());
 
 mysql($DBName,INSERT INTO phpCalendar_Daily VALUES(
 '$StartDate','$StopDate','1','1','$CalendarDetailsID')) or
 die(mysql_error());
 
   This is the only place in the script that is attempting to enter
 data into the CalendarDetailsID field.  This is the auto_increment
field
 that is having problems, I think.  The other strange part of this is
that
 thedata in the auto_increment field has two separate ranges (10 - 40
with
 gaps, and 70 - 78 with gaps).  I have been doing a lot of adding and
 removing of data to test during development, but I thought an
 auto_increment
 field would still track and deal with this correctly.

If you're trying to insert a number into an auto_increment field that's
already there, you'll get this error. You should always insert a NULL
value into an auto_increment column so MySQL will handle giving it the
number itself.

Also, don't worry about the gaps. They are irrelevant. If the gaps
matter to your program, then you are coding incorrectly. The
auto_increment column is there _only_ to provide a unique identifier for
each row and nothing else. 

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/


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




[PHP-DB] Date math functions...

2003-01-15 Thread NIPP, SCOTT V (SBCSI)
I have a question about using DATE_ADD in MySQL.  I am not sure if
this is the most effective way of dealing with this problem so I am asking
here.  The situation is that I am working on modifying a calendar system for
our use.  Our On-Call rotation is such that when someone is On-Call over the
weekend they automatically get Monday off.  I have created a page to
simplify inputting the On-Call schedule into the calendar system, and now I
want the Monday off to be automagically scheduled when a weekend On-Call is
entered.  The way that I see for doing this is adding 1 day to the end date
of the weekend On-Call and using that as the input for the day off
scheduling.  Here is a bit of what I have at this point...

if ($DailyStopYear) {
$result = mysql($DBName,SELECT (TO_DAYS('$StopDate') -
TO_DAYS('$StartDate'))) or die(mysql_error());
while ($row = mysql_fetch_row($result)) {
$dateDiff = $row[0];
}
} else {
$dateDiff = 0;
}

if ($dateDiff == 3) {
mysql($DBName,UPDATE Balances SET CompEarned=CompTaken+8 WHERE
said='$said') or die(mysql_error());
mysql($DBName,INSERT INTO Log VALUES('DATE_ADD($StopDate,
INTERVAL 1 DAY','',1,2,'$CalendarDetailsID')) or die(mysql_error());

My big question is about using the DATE_ADD MySQL function inside
the INSERT statement.  Is this allowed?  If it is allowed, is it a bad idea
for some reason?  Is there a better way of doing this?  Thanks in advance.

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




RE: [PHP-DB] Date math functions...

2003-01-15 Thread NIPP, SCOTT V (SBCSI)
Thanks.  I was noticing that it was not working.  Let me give this a
try and see how things go.

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 15, 2003 10:32 AM
To: 1LT John W. Holmes; NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Date math functions...


 [snip]
  if ($dateDiff == 3) {
  mysql($DBName,UPDATE Balances SET CompEarned=CompTaken+8 WHERE
  said='$said') or die(mysql_error());
  mysql($DBName,INSERT INTO Log VALUES('DATE_ADD($StopDate,
  INTERVAL 1 DAY','',1,2,'$CalendarDetailsID')) or die(mysql_error());
 
  My big question is about using the DATE_ADD MySQL function inside
  the INSERT statement.  Is this allowed?  If it is allowed, is it a bad
 idea
  for some reason?  Is there a better way of doing this?  Thanks in
advance.

 Sure, that's allowed. You have $StopDate in PHP, so you could do it with
 some math in PHP, also, but then you'd have to worry about the end of
 months, years, etc, whereas DATE_ADD will do this for you.

 ---John Holmes...

Wait... just noticed your syntax error. Don't enclose the function in single
quotes, otherwise you're trying to insert a string.

Should be:

... VALUES (DATE_ADD($StopDate,INTERVAL 1 DAY), ...

---John Holmes...

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




RE: [PHP-DB] Date math functions...

2003-01-15 Thread NIPP, SCOTT V (SBCSI)
Actually this is generating another error.  Now, without the single
quotes I am getting the following error:

Column 'StartDate' cannot be null

It looks like for some reason the DATE_ADD is returning a NULL
value.  Any more ideas?

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 15, 2003 10:32 AM
To: 1LT John W. Holmes; NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Date math functions...


 [snip]
  if ($dateDiff == 3) {
  mysql($DBName,UPDATE Balances SET CompEarned=CompTaken+8 WHERE
  said='$said') or die(mysql_error());
  mysql($DBName,INSERT INTO Log VALUES('DATE_ADD($StopDate,
  INTERVAL 1 DAY','',1,2,'$CalendarDetailsID')) or die(mysql_error());
 
  My big question is about using the DATE_ADD MySQL function inside
  the INSERT statement.  Is this allowed?  If it is allowed, is it a bad
 idea
  for some reason?  Is there a better way of doing this?  Thanks in
advance.

 Sure, that's allowed. You have $StopDate in PHP, so you could do it with
 some math in PHP, also, but then you'd have to worry about the end of
 months, years, etc, whereas DATE_ADD will do this for you.

 ---John Holmes...

Wait... just noticed your syntax error. Don't enclose the function in single
quotes, otherwise you're trying to insert a string.

Should be:

... VALUES (DATE_ADD($StopDate,INTERVAL 1 DAY), ...

---John Holmes...

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




[PHP-DB] Duplicate keys...

2003-01-15 Thread NIPP, SCOTT V (SBCSI)
OK, I cannot figure out why I keep getting errors about Duplicate
entry for key 1.  Someone please come to my rescue here as this is truly
kicking my but.

if ($dateDiff == 2) {
mysql($DBName,INSERT INTO phpCalendar_Details VALUES (
'$said','Comp day for weekend
On-Call','','','','','','','','','',2,'$CalendarDetailsID')) or
die(mysql_error());

mysql($DBName,UPDATE Balances SET CompEarned=CompEarned+8,
CompTaken=CompTaken+8 WHERE said='$said') or die(mysql_error());
$result = mysql($DBName,SELECT LAST_INSERT_ID() FROM
phpCalendar_Details) or die(mysql_error());
while ($row = mysql_fetch_row($result)) {
$CalendarDetailsID = $row[0];
}
mysql($DBName,INSERT INTO Log VALUES(
'$entryid','$said','Comp',DATE_ADD('$StopDate',INTERVAL 1
DAY),'Y','','Awarded for weekend On-Call','8','$CalendarDetailsID')) or
die(mysql_error());

mysql($DBName,INSERT INTO phpCalendar_Daily VALUES(
DATE_ADD('$StopDate',INTERVAL 1 DAY),'',1,2,'$CalendarDetailsID'))
or die(mysql_error());
}

if ($dateDiff  0) {
commonHeader($glbl_SiteTitle);
echo centerfont color=\red\bYour END DATE COMES BEFORE YOUR START
DATE. Please complete the form below./b/font/centerp\n\n;

} elseif ($Stop != 1) {

if ($CalendarDetailsID) {
$CalendarDetailsID = $CalendarDetailsID + 1;
} else {
$result = mysql($DBName,SELECT LAST_INSERT_ID() FROM
phpCalendar_Details) or die(mysql_error());
while ($row = mysql_fetch_row($result)) {
$CalendarDetailsID = $row[0];
}
}

mysql($DBName,INSERT INTO phpCalendar_Details VALUES (
'$said','On-Call for $StartDate to
$StopDate','','','','','','','','','',1,'$CalendarDetailsID')) or
die(mysql_error());

mysql($DBName,INSERT INTO phpCalendar_Daily VALUES(
'$StartDate','$StopDate','1','1','$CalendarDetailsID')) or
die(mysql_error());

This is the only place in the script that is attempting to enter
data into the CalendarDetailsID field.  This is the auto_increment field
that is having problems, I think.  The other strange part of this is that
thedata in the auto_increment field has two separate ranges (10 - 40 with
gaps, and 70 - 78 with gaps).  I have been doing a lot of adding and
removing of data to test during development, but I thought an auto_increment
field would still track and deal with this correctly.
Thank again for 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-DB] Stumped...

2003-01-09 Thread NIPP, SCOTT V (SBCSI)
I am getting an error that is proving very difficult to isolate and
was hoping for help.  The error is: Column count doesn't match value count
at row 1.  I would include the code, but it is about 350 lines, and I am not
sure where to narrow it down at.  Any ideas?  Thanks.

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




RE: [PHP-DB] Stumped...

2003-01-09 Thread NIPP, SCOTT V (SBCSI)
Nevermind.  I just stumbled across the nature of my problem on
Deja.com.  Thanks anyway and sorry for bugging you guys about what really
was a simple problem.

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 09, 2003 12:36 PM
To: NIPP, SCOTT V (SBCSI); '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] Stumped...


Post your SQL statement.

 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 09, 2003 1:37 PM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] Stumped...
 
 
   I am getting an error that is proving very difficult to 
 isolate and
 was hoping for help.  The error is: Column count doesn't 
 match value count
 at row 1.  I would include the code, but it is about 350 
 lines, and I am not
 sure where to narrow it down at.  Any ideas?  Thanks.
 
 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




[PHP-DB] Mouseover question...

2003-01-08 Thread NIPP, SCOTT V (SBCSI)
OK, this isn't really a DB question, but it is definitely a PHP
question.  I am working on customizing a calendar application for my group's
use and noticed that there is a function that has to do with a mouseover
effect.  The problem is that this mouseover does not appear to do anything.
Could one of you gurus take a look at this function and see if you can spot
anything wrong?  Thanks.


// getEvent() displays events on the calendar for IE browsers //
// This distinction is made because IE is currently the only  //
// browser on which the javascript mouseover effects work.//

function getEventIE($ID, $LinkTitle, $AbbrTitle, $Date) {
  $LinkTitle =ereg_replace(',#146;,$LinkTitle);
  $AbbrTitle =ereg_replace(',#146;,$AbbrTitle);
  echo script
  dLink('./event.php?ID=$IDDate=$Date','$LinkTitle','$AbbrTitle');
  /script\n\n;
}

This function is called from another page as such:

if ($ver = 4) {
  echo br\n;
  getEventIE($CDCI, $CDTi, $showName, $queryDate);

Thanks again.

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




RE: [PHP-DB] Mouseover question...

2003-01-08 Thread NIPP, SCOTT V (SBCSI)
You are correct.  I have found the JS that the dLink references.
Here it is if there are any JS experts out there who want to take a gander.

//
// expandItems() calls a javascript that replaces one string of //
// text with another on mouseover (IE only) //
//
function expandItems() {
?
script language=JavaScript!--
var no=0;

function mover(object,text) {
eval(object + '.innerText = text');
}

function mout(object,text) {
eval(object + '.innerText = text');
}

function dLink(href,text,txet) {
document.write('a href='+href+'
onMouseOut=mout(\'link'+no+'\',\''+txet+'\')
onMouseOver=mover(\'link'+no+'\',\''+text+'\') id=link'+no+'
onClick=return(openSmallWindow(\''+href+'\'))'+txet+'\/a');
no+=1;
}
//--/script

Thanks again.

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 11:56 AM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Mouseover question...


   OK, this isn't really a DB question, but it is definitely a PHP
 question.  I am working on customizing a calendar application for my
 group's
 use and noticed that there is a function that has to do with a
mouseover
 effect.  The problem is that this mouseover does not appear to do
 anything.
 Could one of you gurus take a look at this function and see if you can
 spot
 anything wrong?  Thanks.
 
 
 // getEvent() displays events on the calendar for IE browsers //
 // This distinction is made because IE is currently the only  //
 // browser on which the javascript mouseover effects work.//
 
 function getEventIE($ID, $LinkTitle, $AbbrTitle, $Date) {
   $LinkTitle =ereg_replace(',#146;,$LinkTitle);
   $AbbrTitle =ereg_replace(',#146;,$AbbrTitle);
   echo script
   dLink('./event.php?ID=$IDDate=$Date','$LinkTitle','$AbbrTitle');
   /script\n\n;
 }
 
   This function is called from another page as such:
 
 if ($ver = 4) {
   echo br\n;
   getEventIE($CDCI, $CDTi, $showName, $queryDate);

That function has nothing to do with mouseovers. Maybe the dLink()
function does, but this is all user functions, so there's no telling
what they do. Mouseovers have nothing to do with PHP. PHP can simply
echo the javascript code required to create the mouseover effect.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/


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




[PHP-DB] Sore head...

2003-01-07 Thread NIPP, SCOTT V (SBCSI)
My head is sore from banging my head on my desk, so I will now ask
the gurus...

I am trying to get a canned Calendar application working, and I am
running into problems.  The application is phpCommunityCalendar by
AppIdeas.com.  The calendar is currently semi-functional, but for some
reason the approval system is not working for me.  I am trying to
troubleshoot why this is the case and this is where I am running into
problems.  The following is a bit of code that I do not understand and was
hoping that someone could clear up for me.

**  Not sure exactly what this code does, especially the %% portion**

if (!$glbl_LocationID) {
$glbl_LocationID = 0;
$LocQuery = LocationID LIKE '%%';
} else {
$LocQuery = LocationID = '$glbl_LocationID';
}

**  SNIP This section queries the database for events that have been
submitted but NOT approved, this is the Active = '0'**

$result = mysql($DBName,SELECT CalendarDetailsID FROM phpCalendar_Daily
WHERE Active = '0') or die(mysql_error());
while ($row = mysql_fetch_row($result)) {
$ID[$i] = $row[0];
$i++;
}

** SNIP Based on looking at the DB, this section associates the matched
item descriptions for display**

for ($j = 0; $ID[$j]; $j++) {
$query .=  OR CalendarDetailsID = '$ID[$j]';
}
$query = ereg_replace(^ OR ,,$query);
if (!$query) {
echo centerbThere are no results to display/b/center;
commonFooter();
exit;

** SNIP Even though I see entries in the DB that appear as they should
display (Active = 0), nothing actually appears**
$result = mysql($DBName,SELECT *
FROM phpCalendar_Details
WHERE .$LocQuery. AND (.$query.)
ORDER BY Title) or die(mysql_error());

OK.  I have tested the basics of the SQL in both the second section
and the last section.  If I manually query the database as in the second
section, and then use that output in the query of the last section I am
returned a record as expected.  This is the reason why I am lost as to why
this is not working here.
Thanks in advance for 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




RE: [PHP-DB] Newbie PHP/MySQL question

2002-12-20 Thread NIPP, SCOTT V (SBCSI)
I would say his problem is the IIS 5.0.  Switch to some non-MS
operating system running Apache as a web server and that should clear up
your problems.  :)

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 20, 2002 11:24 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Newbie PHP/MySQL question


On Saturday 21 December 2002 01:11, Matt Matijevich wrote:
 I am just getting started with php an mysql.

 When I try to insert a record php get stuck in some kind of loop and
 about 25 records are created.  Any help would be greatly appreciated.

 Windows 2000 server latest service pack.
 PHP 4.2.3
 MySql 3.23
 IIS 5.0

My mind reading skills aren't very good, but I think there's something wrong

with line 13 of your program.

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


/*
The greatest disloyalty one can offer to great pioneers is to refuse to
move an inch from where they stood.
*/


-- 
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] Oracle connectivity question...

2002-12-18 Thread NIPP, SCOTT V (SBCSI)
OK.  I think I now have Oracle support built into PHP/Apache.  The
biggest hiccup for HP-UX seems to be that once you add Oracle support to
PHP, you CANNOT built PHP as a DSO, PHP MUST be compiled into Apache.  Once
again, I think this is the case, I am still not completely sure at this
point.

I am now receiving an error on trying to connect to the Oracle
database that I do not understand, but leads me to believe that the PHP
Oracle support is functioning.  Here is the code I am attempting:

?php
$connection = OCILogon(userid, password) or die (Unable to logon to
database.);
# phpinfo();
?

Here is the error I am receiving:

Warning: OCISessionBegin: ORA-01034: ORACLE not available in
/www/DW/oratest.php on line 10
Unable to logon to database.
The code I am attempting is simply to verify successful connectivity
to the database.  I know that this doesn't really do anything, but I am
trying this simply to test for a successful connection.  Please let me know
if you have any ideas or suggestions.  Thanks again.

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




RE: [PHP-DB] Oracle/PHP question...

2002-12-17 Thread NIPP, SCOTT V (SBCSI)
Correct.  I am working on Unix, specifically HP-UX 11.00.

-Original Message-
From: Andrey Hristov [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 17, 2002 8:38 AM
To: xxx ; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Oracle/PHP question... 


AFAIK he uses *nix, not windows.
(.so-s are possible sollution but prebuilt ones are not shipped with php).

Andrey


- Original Message -
From: xxx  [EMAIL PROTECTED]
To: Anthony Carlos [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, December 17, 2002 4:32 PM
Subject: Re: [PHP-DB] Oracle/PHP question...


 Hy,
 in php.ini you have to uncomment the
 ;extension=php_oci8.dll
 ;extension=php_oracle.dll

 ; is a comment

 and restart the server
 cybercop78




 On Tue, 17 Dec 2002 08:29:36 -0500, Anthony Carlos wrote
  Yes, you need to recompile PHP:
./configure --with-oci8=[your_oracle_home]
 
  -Original Message-
  From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
  Sent: Monday, December 16, 2002 1:58 PM
  To: '[EMAIL PROTECTED]'
  Subject: [PHP-DB] Oracle/PHP question...
 
  I am now trying to setup connectivity to a remote Oracle database
  for my PHP/Apache web server.  I am attempting to verify
  connectivity to the database by:
 
  ?php
  $connection = OCILogon(user, password) or die (Unable to logon
  to database.); ?
 
  I have installed the Oracle client on the system, and I have also
  setup the ORACLE_HOME and ORACLE_SID environment variables.
Unfortunately
  at this point I am not even able to make a successful connection to the
  Oracle database.  I am currently receiving the following error:
 
  Fatal error: Call to undefined function: ocilogon() in
/www/DW/oratest.php
  on line 10
 
  Do I need to recompile PHP to be Oracle aware or something?
  What is it I am missing at this point?  Thanks in advance. 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





 http://www.idilis.ro - Stiri, e-mail gratuit, download,
 SMS, server de counter-strike, hosting gratuit, servicii internet...
 Fii cu un pas inaintea celorlati!


 --
 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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] PHP/Oracle Install questions...

2002-12-17 Thread NIPP, SCOTT V (SBCSI)
I am attempting to recompile PHP 4.2.3 on HP-UX 11.00 for
connectivity to both a MySQL and a remote Oracle server.  I am not having
much luck with this right now.  Currently I am getting a couple of different
errors that are of concern for me.  First of all, in the Apache error log I
am seeing the following entry every time I start the Apache server:

[Tue Dec 17 09:42:39 2002] [warn] module php4_module is already
loaded, skipping

I am not sure as to why I am receiving this error.  I know that PHP
is only compiled as a module, because it does not show up in a httpd -l.  I
am wondering if this is a result of some kind of syntax error in my
httpd.conf file.

The big problem though is getting PHP to compile completely again.
I know that on HP there is an issue with the extension on the php library.
It has something to do with .sl as opposed to .so, but I cannot remember
exactly what it is and for some reason I can't seem to find the
documentation on it this time around.  Any help in the right direction here
would be most appreciated.

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-DB] FW: PHP/Oracle Install questions...

2002-12-17 Thread NIPP, SCOTT V (SBCSI)
More information for someone to hopefully come to my rescue on
this...

root@torvalds:/usr/local/apache/bin ./apachectl startssl
/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local Storage:
/us
r/lib/libcl.2
/usr/lib/dld.sl: Exec format error
Syntax error on line 207 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache/libexec/libphp4.so into server: Exec format
error
./apachectl startssl: httpd could not be started

This is what I get when I attempt to start Apache once I think I
have compiled the new PHP module properly.

  -Original Message-
 From: NIPP, SCOTT V (SBCSI)  
 Sent: Tuesday, December 17, 2002 9:56 AM
 To:   '[EMAIL PROTECTED]'
 Subject:  PHP/Oracle Install questions...
 
   I am attempting to recompile PHP 4.2.3 on HP-UX 11.00 for
 connectivity to both a MySQL and a remote Oracle server.  I am not having
 much luck with this right now.  Currently I am getting a couple of
 different errors that are of concern for me.  First of all, in the Apache
 error log I am seeing the following entry every time I start the Apache
 server:
 
   [Tue Dec 17 09:42:39 2002] [warn] module php4_module is already
 loaded, skipping
 
   I am not sure as to why I am receiving this error.  I know that PHP
 is only compiled as a module, because it does not show up in a httpd -l.
 I am wondering if this is a result of some kind of syntax error in my
 httpd.conf file.
 
   The big problem though is getting PHP to compile completely again.
 I know that on HP there is an issue with the extension on the php library.
 It has something to do with .sl as opposed to .so, but I cannot remember
 exactly what it is and for some reason I can't seem to find the
 documentation on it this time around.  Any help in the right direction
 here would be most appreciated.
 
 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-DB] Oracle/PHP question...

2002-12-16 Thread NIPP, SCOTT V (SBCSI)
I am now trying to setup connectivity to a remote Oracle database
for my PHP/Apache web server.  I am attempting to verify connectivity to the
database by:

?php
$connection = OCILogon(user, password) or die (Unable to logon to
database.);
?

I have installed the Oracle client on the system, and I have also
setup the ORACLE_HOME and ORACLE_SID environment variables.  Unfortunately
at this point I am not even able to make a successful connection to the
Oracle database.  I am currently receiving the following error:

Fatal error: Call to undefined function: ocilogon() in /www/DW/oratest.php
on line 10

Do I need to recompile PHP to be Oracle aware or something?  What is
it I am missing at this point?  Thanks in advance.
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




RE: [PHP-DB] Oracle/PHP question...

2002-12-16 Thread NIPP, SCOTT V (SBCSI)
Thanks, but my web server is HP-UX.

Didn't anyone ever tell you Win-blows sucks?  :)

-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 3:07 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Oracle/PHP question...


If your webserver is win32 then you need to uncomment the line in php.ini
that says :

;extension=php_oci8.dll

 if it is unix based I am not sure what you need to do.

 Ryan

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 1:58 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] Oracle/PHP question...


I am now trying to setup connectivity to a remote Oracle database
for my PHP/Apache web server.  I am attempting to verify connectivity to the
database by:

?php
$connection = OCILogon(user, password) or die (Unable to logon to
database.);
?

I have installed the Oracle client on the system, and I have also
setup the ORACLE_HOME and ORACLE_SID environment variables.  Unfortunately
at this point I am not even able to make a successful connection to the
Oracle database.  I am currently receiving the following error:

Fatal error: Call to undefined function: ocilogon() in /www/DW/oratest.php
on line 10

Do I need to recompile PHP to be Oracle aware or something?  What is
it I am missing at this point?  Thanks in advance.
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

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




RE: [PHP-DB] Oracle/PHP question...

2002-12-16 Thread NIPP, SCOTT V (SBCSI)
Figuring how shouldn't be too tough.  Compiling software for the
most part is a breeze.  My concern was whether I needed to recompile or not.
I am now trying that, and hopefully this will address the problem for me.
As to the recompiling with every release, that is no big deal either as the
recompile is all of 4 entries on the command line.  Putting this together in
a shell script is simplicity in itself, and requires no polishing up even
though most of my system scripting I do in Perl.
It is nice to see though that you are not trying to tell me how
Win-blows is better than Unix.  Sure Windows is nice in that virtually
everything is simple enough for a 3rd grader to do stuff on it, but I like
to think I have a little more intelligence than your average 3rd grader.  Oh
well, I don't want this to degenerate any further so we can agree to
disagree about platforms or you can admit to possibly being a closet Unix
fan.  :)

-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 3:19 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Oracle/PHP question...


BTW... I'm not the one stuck trying to figure out how to recompile my
current version of PHP to include the oci functions... haha! And guess what,
with every release you get to do it all over again... so polish up on the
shell scripting unless you want to reinvent the wheel every month or two.
:-D

 Ryan

-Original Message-
From: Ryan Jameson (USA) 
Sent: Monday, December 16, 2002 2:15 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Oracle/PHP question...


:-) ... Windows is the best at running the C# .NET applications I have to
build to make everyone happy that we are industry standard ... when big
brother is not looking I use PHP for everything I can get away with. I'm
actually very impressed with how easily PHP integrates into an IIS / MSSQL
environment (in CGI mode that is) ... it has been quite stable and believe
it or not upgrades don't require a reboot!!! I have even called the php
parser directly from sql server dts packages  agent jobs... PHP is much
more powerful then anything m$ offers.

 Ryan

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 2:08 PM
To: Ryan Jameson (USA); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Oracle/PHP question...


Thanks, but my web server is HP-UX.

Didn't anyone ever tell you Win-blows sucks?  :)

-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 3:07 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Oracle/PHP question...


If your webserver is win32 then you need to uncomment the line in php.ini
that says :

;extension=php_oci8.dll

 if it is unix based I am not sure what you need to do.

 Ryan

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 1:58 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] Oracle/PHP question...


I am now trying to setup connectivity to a remote Oracle database
for my PHP/Apache web server.  I am attempting to verify connectivity to the
database by:

?php
$connection = OCILogon(user, password) or die (Unable to logon to
database.);
?

I have installed the Oracle client on the system, and I have also
setup the ORACLE_HOME and ORACLE_SID environment variables.  Unfortunately
at this point I am not even able to make a successful connection to the
Oracle database.  I am currently receiving the following error:

Fatal error: Call to undefined function: ocilogon() in /www/DW/oratest.php
on line 10

Do I need to recompile PHP to be Oracle aware or something?  What is
it I am missing at this point?  Thanks in advance.
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

-- 
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 Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Remote Oracle database questions...

2002-12-11 Thread NIPP, SCOTT V (SBCSI)
I have now been granted access to a remote Oracle database that I
need to query.  All of the work that I have done with databases and PHP has
been focused on MySQL, does anyone know of a good tutorial for PHP with
Oracle?  My immediate question is how do I get logged into the remote
database to perform my query?  I notice that there is a Oracle function in
PHP called ora_logon.  This function description mentions something about
logging in using 'user@TNSNAME'.  I am pretty confused by what this means.
Thanks in advance for 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




RE: [PHP-DB] Remote Oracle database questions...

2002-12-11 Thread NIPP, SCOTT V (SBCSI)
DOH!!!  I am seriously hoping that I do not need to have the Oracle
client installed on the webserver running the PHP queries.  I have no idea
about the client licensing, and if it involves money in any way it is pretty
much out of the question.  Oh well...  Hopefully I can find out about this
stuff from one of our DBAs.

-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 11, 2002 10:58 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Remote Oracle database questions...


One thing I can help with is TNSNAME. It was very confusing for me at first,
it's kind of like an alias on steroids... It is a necessary part of
connecting to an Oracle server. TNSNAMES are declared in a file called... go
figure... tnsnames. Even good Oracle DBAs run into confusion because the
tnsnames file (on the connecting client) can get huge. As far as how PHP
does it, I'd ASSUME that the Oracle client would have to be installed on the
server PHP is running on. Upon installing the Oracle client it will create
the tnsnames file and set the ORACLE_HOME environment variable, the file
needs a reference to the server you wish to connect to. I haven't used
Oracle since 8i came out... but I'm pretty sure this is accurate. Except the
guess about how PHP does it.

 Ryan

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 11, 2002 9:24 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] Remote Oracle database questions...


I have now been granted access to a remote Oracle database that I
need to query.  All of the work that I have done with databases and PHP has
been focused on MySQL, does anyone know of a good tutorial for PHP with
Oracle?  My immediate question is how do I get logged into the remote
database to perform my query?  I notice that there is a Oracle function in
PHP called ora_logon.  This function description mentions something about
logging in using 'user@TNSNAME'.  I am pretty confused by what this means.
Thanks in advance for 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

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




[PHP-DB] Form Best Practice/Help...

2002-12-10 Thread NIPP, SCOTT V (SBCSI)
I am working on an application and I am not having a lot of luck
getting a form to behave the way I want.  I am trying to keep the form self
referencing, not sure if that is the correct terminology.  The form is an
approval form that queries a database to create a list of checkboxes.  These
checkbox selections shall then, upon submit, update the database table with
an approval timestamp and fire off an e-mail to one of our administrators to
take action.  The problem I am having is that once the submit button is
clicked the page is not displaying the results I am expecting.  This leads
me to the obvious conclusion that something in the flow control of my page
is incorrect.
My questions are regarding the way in which I am laying out this
page.  I am trying to keep the page self referencing such that there are
fewer pages to keep track of, and I also feel this looks more professional
since the approval process will only involve a single URL.  Currently I am
simply trying to get a click on the submit button to display a Done
message to test the flow control.  Now, on to the questions...  Is this type
of flow control logic a good idea?  Is there a better way to implement this
process?  What am I missing that is causing this flow control logic to fail?
OK.  Here is the code:

?php require_once('useraccounts.lib.php');
$safe_verify_string = urldecode($_REQUEST['verify_string']);

mysql_select_db($database, $Prod);
$query = SELECT * FROM accounts WHERE verifyurl='{$safe_verify_string}';
$result = mysql_query($query, $Prod) or die(mysql_error());
# $test = mysql_num_rows($result);
$list = mysql_fetch_assoc($result);
$id = split('-', $list['id-sys']);

if (isset($cnt)) {
  echo p align=\center\font color=\#0033FF\ size=\5\Done./p;
}
?

html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body
p align=centerfont color=#0033FF size=5Welcome to the New User
Account Approval system./font 
/p
?php
if (mysql_num_rows($result) == 0 ) {
  echo p align=\center\No accounts pending approval were found for this
request. /p;
  echo p align=\center\Please contact the SA Team if you are having
problems with this request system./p;
} else {
  echo p align=\center\The following accounts for $id[0] have been
requested and require your approval prior to creation. /p;
  echo p align=\center\;
  $test1 = CheckboxList($query, $CheckboxText, $link);
}

?
/p
/body
/html

The function CheckboxList is called from the useraccounts.lib.php
script and is returning the $cnt variable.  This $cnt variable is only used
as a mechanism to create the checkbox list of systems in four columns.  I
decided to check for the existence of this variable since it must be set if
the CheckboxList function is called.  Below is the CheckboxList
function:

function CheckboxList($query, $CheckboxText, $link) {
  global $cnt;
  $cnt = 1;
  $result1 = mysql_query($query);
  echo form name=\form1\ method=\get\ action=\$link\;
  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;
}
  }
  echo /table;
  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;
  return $cnt;
}

Thanks in advance, and again, for 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-DB] Update Query Help...

2002-12-10 Thread NIPP, SCOTT V (SBCSI)
I am attempting to UPDATE a table and I have having absolutely ZERO
success.  Here is the query:

$tmp = $_POST['sbcuid'].-.$_POST['system'][$a];
$update = UPDATE accounts SET atime='NOW()' WHERE
\id-sys\='.$tmp.';
echo $update;
$result1 = mysql_query($update, $Prod) or die(mysql_error());
echo mysql_affected_rows();

Please help me figure out why this is not working.  I have tried
quoting the column name 'id-sys' every way I can think of, but nothing
works.  The column is initially NULL, and I am attempting to update just the
single column with a timestamp.  Thanks in advance.

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




RE: [PHP-DB] Update Query Help...

2002-12-10 Thread NIPP, SCOTT V (SBCSI)
I have definitely isolated the problem.  If I change the column name
that the match is being performed on from 'id-sys' to 'id_sys' I can execute
the query without having to worry about quoting the column name and
everything works.  I think that I am just going to leave the column name
changed and take this as a lesson never to use '-' in a column name again.
Thanks again for the help.  Maybe we all learned something from
this.

-Original Message-
From: DL Neil [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 10, 2002 2:00 PM
To: NIPP, SCOTT V (SBCSI); '1LT John W. Holmes'; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Update Query Help...


SCOTT,
The list's crystal ball filter is down for maintenance.
Show us the tbl schema and the debug print of $update.
Then we won't be firing blind!
=dn


 I understand that the column name does not normally need quotes, but
 without quotes on the column name I get a mysql error message about no
 column named 'id'.  Unfortunately, I cannot even get the UPDATE statement
 working outside of PHP through an direct SQL statement.  Everything looks
 like it should work, but the affected columns is always zero, and
obviously
 the atime column is not getting the timestamp.
 This is quite frustrating.  Thanks again for the help.  Hopefully
 someone will come up with something to help me get this working.

 -Original Message-
 From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, December 10, 2002 1:45 PM
 To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Update Query Help...


  $tmp = $_POST['sbcuid'].-.$_POST['system'][$a];
  $update = UPDATE accounts SET atime='NOW()' WHERE
  \id-sys\='.$tmp.';
  echo $update;
  $result1 = mysql_query($update, $Prod) or die(mysql_error());
  echo mysql_affected_rows();

 Try:

 $update = UPDATE accounts SET atime=NOW() WHERE id-sys='$tmp';

 NOW() is a function, don't enclose it within quotes and make it a string.
 You don't put quotes around column names, either, only string values.

 ---John Holmes...

 --
 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] Function questions...

2002-12-06 Thread NIPP, SCOTT V (SBCSI)
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




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




RE: [PHP-DB] Data not entering DB

2002-12-06 Thread NIPP, SCOTT V (SBCSI)
Yes, and yes.

-Original Message-
From: John [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 2:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Data not entering DB


Questions:

Is this the right email addy to post help questions, and may I post the php
code within the email html?

Thanks,

John


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.426 / Virus Database: 239 - Release Date: 12/2/2002

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




RE: [PHP-DB] Special URL Verification String... PS

2002-12-05 Thread NIPP, SCOTT V (SBCSI)
Thanks for the responses.  I chose to use this method as it appears
to be the most simple and effective.  For anyone else I am also using the
substr function to cut the random string down to something more manageable
for the database.  Thanks again for the feedback.

-Original Message-
From: Peter Lovatt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 04, 2002 4:45 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Special URL Verification String... PS


Hi

PS

I would use

$verify_string = md5(uniqid(rand()));

to generate a random identifier of the sort you are looking for

Peter

---
Excellence in internet and open source software
---
Sunmaia
Birmingham
UK
www.sunmaia.net
tel. 0121-242-1473
International +44-121-242-1473
---

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: 04 December 2002 22:07
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] Special URL Verification String...


I am trying to implement an approval system that sends an e-mail to
a user for approval linking them back to a special URL that matches database
entries for a verification string.  The verification string sent via the
e-mail does not match that in the database and I am looking for help in
figuring out why.  Here is what generates the verification string:

$verify_string = $sbcuid;
for ($i = 0 ; $i  14; $i++) {
  $verify_string .= chr(mt_rand(32,126));
}

Here is what this results in inside the database table:

sn4265e~zD|W(XTMxO+

Here is what is sent in the e-mail:

sn4265e%7EzD%7CW%28XTMxO%22%2B

I know that I am doing something wrong here, but what.  Thanks in
advance.


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




[PHP-DB] Newline help...

2002-12-05 Thread NIPP, SCOTT V (SBCSI)
I must be stupid, because I cannot for the life of me figure out why
I am not getting newlines from some very simply 'echo' statements.  Here is
the portion of the code below, and I am getting everything run together on a
single line:

?php do { 
  echo $list['id-sys'] . \n;
  $sys = split('-', $list['id-sys']);
  echo $sys[1]\n;
  } while ($list = mysql_fetch_assoc($result));


I am truly stumped by this.  It is quite frustrating that something
as simple as a newline can misbehave.  I have been searching for this on the
PHP site, newsgroups, and in a couple of books I have and yet I am still
stumped.  Help please.  Thanks.
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




RE: [PHP-DB] Newline help...

2002-12-05 Thread NIPP, SCOTT V (SBCSI)
Why does the documentation everywhere seem to imply that you can use
the typical newline character?  This is most confusing.  I seem code
examples all over the place using newlines.  Oh well, now I know.  Thanks.

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 05, 2002 10:34 AM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Newline help...


HTML doesn't render newlines, only BR. Look at your HTML source code and
the newlines are there.

or,

if you're on windows, use \r\n for newlines.

---John Holmes...

- Original Message -
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 05, 2002 11:28 AM
Subject: [PHP-DB] Newline help...


 I must be stupid, because I cannot for the life of me figure out why
 I am not getting newlines from some very simply 'echo' statements.  Here
is
 the portion of the code below, and I am getting everything run together on
a
 single line:

 ?php do {
   echo $list['id-sys'] . \n;
   $sys = split('-', $list['id-sys']);
   echo $sys[1]\n;
   } while ($list = mysql_fetch_assoc($result));


 I am truly stumped by this.  It is quite frustrating that something
 as simple as a newline can misbehave.  I have been searching for this on
the
 PHP site, newsgroups, and in a couple of books I have and yet I am still
 stumped.  Help please.  Thanks.
 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




[PHP-DB] Special URL Verification String...

2002-12-04 Thread NIPP, SCOTT V (SBCSI)
I am trying to implement an approval system that sends an e-mail to
a user for approval linking them back to a special URL that matches database
entries for a verification string.  The verification string sent via the
e-mail does not match that in the database and I am looking for help in
figuring out why.  Here is what generates the verification string:

$verify_string = $sbcuid;
for ($i = 0 ; $i  14; $i++) {
  $verify_string .= chr(mt_rand(32,126));
}

Here is what this results in inside the database table:

sn4265e~zD|W(XTMxO+

Here is what is sent in the e-mail:

sn4265e%7EzD%7CW%28XTMxO%22%2B

I know that I am doing something wrong here, but what.  Thanks in
advance.


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-DB] INSERT question...

2002-11-20 Thread NIPP, SCOTT V (SBCSI)
I have an INSERT statement that I cannot quiet get working.  The
table that this data is being put into has 7 columns, but I only care about
putting in the data from the first two columns at this time.  The first
column is an array element, and the second column needs to be a timestamp.
Here is the INSERT statement:

$query = INSERT INTO accounts VALUES('.$accnts[0].', 'TIMESTAMP(10)', , ,
, ,);

Here is the error being displayed on the web page:

You have an error in your SQL syntax near ' , , ,)' at line 1
Thanks in advance for 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




RE: [PHP-DB] INSERT question...

2002-11-20 Thread NIPP, SCOTT V (SBCSI)
OK.  This sounds great, but now I am getting a completely different
error message.

You have an error in your SQL syntax near '-sys) VALUES('sn4265-turner')' at
line 1

Here is the INSERT statement:

$query = INSERT INTO accounts (id-sys) VALUES('.$accnts[0].');

Do I have to rename the column?  I would rather not if I can avoid
it.  If I must, is this a problem with PHP or MySQL not understanding '-' in
a column name?  Thanks again.

-Original Message-
From: Aaron Wolski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 1:28 PM
To: '1LT John W. Holmes'; NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] INSERT question...


Hmm


You learn something new everyday :)

Aaron

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] 
Sent: November 20, 2002 2:27 PM
To: Aaron Wolski; 'NIPP, SCOTT V (SBCSI)'; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] INSERT question...

 Try... $query = INSERT INTO accounts (accnts,timestamp)
 VALUES(''.$accnts[0].'','TIMESTAMP(10)');

 Might work?

 Aaron


For the OP, you don't really want to insert the text TIMESTAMP(10) into
a
column, do you? If you want the current 10-digit timestamp, then you can
just use NOW() or CURRENT_DATE, so long as your column is declared with
a
width of 10. In fact, if it's a timestamp, you don't need to do
anything,
it'll be updated with the current time upon insert. so you could
probably
just do this:

$query = INSERT INTO accounts (accnts) VALUES (.$accnts[0].);

---John Holmes...


 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
 Sent: November 20, 2002 2:16 PM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] INSERT question...

 I have an INSERT statement that I cannot quiet get working.  The
 table that this data is being put into has 7 columns, but I only care
 about
 putting in the data from the first two columns at this time.  The
first
 column is an array element, and the second column needs to be a
 timestamp.
 Here is the INSERT statement:

 $query = INSERT INTO accounts VALUES('.$accnts[0].',
'TIMESTAMP(10)',
 , ,
 , ,);

 Here is the error being displayed on the web page:

 You have an error in your SQL syntax near ' , , ,)' at line 1
 Thanks in advance for 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




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




RE: [PHP-DB] INSERT question...

2002-11-20 Thread NIPP, SCOTT V (SBCSI)
Great.  That is perfect.  The last minor issue is that the timestamp
is a datetime column, and needs to be such since I don't want this to change
when the record is updated.  This is correct, right?  If the column were a
timestamp data type, the value would change every time the record is
updated?  I am trying:

 $query = INSERT INTO accounts (`id-sys`, rtime) VALUES('.$accnts[0].',
'NOW()');

This is entering the array element properly, but not the time.  The
datetime field is coming up with all zeroes.

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 2:21 PM
To: NIPP, SCOTT V (SBCSI); 'Aaron Wolski'; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] INSERT question...


 OK.  This sounds great, but now I am getting a completely different
 error message.

 You have an error in your SQL syntax near '-sys) VALUES('sn4265-turner')'
at
 line 1

 Here is the INSERT statement:

 $query = INSERT INTO accounts (id-sys) VALUES('.$accnts[0].');

 Do I have to rename the column?  I would rather not if I can avoid
 it.  If I must, is this a problem with PHP or MySQL not understanding '-'
in
 a column name?  Thanks again.

Try putting backtics (not single quotes) around the column name.

$query = INSERT INTO accounts (`id-sys`) VALUES ('.$accnts[0].');

if that don't work, you'll have to rename the column.

---John Holmes...

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




RE: [PHP-DB] INSERT question...

2002-11-20 Thread NIPP, SCOTT V (SBCSI)
Thanks a bunch.  That fixed me right up.  Still learning a lot about
PHP and MySQL.  Hopefully I will be able to remember this as I am sure this
issue will come up for me again in the future.

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 20, 2002 2:47 PM
To: NIPP, SCOTT V (SBCSI); 'Aaron Wolski'; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] INSERT question...



  $query = INSERT INTO accounts (`id-sys`, rtime) VALUES('.$accnts[0].',
 'NOW()');

Remove the quotes around NOW(). It's a function, not a string.

---John Holmes...

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




[PHP-DB] General How-to Question...

2002-11-20 Thread NIPP, SCOTT V (SBCSI)
Once again I am posting a bit off topic, so tell me to go away if
this is bugging people...

Thanks for all of the assistance so far in creating what will be a
completely automated user account request system.  I am now trying to figure
out the mechanics of the account approval process.  So far I have created a
set of web pages that allows a user to login and select systems from a
database populated list.  These selections in turn populate another database
table and include a timestamp as to when the request was made.  I am working
on a Perl script to query the database looking for new requests, and from
this an e-mail will be sent to the user's supervisor for approval.
The area where I am needing more help is getting the supervisor back
to the approval web page.  My intention is to provide the supervisor with a
web link in the e-mail to take him directly to the approval page.  The
question is how do I actually make this occur.  I am pretty sure I can
figure out the Perl scripting to send the e-mail, but what is the URL that I
am having him come back to?  How do I create this new URL?  
Any suggestions ideas or pointers would be most helpful.  Thanks
again for all the help and sorry for the off-topic post.

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-DB] HTML Forms question...

2002-11-19 Thread NIPP, SCOTT V (SBCSI)
I know that this is not the forum for this question, I am only
looking for a pointer in the right direction here.  I need to gain a better
understanding of HTML forms, specifically checkboxes.  What I am looking for
is once I present a list of checkboxes and the user makes his selections,
how is this presented to the subsequent pages?  Does anyone know of a
website that has a tutorial or good explanation of how this works?  Thanks
in advance.

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




RE: [PHP-DB] HTML Forms question...

2002-11-19 Thread NIPP, SCOTT V (SBCSI)
OK.  If I am using the POST method and the checkbox 'name' for all
of the checkboxes is 'system', how do I access the results?  I am
researching on the PHP site trying to figure out what this array is, and how
I access this if the index name is the same for all elements.  I am hoping
that this data will be in an array and I can simply loop through the
contents of the array.  If this data is stored in a hash (Perl word for this
type of array, not sure if it's the same in PHP), how do I access this data
since the index for every element would be the same?
I am SURE that I am probably missing some important conceptual
issues here, but still learning as I go.  Unfortunately, this probably means
that I will be completely rewriting this application at least once in the
future.  Oh well, live and learn.  Thanks again for the help.

-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 10:35 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] HTML Forms question...


input type=checkbox name=checkbox1 value=scoobydoo

if this is checked the value scoobydoo will be put into the array with
index checkbox1 which array is dependant on which method your form uses.
:-) If it is not checked then there is no entry. in PHP with
register_globals on the variable $checkbox1 will equal scoobydoo and not
be set if the box is not checked.

hope this helps...

 Ryan

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 9:28 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] HTML Forms question...


I know that this is not the forum for this question, I am only
looking for a pointer in the right direction here.  I need to gain a better
understanding of HTML forms, specifically checkboxes.  What I am looking for
is once I present a list of checkboxes and the user makes his selections,
how is this presented to the subsequent pages?  Does anyone know of a
website that has a tutorial or good explanation of how this works?  Thanks
in advance.

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

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




  1   2   >