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

2002-11-19 Thread NIPP, SCOTT V (SBCSI)
Javascript...  What's that???

Just kidding.  I know what it is, but that is about the extent of my
knowledge.  Thanks for all the great feedback.  I was actually just looking
to be pointed in the right direction as this was a bit outside the scope of
this group.  You guys come through in shining fashion though and solve the
problem for me.

Now just to figure out the next 73 issues/steps/challenges/problems.
:)

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


You learn something new every day! I'll have to remember the [] thing.
My way of handling this situation that does not screw up JavaScript is to
assign the names sequentially, so instead of all the checkboxes being system
they would be system0,system1,... Since PHP is so wonderfully easy to use
for referencing variable variable names I simply loop through:

for($i=0;$iNUMBEROFCHECKBOXES;$i++){
  $var = system$i;
  $val = $$var;
  if (isset($$var)) //--- I think this works.
echo $var = $valbr;
  else
echo $var is not checked.;
}

Since I always end up creating the form in PHP I just have the algorithm put
a hidden field in the form that contains the number of checkboxes, in fact
my PHP usually creates the JavaScript code as well, so it ends up being
pretty flexible.

 Ryan


-Original Message-
From: Rich Gray [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 6:13 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] HTML Forms question...


If you name the checkbox as name=system[] then PHP will automatically
create an array of the checkbox values which can be subsequently accessed
via $_POST['system'][n] - be warned however that the '[]' can screw up any
JavaScript code that refers to the checkbox object...

HTH
Rich
-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: 19 November 2002 08:53
To: 'Ryan Jameson (USA)'; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] HTML Forms question...


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.


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

2002-11-19 Thread NIPP, SCOTT V (SBCSI)
OK.  This has been most helpful, but now I am getting something
strange.  The first element of the array of data is behaving strangely.  For
the code snippet below I am not getting the first selected element
displayed:

?php
... Some stuff snipped...
$a = 0;
?
?php
  while (isset($_POST['system'][$a])) { 
$a++;
echo $_POST['system'][$a];
  }
?

The second, third, and so forth selections all print, just not the
first one.  Also, I can test the contents of the first element by placing an
echo before the while loop.  Thanks in advance.


-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 11:11 AM
To: NIPP, SCOTT V (SBCSI); 'Ryan Jameson (USA)'; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] HTML Forms question...


 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.

If you have multiple checkboxes with the same 'name' then you should name
then with brackets, [], such as 'system[]'. This will tell PHP to make the
results an array when the form is submitted.

For any of the 'submit[]' checkboxes that are checked, they will be present
in PHP array on the processing page. Those unchecked will not be present.

Say you have the following.

input type=checkbox name=submit[] value=1One
input type=checkbox name=submit[] value=2Two
input type=checkbox name=submit[] value=3Three

If the method on your form is POST, and the user checks One and Three, then
you'll have the following values in PHP on the ACTION page of the FORM.

$_POST['submit'][0] == 1
$_POST['submit'][1] == 3

From that data, though, there's no way to tell that checkbox Two was not
checked, unless you go through and check all of the values. That's fine for
small forms, but a hassle for large ones.

You could also name your checkboxes like this:

input type=checkbox name=submit[1] value=1One
input type=checkbox name=submit[2] value=2Two
input type=checkbox name=submit[3] value=3Three

and if the user checks one and three again, you'll get

$_POST['submit'][1] == 1
$_POST['submit'][3] == 3

Hopefully that clears some things up. If you have any other questions, just
ask.

---John Holmes...

-- 
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)
DUH!!!  I'm an idiot.  That was quite obvious.  Thanks.  Sorry for
the stupid question.

-Original Message-
From: Hutchins, Richard [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 2:40 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] HTML Forms question...


I think it's because you're incrementing $a BEFORE you echo it out. That
would cause your echo statement to start at the second item [1].

 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, November 19, 2002 3:36 PM
 To: '1LT John W. Holmes'; 'Ryan Jameson (USA)'; [EMAIL PROTECTED]
 Subject: RE: [PHP-DB] HTML Forms question...
 
 
   OK.  This has been most helpful, but now I am getting something
 strange.  The first element of the array of data is behaving 
 strangely.  For
 the code snippet below I am not getting the first selected element
 displayed:
 
 ?php
 ... Some stuff snipped...
 $a = 0;
 ?
 ?php
   while (isset($_POST['system'][$a])) { 
 $a++;
   echo $_POST['system'][$a];
   }
 ?
 
   The second, third, and so forth selections all print, 
 just not the
 first one.  Also, I can test the contents of the first 
 element by placing an
 echo before the while loop.  Thanks in advance.
 
 
 -Original Message-
 From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, November 19, 2002 11:11 AM
 To: NIPP, SCOTT V (SBCSI); 'Ryan Jameson (USA)'; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] HTML Forms question...
 
 
  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.
 
 If you have multiple checkboxes with the same 'name' then you 
 should name
 then with brackets, [], such as 'system[]'. This will tell 
 PHP to make the
 results an array when the form is submitted.
 
 For any of the 'submit[]' checkboxes that are checked, they 
 will be present
 in PHP array on the processing page. Those unchecked will not 
 be present.
 
 Say you have the following.
 
 input type=checkbox name=submit[] value=1One
 input type=checkbox name=submit[] value=2Two
 input type=checkbox name=submit[] value=3Three
 
 If the method on your form is POST, and the user checks One 
 and Three, then
 you'll have the following values in PHP on the ACTION page of 
 the FORM.
 
 $_POST['submit'][0] == 1
 $_POST['submit'][1] == 3
 
 From that data, though, there's no way to tell that checkbox 
 Two was not
 checked, unless you go through and check all of the values. 
 That's fine for
 small forms, but a hassle for large ones.
 
 You could also name your checkboxes like this:
 
 input type=checkbox name=submit[1] value=1One
 input type=checkbox name=submit[2] value=2Two
 input type=checkbox name=submit[3] value=3Three
 
 and if the user checks one and three again, you'll get
 
 $_POST['submit'][1] == 1
 $_POST['submit'][3] == 3
 
 Hopefully that clears some things up. If you have any other 
 questions, just
 ask.
 
 ---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] Variable from PHP to HTML...

2002-11-12 Thread NIPP, SCOTT V (SBCSI)
I am attempting to create a form of system names that is populated
from a database query.  The database query is working fine, and the form
population is actually working fine also.  The question I have is about
organizing the variables that result from the form.  I want to use the
system name as the variable name but I am having trouble figuring out how to
do this.  Below is what I currently have working:

form name=form1 method=post action=
table border=0 align=center
  ?php do {
$sys = $system['Name'];
if ($cnt == 1) { 
$cnt = 2; 
echo tr; ?
td width=161input name=system type=checkbox value=name 
  ?php echo $sys; ?/td

I would like to be able to access this variable $sys from the HTML
code.  Is this possible?  I am thinking something like this, but it doesn't
appear to work:

form name=form1 method=post action=
table border=0 align=center
  ?php do {
$sys = $system['Name'];
if ($cnt == 1) { 
$cnt = 2; 
echo tr; ?
td width=161input name=$sys type=checkbox value=name 
  ?php echo $sys; ?/td

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-DB] Session Variable Question...

2002-11-01 Thread NIPP, SCOTT V (SBCSI)
I am a little confused by a specific behavior of a session variable.
Here is an example of my confusion:

?php require_once('prod.lib.php');
session_start();
if (!isset($_SESSION['valid_user']))
{
  echo You must be logged in to use this application.  br;
  echo Please a href=\login.php\ login/a now.  br;
  exit();
} else {
  $sbcuid = $valid_user;
}

$_SESSION['type'] = $AccountType;
if (!isset($_SESSION['type']))
{
  echo You did not select an account creation option.  brPlease return to
the previous page and make a selection.;
}
echo $_SESSION[type];
echo $type;
?

OK...  The basic question is that the first time the page loads only
the '$_SESSION[type]' variable is populated.  If you hit the back button and
then reload this page, then both variables are populated even if the
$AccountType is changed on the previous page.  I can now work around this
problem, but I would like to understand why it behaves this way.

Sorry if this is covered in the documentation or a FAQ somewhere.
Thanks in advance for the feedback.
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 crypt test...

2002-10-23 Thread NIPP, SCOTT V (SBCSI)
I am having trouble with a canned calendar application and I think
that maybe the problem is the crypt function.  Does anyone know of a good
way to test the crypt function?  I need to figure out somehow if this is the
source of the problem or not.  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] Log Application Formatting Issue...

2002-10-18 Thread NIPP, SCOTT V (SBCSI)
I am trying to tweak an application that I have developed.  The
application is our On-Call Log.  This application consists of three pages;
one page to input new entries, one page to edit existing entries, and
finally a log view page.  The log view page displays all entries for the
past 5 days.  The display of the entries is formatted properly, and
presented chronologically with the oldest first with 10 items per page.
This is exactly what I want.  The one thing that I want to change is that
the log defaults to displaying the first page containing the oldest items.
I would like the log to display exactly as it does, but default to
displaying the last page first.  This way we see the most recent items
first.
I hope this makes sense, and following is what I think are the
relevant sections of the code:

{ some code snipped }
mysql_select_db($database, $Prod);
$query_entry = SELECT * FROM oncall WHERE TO_DAYS(NOW()) - TO_DAYS(ptime)
=5 ORDER BY 'ptime' ASC;
$query_limit_entry = sprintf(%s LIMIT %d, %d, $query_entry,
$startRow_entry, $maxRows_entry);
$entry = mysql_query($query_limit_entry, $Prod) or die(mysql_error());
$row_entry = mysql_fetch_assoc($entry);

if (isset($HTTP_GET_VARS['totalRows_entry'])) {
  $totalRows_entry = $HTTP_GET_VARS['totalRows_entry'];
} else {
  $all_entry = mysql_query($query_entry);
  $totalRows_entry = mysql_num_rows($all_entry);
}
$totalPages_entry = ceil($totalRows_entry/$maxRows_entry)-1;

{ Not completely sure what following section does.  }

$queryString_entry = ;
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $params = explode(, $HTTP_SERVER_VARS['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
if (stristr($param, pageNum_entry) == false  
stristr($param, totalRows_entry) == false) {
  array_push($newParams, $param);
}
  }
  if (count($newParams) != 0) {
$queryString_entry =  . implode(, $newParams);
  }
}
$queryString_entry = sprintf(totalRows_entry=%d%s, $totalRows_entry,
$queryString_entry);
?
{ I know that this has to do with handling the log page numbering,
but fuzzy on the details.  }

{  some html formatting snipped  }

  ?php do { 
if ($row_entry['P1']) { ?
  tr 
td height=23 bgcolor=#FAADBC 
  div align=centera href=oncall_update.php?callid=?php echo
$row_entry['callid']; ??php echo $row_entry['callid']; ?/a/div/td
td valign=top bgcolor=#FAADBC?php echo $row_entry['sa']; ?/td
td valign=top bgcolor=#FAADBC?php echo $row_entry['ptime'];
?/td
td valign=top bgcolor=#FAADBCdiv align=center?php echo
$row_entry['system']; ?/div/td
td valign=top bgcolor=#FAADBC?php echo $row_entry['name'];
?/td
td valign=top bgcolor=#FAADBC?php echo $row_entry['problem'];
?/td
td valign=top bgcolor=#FAADBC?php echo $row_entry['resolution'];
?/td
  /tr
  ?php } else { ?
tr 
td height=23 bgcolor=#CC 
  div align=centera href=oncall_update.php?callid=?php echo
$row_entry['callid']; ??php echo $row_entry['callid']; ?/a/div/td
td valign=top bgcolor=#CC?php echo $row_entry['sa']; ?/td
td valign=top bgcolor=#CC?php echo $row_entry['ptime'];
?/td
td valign=top bgcolor=#CCdiv align=center?php echo
$row_entry['system']; ?/div/td
td valign=top bgcolor=#CC?php echo $row_entry['name'];
?/td
td valign=top bgcolor=#CC?php echo $row_entry['problem'];
?/td
td valign=top bgcolor=#CC?php echo $row_entry['resolution'];
?/td
  /tr
  ?php } ?
{  Snipped the rest  }

I am using DreamWeaver MX, so some of this code may be a little
strange.  This is also the reason why I am a bit confused by some of what is
goign on in the page.  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] Log Application Formatting Issue...

2002-10-18 Thread NIPP, SCOTT V (SBCSI)
Yeah, this is the exact fix I am trying to avoid.  Thanks for the
feedback, but I prefer to keep the items chronological ascending order.  I
know there has to be a way to simply default the display to the last page of
the dataset.

-Original Message-
From: Jason Wong [mailto:phplist;gremlins.com.hk]
Sent: Friday, October 18, 2002 11:58 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Log Application Formatting Issue...


On Saturday 19 October 2002 00:09, NIPP, SCOTT V (SBCSI) wrote:
 I am trying to tweak an application that I have developed.  The
 application is our On-Call Log.  This application consists of three
 pages; one page to input new entries, one page to edit existing entries,
 and finally a log view page.  The log view page displays all entries for
 the past 5 days.  The display of the entries is formatted properly, and
 presented chronologically with the oldest first with 10 items per page.
 This is exactly what I want.  The one thing that I want to change is that
 the log defaults to displaying the first page containing the oldest
 items. I would like the log to display exactly as it does, but default to
 displaying the last page first.  This way we see the most recent items
 first.
   I hope this makes sense, and following is what I think are the
 relevant sections of the code:

One quick fix is to just display the items in reverse order so the newest 
items are always first ...

 { some code snipped }
 mysql_select_db($database, $Prod);
 $query_entry = SELECT * FROM oncall WHERE TO_DAYS(NOW()) - TO_DAYS(ptime)
 =5 ORDER BY 'ptime' ASC;

... change the ASC to DESC should do the trick.

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


/*
Yow!  Did something bad happen or am I in a drive-in movie??
*/


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

2002-10-02 Thread NIPP, SCOTT V (SBCSI)

Give phpMyAdmin a try...

http://www.phpmyadmin.net/

-Original Message-
From: Brett Lathrope [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 02, 2002 8:55 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Noob questions...



Ok, here's my scenario...

My Web Host has all Root Admin control over MySQL and PHP configs (but they
are setup well no complaints there)...I simply have access to 1 DB (already
created) that I can do what I want with (create/delete/update tables).

I'm VERY comfortable in Windows, C/C++, Delphi and SQL.  But I'm a noob to
Unix/Linux, as well as both MySQL and PHP.

I have two books and the online manuals and I'm reading them...unfortunately
almost ALL of them assume you have Root Admin (as well as build) privileges.

Can someone recommend a MySQL Front End, that a) is free and b) a noob can
set up and finally c) allows me to work from a client on MySQL DB on my Web
Host?

Thanks Brett




-- 
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] Log Application Help...

2002-08-13 Thread NIPP, SCOTT V (SBCSI)

I have a Log Application that is fully functional, but I need to
change a behavior and can't quite figure out how.  This app has three pages,
one for entering new entries, one to display all entries for the last 5
days, and the final page allows updating of existing entries.  The problem I
am having is that the log display page displays the data ordered by date and
displays the oldest data first.  I want the data ordered this way, but I
would like it to default to the last page such that you see the most recent
entry first.  The log displays 10 entries per page, and I just want it to
default to displaying the last page rather than the first.  Below is what I
think are the pertinent sections of code.  Please let me know what you
think, and if you need more information or code.  Thanks in advance for the
assistance.

?php require_once('prod.lib.php'); ?
?php
$currentPage = $HTTP_SERVER_VARS[PHP_SELF];
$maxRows_entry = 10;
$pageNum_entry = 0;
if (isset($HTTP_GET_VARS['pageNum_entry'])) {
  $pageNum_entry = $HTTP_GET_VARS['pageNum_entry'];
}
$startRow_entry = $pageNum_entry * $maxRows_entry;

mysql_select_db($database, $Prod);
$query_entry = SELECT * FROM oncall WHERE TO_DAYS(NOW()) - TO_DAYS(ptime)
=5 ORDER BY 'ptime' ASC;
$query_limit_entry = sprintf(%s LIMIT %d, %d, $query_entry,
$startRow_entry, $maxRows_entry);
$entry = mysql_query($query_limit_entry, $Prod) or die(mysql_error());
$row_entry = mysql_fetch_assoc($entry);

if (isset($HTTP_GET_VARS['totalRows_entry'])) {
  $totalRows_entry = $HTTP_GET_VARS['totalRows_entry'];
} else {
  $all_entry = mysql_query($query_entry);
  $totalRows_entry = mysql_num_rows($all_entry);
}
$totalPages_entry = ceil($totalRows_entry/$maxRows_entry)-1;

$queryString_entry = ;
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $params = explode(, $HTTP_SERVER_VARS['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
if (stristr($param, pageNum_entry) == false  
stristr($param, totalRows_entry) == false) {
  array_push($newParams, $param);
}
  }
  if (count($newParams) != 0) {
$queryString_entry =  . implode(, $newParams);
  }
}
$queryString_entry = sprintf(totalRows_entry=%d%s, $totalRows_entry,
$queryString_entry);
?

...  A bunch of HTML formatting snipped out...

  ?php } while ($row_entry = mysql_fetch_assoc($entry)); ?
/tableRecords ?php echo ($startRow_entry + 1) ? to ?php echo
min($startRow_entry + $maxRows_entry, $totalRows_entry) ? of ?php echo
$totalRows_entry ? 
table border=0 width=50% align=center
  tr 
td width=23% align=center ?php if ($pageNum_entry  0) { // Show
if not first page ?
  a href=?php printf(%s?pageNum_entry=%d%s, $currentPage, 0,
$queryString_entry); ?First/a 
  ?php } // Show if not first page ? /td
td width=31% align=center ?php if ($pageNum_entry  0) { // Show
if not first page ?
  a href=?php printf(%s?pageNum_entry=%d%s, $currentPage, max(0,
$pageNum_entry - 1), $queryString_entry); ?Previous/a 
  ?php } // Show if not first page ? /td
td width=23% align=center ?php if ($pageNum_entry 
$totalPages_entry) { // Show if not last page ?
  a href=?php printf(%s?pageNum_entry=%d%s, $currentPage,
min($totalPages_entry, $pageNum_entry + 1), $queryString_entry);
?Next/a 
  ?php } // Show if not last page ? /td
td width=23% align=center ?php if ($pageNum_entry 
$totalPages_entry) { // Show if not last page ?
  a href=?php printf(%s?pageNum_entry=%d%s, $currentPage,
$totalPages_entry, $queryString_entry); ?Last/a 
  ?php } // Show if not last page ? /td
  /tr
/table

...Cut of the rest of the HTML junk...

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

2002-07-30 Thread NIPP, SCOTT V (SBCSI)

I am upgrading from PHP 4.1.2 to 4.2.2, and I cannot get the make
install to work.  I am doing this on HP-UX 11.00, and I have tried the
suggestion of renaming the libphp4.sl files to libphp4.so, but I still get
failures.  Below is the output of the make install before changing the
libphp4 filename:

Making install in .
/build/php-4.2.2/build/shtool mkdir -p /usr/local/apache/libexec
 /u
sr/local/apache/bin/apxs -S LIBEXECDIR=/usr/local/apache/libexec -i -a -n
php4
 libs/libphp4.sl
apxs:Error: file libs/libphp4.sl is not a DSO
*** Error exit code 1

Here is the output after renaming libphp4.sl to libphp4.so in both
the libs and .libs directories:

Making install in .
*** Error exit code 1
Stop.
*** Error exit code 1

I am pretty much at my wits end at this point.  Any help on this
would be most appreciated.  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] Dropdown list question...

2002-07-29 Thread NIPP, SCOTT V (SBCSI)

I am populating a dropdown list from a database.  This is working
fine with one minor glitch...  For some reason, the first entry in the
database does not seem to be getting populated into the list.  I do not see
anything wrong, and was hoping that someone else might be able to spot a
problem.  Here is the code that generates the dropdown list:

$query_systems = SELECT Name FROM systems;
$systems = mysql_query($query_systems, $Test) 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;

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] Dropdown list question...

2002-07-29 Thread NIPP, SCOTT V (SBCSI)

Thanks for the answers.  This has resolved my problem.

-Original Message-
From: Andrey Hristov [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 29, 2002 11:21 AM
To: NIPP, SCOTT V (SBCSI)
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Dropdown list question...




- Original Message -
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, July 29, 2002 7:12 PM
Subject: [PHP-DB] Dropdown list question...


 I am populating a dropdown list from a database.  This is working
 fine with one minor glitch...  For some reason, the first entry in the
 database does not seem to be getting populated into the list.  I do not
see
 anything wrong, and was hoping that someone else might be able to spot a
 problem.  Here is the code that generates the dropdown list:

 $query_systems = SELECT Name FROM systems;
 $systems = mysql_query($query_systems, $Test) or die(mysql_error());
 $row_systems = mysql_fetch_assoc($systems);
Here is your error. You do fetch_assoc and then you are not using it.
Comment it out.

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

 Thanks in advance for the help.

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


Regards,
Andrey Hristov


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




[PHP-DB] Log application...

2002-07-24 Thread NIPP, SCOTT V (SBCSI)

Hey guys.  Thanks in advance for all the help that this group has
provided to me so far.  I am still learning, so many of my questions have
been pretty simple.  This may also be pretty simple, but I cannot for the
life of me figure out how to make this happen.
I have a Log application that is running on Apache/PHP/MySQL.  This
application has three pages: first a page to input new log entries, second a
log view of entries, and the third is a page to edit existing entries.  The
basics of all three pages is working great.  Upon entering a new record the
app transfers you directly to the Log view page(s).  The Log view page(s)
display 10 entries per page for the past 5 days chronologically beginning
with the oldest.  Here is basically where my problem lies...  I want this
exact behavior, only I want the view to default to the last page rather than
the first.  I cannot figure out how to make this happen, and haven't had
much luck in finding some code to borrow this from.  Here is the code
section that handles the Log display:

?php require_once('prod.lib.php'); ?
?php
$currentPage = $HTTP_SERVER_VARS[PHP_SELF];
$maxRows_entry = 10;
$pageNum_entry = 0;
if (isset($HTTP_GET_VARS['pageNum_entry'])) {
  $pageNum_entry = $HTTP_GET_VARS['pageNum_entry'];
}
$startRow_entry = $pageNum_entry * $maxRows_entry;

mysql_select_db($database, $Prod);
$query_entry = SELECT * FROM oncall WHERE TO_DAYS(NOW()) - TO_DAYS(ptime)
=5 O
RDER BY 'ptime' ASC;
$query_limit_entry = sprintf(%s LIMIT %d, %d, $query_entry,
$startRow_entry, $
maxRows_entry);
$entry = mysql_query($query_limit_entry, $Prod) or die(mysql_error());
$row_entry = mysql_fetch_assoc($entry);

if (isset($HTTP_GET_VARS['totalRows_entry'])) {
  $totalRows_entry = $HTTP_GET_VARS['totalRows_entry'];
} else {
  $all_entry = mysql_query($query_entry);
  $totalRows_entry = mysql_num_rows($all_entry);
}
$totalPages_entry = ceil($totalRows_entry/$maxRows_entry)-1;

$queryString_entry = ;
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $params = explode(, $HTTP_SERVER_VARS['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
if (stristr($param, pageNum_entry) == false 
stristr($param, totalRows_entry) == false) {
  array_push($newParams, $param);
}
  }
  if (count($newParams) != 0) {
$queryString_entry =  . implode(, $newParams);
  }
}
$queryString_entry = sprintf(totalRows_entry=%d%s, $totalRows_entry,
$querySt
ring_entry);
?

Some HTML formatting omitted...

?php do {
tr
td height=23 bgcolor=#CC
  div align=centera href=oncall_update.php?callid=?php echo
$row_entr
y['callid']; ??php echo $row_entry['callid']; ?/a/div/td
td valign=top bgcolor=#CC?php echo $row_entry['sa']; ?/td
td valign=top bgcolor=#CC?php echo $row_entry['ptime'];
?/td
td valign=top bgcolor=#CCdiv align=center?php echo
$row_entry
['system']; ?/div/td
td valign=top bgcolor=#CC?php echo $row_entry['name'];
?/td
td valign=top bgcolor=#CC?php echo $row_entry['problem'];
?/td
td valign=top bgcolor=#CC?php echo $row_entry['resolution'];
?/
td
  /tr
  ?php } while ($row_entry = mysql_fetch_assoc($entry)); ?

thanks in advance for any assistance.

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] Keeps prompting to download php page???

2002-07-17 Thread NIPP, SCOTT V (SBCSI)

Yes.  I have the application type, and both the LoadModule and
AddModule directives for PHP in the httpd.conf file.  Here are those entries
cut and pasted from my httpd.conf:

# LoadModule foo_module libexec/mod_foo.so
LoadModule frontpage_module   libexec/mod_frontpage.so
LoadModule php4_modulelibexec/libphp4.so
IfDefine SSL
LoadModule ssl_module libexec/libssl.so
LoadModule dav_module libexec/libdav.so
/IfDefine

AddModule mod_php4.c

AddType application/x-httpd-php .htm

The AddType directive is exactly the same as another web server that
is working fine.  I know that it shows .htm, but it works fine on my other
server this way.  Thanks again.

-Original Message-
From: Beau Lebens [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 16, 2002 8:04 PM
To: NIPP, SCOTT V (SBCSI)
Subject: RE: [PHP-DB] Keeps prompting to download php page???


what Adam said is true, but it sounds like in the process of upgrading
Apache you have lost track of how to process PHP pages.

Check your httpd.conf file for lines similar to these, if there's nothing
close then you will need to reconfigure PHP

LoadModule php4_module modules/php4apache.dll
AddType application/x-httpd-php .php



// -Original Message-
// From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
// Sent: Wednesday, 17 July 2002 4:55 AM
// To: '[EMAIL PROTECTED]'
// Subject: [PHP-DB] Keeps prompting to download php page???
// 
// 
//  I just upgraded to Apache 1.3.26, and everything it 
// fine except PHP.
// Whenever I try to load a PHP page in the browser, the 
// browser attempts to
// download the page.  I know that I am missing something simple here.
// 
// 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] Data Synchronization...

2002-07-16 Thread NIPP, SCOTT V (SBCSI)

This is actually more of a MySQL question, but here goes...

I have two servers, one production and one development.  I would
like to use the development server as a backup for the production server.
Is there a way to synchronize the MySQL databases between these two servers?
I imagine that I could just copy over the MySQL data directory on a nightly
basis, but is there a more elegant way of doing this?  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] Keeps prompting to download php page???

2002-07-16 Thread NIPP, SCOTT V (SBCSI)

I just upgraded to Apache 1.3.26, and everything it fine except PHP.
Whenever I try to load a PHP page in the browser, the browser attempts to
download the page.  I know that I am missing something simple here.

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 Query problem...

2002-07-08 Thread NIPP, SCOTT V (SBCSI)

I seem to have run into another problem with a query that I am doing
exactly like the example in the MySQL documentation, I think.  The following
query is not working on my PHP page, and it is not working from a MySQL
command line either.  This looks exactly the same as an example in the MySQL
documentation though.  Thanks in advance for the help again.

SELECT * FROM oncall WHERE TO_DAYS(NOW()) - TO_DAYS(ptime) = 3

This is the query that I am ultimately after:

SELECT * FROM oncall ORDER BY 'ptime' ASC WHERE TO_DAYS(NOW()) -
TO_DAYS(ptime) = 3

I am trying to display all of the records from the past three days.
This looks like the way to go about doing this, but if there is a better way
please let me know.  (Just as more info, the 'ptime' field is a datetime
type of field.)

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 test database creation...

2002-07-05 Thread NIPP, SCOTT V (SBCSI)

Hey guys...  I know that this is not specifically on topic for this
group, but I promise this is an easy one.

I am developing a web app, and need to create a development copy of
the production database.  I have created the new database, now I just need
to  export and import the schema and data from the production database.  I
am running MySQL 3.23.49, and I am using phpMyAdmin for the bulk of my
database administration.  I can get the data and schema dumped to a file
easily enough with phpMyAdmin, but it does not seem to offer an import.  I
know that mysqlimport should be the tool to handle this, but I want to make
this as easy as possible for myself and I am pretty sure there is a way to
have it create the tables and everything from the schema data.  I have check
the mysql documentation, but I am not finding what I need.  I am sure it is
in there, but I have had a pretty long night with little sleep.
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] MySQL test database creation...

2002-07-05 Thread NIPP, SCOTT V (SBCSI)

Thanks, but I finally stumbled across the answer.  Thankfully it was
simple enough even for me.  In case anyone else had this question also, all
you have to do is browse for your dump file in the 'SQL' window of
phpMyAdmin and click 'Go'.  That's it.

-Original Message-
From: NIPP, SCOTT V (SBCSI)
[mailto:[EMAIL PROTECTED]]
Sent: Friday, July 05, 2002 12:26 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] MySQL test database creation...


Hey guys...  I know that this is not specifically on topic for this
group, but I promise this is an easy one.

I am developing a web app, and need to create a development copy of
the production database.  I have created the new database, now I just need
to  export and import the schema and data from the production database.  I
am running MySQL 3.23.49, and I am using phpMyAdmin for the bulk of my
database administration.  I can get the data and schema dumped to a file
easily enough with phpMyAdmin, but it does not seem to offer an import.  I
know that mysqlimport should be the tool to handle this, but I want to make
this as easy as possible for myself and I am pretty sure there is a way to
have it create the tables and everything from the schema data.  I have check
the mysql documentation, but I am not finding what I need.  I am sure it is
in there, but I have had a pretty long night with little sleep.
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-DB] A real question this time...

2002-07-05 Thread NIPP, SCOTT V (SBCSI)

This time I have a real question that I need help with.  I am not
sure why something is not working the way I intend it.  This is most likely
a mistake in my understanding, but here goes...
I have a section of code that populates a dropdown list with the
results of a query on a database table.  This works perfectly, and is
exactly what I want.  My problem is that I need to use this same data to
populate a second dropdown list, and the second list is empty.  I thought
that by setting another variable equal to the original prior to it being
processed in a loop which populates the first drop down I would be OK, but
this doesn't seem to do the trick for me.  Here is the section of code that
I am working with.  Thanks in advance.

mysql_select_db($database, $Test);
$query_SA = SELECT sbcuid FROM contacts_sa;
$SA = mysql_query($query_SA, $Test) or die(mysql_error());
$PASS = $SA;
$row_SA = mysql_fetch_assoc($SA);
$totalRows_SA = mysql_num_rows($SA);
$sa_list = select size=\1\ name=\sa\\n;
$sa_list .= optionSA UID/option\n;
while($name = mysql_fetch_row($SA)) {
  $sa_list .= option$name[0]/option\n;
}
$passed = select size=\1\ name=\pass\\n;
$passed .= optionSA UID/option\n;
$passed .= option--/option\n;
while($name = mysql_fetch_row($PASS)) {
  $passed .= option$name[0]/option\n;
}

I understand that some of this is unnecessary, but I am using DW MX
and do not believe that the extra variable definitions hurt anything.  I
might find a use for the row variables down the road anyway.  Correct me if
I am wrong though, that these are actual database queries and at least
commenting them out could help performance?  That is a secondary question,
but thanks agian.

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] another problem with mySQL server

2002-07-05 Thread NIPP, SCOTT V (SBCSI)

Since you are using phpMyAdmin, I would suggest taking a look at the
user table in the mysql database.  I would suspect that you do not have the
proper permissions in the user table.  If this 'admin' user should have full
rights to the database, you will need to make sure that you have two entries
for 'admin'.  One entry should have the 'host' field entry of 'localhost',
the other entry should define any remote connections like '%.test.com' to
connect from any system in the 'test.com' DNS domain.  Both of these entries
should then have 'Y' for all of the 'priv' values.
I hope this helps, and I hope I am correct.  Someone please let me
know if I have screwed something up here.

-Original Message-
From: Damiano Ferrari [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 05, 2002 1:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] another problem with mySQL server


Hello everybody,

I am having again problems with the mySQL server. I wrote one simple
.php page with the following lines:

?
mysql_connect(localhost,admin,password) or die(Could not connect to
server);
?

When I call the script, I get this error:

Warning: Access denied for user: 'admin@localhost' (Using password: YES) in
D:\Inetpub\wwwroot\test.php on line 2

Warning: MySQL Connection Failed: Access denied for user: 'admin@localhost'
(Using password: YES) in D:\Inetpub\wwwroot\test.php on line 2
Could not connect to server


I started having problems while I was updating some tables through
phpMyAdmin. I suspect this must be a problem related to mySQL, but how
do I verify that and how can I fix the problem? Any idea/help would
be, again, much appreciated.

Damiano



-- 
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] A real question this time...

2002-07-05 Thread NIPP, SCOTT V (SBCSI)

Perfect.  Why was I trying to make this more difficult???  Sometimes
the simple solution is definitely the best.

-Original Message-
From: Shrock, Court [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 05, 2002 1:50 PM
To: NIPP, SCOTT V (SBCSI); '[EMAIL PROTECTED]'
Subject: RE: [PHP-DB] A real question this time...


You are correct that an assignment between two variable is a copy, and that
is exactly what is happening, however, you need to know what $SA is
originally--it is a resource pointer in ways...it does not hold any data, it
is just an internal pointer to where php is storing the data.  So, when you
do $PASS = $SA, you are simply creating two resource pointers that point to
the same dataset--that is why the internal functions that loop through the
dataset work the first time and not the second.

Instead of trying to loop through twice, why not loop through once, and set
two variables in each iteration of the loop like::

while($name = mysql_fetch_row($SA)) {
   $sa_list .= option$name[0]/option\n;
   $passed .= option$name[0]/option\n;
}

 -Original Message-
 From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] 
 Sent: Friday, July 05, 2002 11:44 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP-DB] A real question this time...
 
 
   This time I have a real question that I need help with. 
  I am not sure why something is not working the way I intend 
 it.  This is most likely a mistake in my understanding, but 
 here goes...
   I have a section of code that populates a dropdown list 
 with the results of a query on a database table.  This works 
 perfectly, and is exactly what I want.  My problem is that I 
 need to use this same data to populate a second dropdown 
 list, and the second list is empty.  I thought that by 
 setting another variable equal to the original prior to it 
 being processed in a loop which populates the first drop down 
 I would be OK, but this doesn't seem to do the trick for me.  
 Here is the section of code that I am working with.  Thanks 
 in advance.
 
 mysql_select_db($database, $Test);
 $query_SA = SELECT sbcuid FROM contacts_sa;
 $SA = mysql_query($query_SA, $Test) or die(mysql_error()); 
 $PASS = $SA; $row_SA = mysql_fetch_assoc($SA); $totalRows_SA 
 = mysql_num_rows($SA); $sa_list = select size=\1\ 
 name=\sa\\n; $sa_list .= optionSA UID/option\n; 
 while($name = mysql_fetch_row($SA)) {
   $sa_list .= option$name[0]/option\n;
 }
 $passed = select size=\1\ name=\pass\\n;
 $passed .= optionSA UID/option\n;
 $passed .= option--/option\n;
 while($name = mysql_fetch_row($PASS)) {
   $passed .= option$name[0]/option\n;
 }
 
   I understand that some of this is unnecessary, but I am 
 using DW MX and do not believe that the extra variable 
 definitions hurt anything.  I might find a use for the row 
 variables down the road anyway.  Correct me if I am wrong 
 though, that these are actual database queries and at least 
 commenting them out could help performance?  That is a 
 secondary question, but thanks agian.
 
 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] MySQL Update failing...

2002-06-27 Thread NIPP, SCOTT V (SBCSI)

In need of some help.  I have a PHP form page that is updating a
MySQL database that is not working.  Here is the code for the three pages
that work together for this application.  The oncall_new.php works fine to
insert new records into the database, and the oncall_log.php works fine to
display the database items.  The oncall_update.php is the one that is
failing to update the database.  I cannot find anything wrong with the code,
and I making an initial presentation of this in a couple hours.  I was
hoping another set of eyes might spot something obvious or simple.  Thanks
in advance.

 oncall_new4.php  oncall_update1.php  oncall_log.php 

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 Update failing...

2002-06-27 Thread NIPP, SCOTT V (SBCSI)

Figured it out.  Thanks to anyone who started looking at this.  The
problem was not having my variables in the correct order in the $updateSQL.
Once I corrected this, the posting now works fine.

-Original Message-
From: NIPP, SCOTT V (SBCSI)
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 11:07 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] MySQL Update failing...


In need of some help.  I have a PHP form page that is updating a
MySQL database that is not working.  Here is the code for the three pages
that work together for this application.  The oncall_new.php works fine to
insert new records into the database, and the oncall_log.php works fine to
display the database items.  The oncall_update.php is the one that is
failing to update the database.  I cannot find anything wrong with the code,
and I making an initial presentation of this in a couple hours.  I was
hoping another set of eyes might spot something obvious or simple.  Thanks
in advance.

 oncall_new4.php  oncall_update1.php  oncall_log.php 

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] Populating a dropdown list with ENUM values...

2002-06-26 Thread NIPP, SCOTT V (SBCSI)

I am working on an application that has several different fields
that are populated dropdown lists.  In every case, this data is simply data
from a MySQL table column and works great.  I have run into a new difficulty
though...  One field that I am wanting to populate in a dropdown list is an
ENUM field.  I am trying to figure out how to do this.  I have seen a couple
ideas in the newsgroups, but most are pretty complex and about a year or so
old.  I am hoping for a simpler solution that may have been developed since
these posts.  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] Populating a dropdown list with ENUM values...

2002-06-26 Thread NIPP, SCOTT V (SBCSI)

Thanks to everyone who responded.  I have found a function that
fills the role perfectly.

-Original Message-
From: Russ [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 26, 2002 7:47 PM
To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Populating a dropdown list with ENUM values...


G'day Scott:

I wrote this function to do just what you're atfer:
You may need to mess with it for you're own needs - but go for your
life!

//function: enum_select() - automatically generate an HTML select 
menu from a MySQL ENUM field
//1). takes a table name: '$table'
//2). a name for the menu '$name'
//3). a CSS class
function enum_select($table,$name,$class) {
 $sql = SHOW COLUMNS FROM $table; 
 $result = mysql_query($sql); 
 $select = select name=\$name\ class=\$class\\n\t;
 while($myrow = mysql_fetch_row($result)){ 
  $enum_field = substr($myrow[1],0,4);
  if($enum_field == enum){ 
   global $enum_field;
   $enums = substr($myrow[1],5,-1);
   $enums = ereg_replace(',,$enums);
   $enums = explode(,,$enums);
   foreach($enums as $val) {
$select .= option
value=\$val\$val/option\n\t;
}//end foreach
}//end if
}//end while
$select .= \r/select;
return $select;
}//end function


All the best.
Russ

-Original Message-
From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 3:38 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP-DB] Populating a dropdown list with ENUM values...


I am working on an application that has several different fields
that are populated dropdown lists.  In every case, this data is simply
data
from a MySQL table column and works great.  I have run into a new
difficulty
though...  One field that I am wanting to populate in a dropdown list is
an
ENUM field.  I am trying to figure out how to do this.  I have seen a
couple
ideas in the newsgroups, but most are pretty complex and about a year or
so
old.  I am hoping for a simpler solution that may have been developed
since
these posts.  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] Form not working...

2002-06-25 Thread NIPP, SCOTT V (SBCSI)

I am working on a Call Log application for our SA group.  I
currently have the database back-end configured and working OK.  Right now I
am working with 3 pages, one is to post new entries, the second is a log
view of all entries, and the last is a page that updates an existing entry.
I have the first two pages working OK.  The problem is the update page does
not post back into the database.  
I am working in Dreamweaver, and I am still quite new to PHP and web
page development in general.  I am not sure what some of the DreamWeaver PHP
code is doing, and I cannot figure out why I am not able to get the update
page to post to the database.  The update page is connecting successfully to
the database, because I have it's fields populated from the database for the
entry to be updated.  One other minor issue I am having, is getting a PHP
variable to populate a text area on the page.  Is this even possible?
Thanks in advance, and below is the code for the problem page.

?php require_once('Connections/Test.php'); ?
?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = ,
$theNotDefinedValue = ) 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
case text:
  $theValue = ($theValue != ) ? ' . $theValue . ' : NULL;
  break;
case long:
case int:
  $theValue = ($theValue != ) ? intval($theValue) : NULL;
  break;
case double:
  $theValue = ($theValue != ) ? ' . doubleval($theValue) . ' :
NULL;
  break;
case date:
  $theValue = ($theValue != ) ? ' . $theValue . ' : NULL;
  break;
case defined:
  $theValue = ($theValue != ) ? $theDefinedValue :
$theNotDefinedValue;
  break;
  }
  return $theValue;
}

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= ? . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS[MM_update]))  ($HTTP_POST_VARS[MM_update]
== form1)) {
  $updateSQL = sprintf(UPDATE oncall SET sa=%s, ptime=%s, rtime=%s,
sbcuid=%s, name=%s, problem=%s, resolution=%s, pass=%s, ctime=%s,
duration=%s, ttrp=%s, feedback=%s, P1=%s WHERE callid=%s,
   GetSQLValueString($HTTP_POST_VARS['sa'], text),
   GetSQLValueString($HTTP_POST_VARS['ptime'], date),
   GetSQLValueString($HTTP_POST_VARS['rtime'], date),
   GetSQLValueString($HTTP_POST_VARS['sbcuid'], text),
   GetSQLValueString($HTTP_POST_VARS['name'], text),
   GetSQLValueString($HTTP_POST_VARS['problem'],
text),
   GetSQLValueString($HTTP_POST_VARS['resolution'],
text),
   GetSQLValueString($HTTP_POST_VARS['pass'], text),
   GetSQLValueString($HTTP_POST_VARS['ctime'], date),
   GetSQLValueString($HTTP_POST_VARS['duration'],
date),
   GetSQLValueString($HTTP_POST_VARS['ttrp'], date),
   GetSQLValueString($HTTP_POST_VARS['feedback'],
text),
   GetSQLValueString($HTTP_POST_VARS['P1'], text),
   GetSQLValueString($HTTP_POST_VARS['callid'], int));

  mysql_select_db($database_Test, $Test);
  $Result1 = mysql_query($updateSQL, $Test) or die(mysql_error());
}

$tmp = $_GET['callid'];
mysql_select_db($database_Test, $Test);
$query_Update = SELECT * FROM oncall WHERE callid='$tmp';
$Update = mysql_query($query_Update, $Test) or die(mysql_error());
$row_Update = mysql_fetch_assoc($Update);
$totalRows_Update = mysql_num_rows($Update);
?
html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body
form method=post name=form1 action=?php echo $editFormAction; ?
  input type=hidden name=callid value=?php echo
$row_Update['callid']; ?
  input type=hidden name=feedback value=?php echo
$row_Update['feedback']; ?
  table width=666 align=center
!--DWLayoutTable--
tr valign=baseline 
  td width=122 height=24 align=right nowrapSA name:/td
  td colspan=2input type=text name=sa value=?php echo
$row_Update['sa']; ? size=32/td
  td width=39nbsp;/td
  td width=124 align=right valign=top nowrapCall passed to:/td
  td colspan=2 valign=topinput type=text name=pass
value=?php echo $row_Update['pass']; ? size=32/td
/tr
tr valign=baseline 
  td height=24 align=right nowrapTime of page:/td
  td colspan=2input type=text name=ptime value=?php echo
$row_Update['ptime']; ? size=32/td
  td/td
  td/td
  td width=11/td
  td width=177/td
/tr
tr valign=baseline 
  td height=24 align=right nowrapTime page returned:/td
  td colspan=2input type=text name=rtime value=?php echo
$row_Update['rtime']; ? size=32/td
  tdnbsp;/td
  td align=right valign=top nowrapCall completion time:/td
  td colspan=2 valign=topinput type=text name=ctime
value=?php echo 

[PHP-DB] Time difference question...

2002-06-25 Thread NIPP, SCOTT V (SBCSI)

I am working on a Call Log application, and need to calculate time.
For example, if a page is received at 12:00, the page is returned at 12:10,
and the call is resolved at 14:30...  I need to be able to calculate the
time to return the page, and also the time to resolve the call.  I am not
sure if PHP provides a function to handle date/time math.  I know that MySQL
can add and subtract a fixed interval to a date/time, but I am not sure if
it can deal with math involving a pair of date/time values.  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




<    1   2