Re: [PHP-DB] form not working...

2003-11-10 Thread jas
Yeah, sorry that code wasn't updated... after the $_session['table'] is
called the  doesn't attempt to post the data form the
$_session['table'] if that makes sense... all the error checking isn't the
problem
jas

"Jeffrey N Dyke" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> i'd be curious what your actual problem is?
>
> here's a question though.,...would these ever work?.
> <<<<>>>>>>
> if ((!isset($_POST['edit'])) or ($_POST = "")) {
>  $_SESSION['table'] = "t_items";
>  call_user_func("db_retrieve");
> } elseif ((isset($_POST['edit'])) or (!$_POST = "")) {
> <<<<<>>>>>>
>
> You're basically setting a superglobal array equal to an empty string ->
>  "".  this should at least be $_POST == ""...but
> instead, i'd use
> if ((!isset($_POST['edit'])) or (empty($_POST)) {
> <--and -->
> } elseif ((isset($_POST['edit'])) or (!empty($_POST))) {
>
> hth
> jeff
>
>
>
>
>   "jas"
>   <[EMAIL PROTECTED]To:
[EMAIL PROTECTED]
>   .com>cc:
>Subject:  [PHP-DB] form not
working...
>   11/10/2003 12:38
>   PM
>
>
>
>
>
>
> For some reason my form to edit selected items is not working, I think I
> need a new set of eyes.
> Any help is appreciated...
> Jas
>
> // inc.php
> function db_retrieve() {
>  require 'dbase.inc.php';
>  $tble = $_SESSION['table'];
>  $show = @mysql_query("SELECT * FROM $tble LIMIT 0, 15",$db)or
> die(mysql_error());
>while ($row = @mysql_fetch_array($show)) {
> @list($nItemSKU, $bActive, $nUserID, $nItemConfig, $tItemType,
> $tDepartment, $blSerialNumber, $nPropertyNumber, $blHostName, $nIPID,
> $tRoomNumber, $tNotes) = $row;
>  $_SESSION['table'] .= " align=left>$nItemSKU
>  $bActive
>  $nUserID
>  $nItemConfig
>  $tItemType
>  $tDepartment
>  $blSerialNumber
>  $nPropertyNumber
>  $blHostName
>  $nIPID
>  $tRoomNumber
>  $tNotes
>   value=$blSerialNumber>
> "; }
>  $_SESSION['number'] = mysql_num_rows($show); }
>
>  session_start();
> require 'scripts/inc.php';
> if ((!isset($_POST['edit'])) or ($_POST = "")) {
>  $_SESSION['table'] = "t_items";
>  call_user_func("db_retrieve");
> } elseif ((isset($_POST['edit'])) or (!$_POST = "")) {
>  require 'scripts/dbase.inc.php';
>   $tble = $_SESSION['table'];
>   $edt = mysql_query("SELECT * FROM $tble WHERE
> blSerialNumber=\"$edit\"",$db)or die(mysql_error());
>while ($row = mysql_fetch_array($edt)) {
> list($nItemSKU, $bActive, $nUserID, $nItemConfig, $tItemType,
> $tDepartment, $blSerialNumber, $nPropertyNumber, $blHostName, $nIPID,
> $tRoomNumber, $tNotes) = $row;
> $_SESSION['table'] .= "
> value=$nItemSKU>
> value=$bActive>$bActive
> value=$nUserID>$nUserID
> size=30 value=$nItemConfig>$nItemConfig
>size=30
> value=$tItemType>$tItemType
> size=30 value=$tDepartment>$tDepartment
> size=30 value=$blSerialNumber>$blSerialNumber
> size=30 value=$nPropertyNumber>$nPropertyNumber
> size=30 value=$blHostName>$blHostName
> value=$nIPID>$nIPID
> size=30 value=$tRoomNumber>$tRoomNumber
> value=$tNotes>$tNotes
>value=Save
> class=frmBTNS>
>   "; }
> }
> ?>
> 
> 
>  class="frmBTNS">
> 
>
> --
> 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] form not working...

2003-11-10 Thread jeffrey_n_Dyke

i'd be curious what your actual problem is?

here's a question though.,...would these ever work?.
<<<<>>>>>>
if ((!isset($_POST['edit'])) or ($_POST = "")) {
 $_SESSION['table'] = "t_items";
 call_user_func("db_retrieve");
} elseif ((isset($_POST['edit'])) or (!$_POST = "")) {
<<<<<>>>>>>

You're basically setting a superglobal array equal to an empty string ->
 "".  this should at least be $_POST == ""...but
instead, i'd use
if ((!isset($_POST['edit'])) or (empty($_POST)) {
<--and -->
} elseif ((isset($_POST['edit'])) or (!empty($_POST))) {

hth
jeff



   
 
  "jas"
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
               
  .com>cc: 
 
   Subject:  [PHP-DB] form not working...  
 
  11/10/2003 12:38 
 
  PM   
 
   
 
   
 




For some reason my form to edit selected items is not working, I think I
need a new set of eyes.
Any help is appreciated...
Jas

// inc.php
function db_retrieve() {
 require 'dbase.inc.php';
 $tble = $_SESSION['table'];
 $show = @mysql_query("SELECT * FROM $tble LIMIT 0, 15",$db)or
die(mysql_error());
   while ($row = @mysql_fetch_array($show)) {
@list($nItemSKU, $bActive, $nUserID, $nItemConfig, $tItemType,
$tDepartment, $blSerialNumber, $nPropertyNumber, $blHostName, $nIPID,
$tRoomNumber, $tNotes) = $row;
 $_SESSION['table'] .= "$nItemSKU
 $bActive
 $nUserID
 $nItemConfig
 $tItemType
 $tDepartment
 $blSerialNumber
 $nPropertyNumber
 $blHostName
 $nIPID
 $tRoomNumber
 $tNotes
 
"; }
 $_SESSION['number'] = mysql_num_rows($show); }


   
   $bActive
   $nUserID
   $nItemConfig
   $tItemType
   $tDepartment
   $blSerialNumber
   $nPropertyNumber
   $blHostName
   $nIPID
   $tRoomNumber
   $tNotes
   
  "; }
}
?>





--
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] form not working...

2003-11-10 Thread Gary Every
Don't you need to start your form BEFORE your 's

-Original Message-
From: jas [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 11:38 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] form not working...


For some reason my form to edit selected items is not working, I think I
need a new set of eyes.
Any help is appreciated...
Jas

// inc.php
function db_retrieve() {
 require 'dbase.inc.php';
 $tble = $_SESSION['table'];
 $show = @mysql_query("SELECT * FROM $tble LIMIT 0, 15",$db)or
die(mysql_error());
   while ($row = @mysql_fetch_array($show)) {
@list($nItemSKU, $bActive, $nUserID, $nItemConfig, $tItemType,
$tDepartment, $blSerialNumber, $nPropertyNumber, $blHostName, $nIPID,
$tRoomNumber, $tNotes) = $row;
 $_SESSION['table'] .= "$nItemSKU
 $bActive
 $nUserID
 $nItemConfig
 $tItemType
 $tDepartment
 $blSerialNumber
 $nPropertyNumber
 $blHostName
 $nIPID
 $tRoomNumber
 $tNotes
 
"; }
 $_SESSION['number'] = mysql_num_rows($show); }


   
   $bActive
   $nUserID
   $nItemConfig
   $tItemType
   $tDepartment
   $blSerialNumber
   $nPropertyNumber
   $blHostName
   $nIPID
   $tRoomNumber
   $tNotes
   
  "; }
}
?>





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

2003-11-10 Thread jas
For some reason my form to edit selected items is not working, I think I
need a new set of eyes.
Any help is appreciated...
Jas

// inc.php
function db_retrieve() {
 require 'dbase.inc.php';
 $tble = $_SESSION['table'];
 $show = @mysql_query("SELECT * FROM $tble LIMIT 0, 15",$db)or
die(mysql_error());
   while ($row = @mysql_fetch_array($show)) {
@list($nItemSKU, $bActive, $nUserID, $nItemConfig, $tItemType,
$tDepartment, $blSerialNumber, $nPropertyNumber, $blHostName, $nIPID,
$tRoomNumber, $tNotes) = $row;
 $_SESSION['table'] .= "$nItemSKU
 $bActive
 $nUserID
 $nItemConfig
 $tItemType
 $tDepartment
 $blSerialNumber
 $nPropertyNumber
 $blHostName
 $nIPID
 $tRoomNumber
 $tNotes
 
"; }
 $_SESSION['number'] = mysql_num_rows($show); }


   
   $bActive
   $nUserID
   $nItemConfig
   $tItemType
   $tDepartment
   $blSerialNumber
   $nPropertyNumber
   $blHostName
   $nIPID
   $tRoomNumber
   $tNotes
   
  "; }
}
?>





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



Re: [PHP-DB] Form not working...

2002-06-26 Thread Pierre-Alain Joye

On Wed, 26 Jun 2002 19:11:46 +1000
Adam Royle <[EMAIL PROTECTED]> wrote:

> What you said (Mike) is mostly correct, although the GetSQLValueString() 
> function in Scott's code automatically puts the quotes around the values 
> if the datatype definition of "text" is passed to the function.
> 
> Adam
the link to the forum :
http://sourceforge.net/forum/forum.php?forum_id=113095

voila :)

pa

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




Re: [PHP-DB] Form not working...

2002-06-26 Thread Adam Royle

What you said (Mike) is mostly correct, although the GetSQLValueString() 
function in Scott's code automatically puts the quotes around the values 
if the datatype definition of "text" is passed to the function.

Adam


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




Re: [PHP-DB] Form not working...

2002-06-25 Thread szii

okay, couple of questions in this one... =)

First...
 is shorthand for  if you care.

With a  there is no "value" attribute.
  
   
Your "UPDATE" call via sprintf() is okay for the parameter passing,
but you're missing single quotes around the text values.

UPDATE test SET (number = 1, name = 'the Name', Desc = 'the Desc');

When dealing with PHP and DBs, the single best thing you can do is 
var_dump($your_query) and then cut-n-paste into the command line 
utility.  It is, hands down, the single easiest (and fastest) way to figure out
why your query doesn't work.

'Luck!

-Mike



- Original Message - 
From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 25, 2002 11:03 AM
Subject: [PHP-DB] Form not working...


> 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.
> 
> 
>  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']

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





Untitled Document





  
  
  

 
  SA name:
  
   
  Call passed to:
  

 
  Time of page:
  
  
  
  
  

 
  Time page returned:
  
   
  Call completion time:
  

 
  SBCUID of client:
  
   
   
   
   

 
  Name of client:
  
   
  P1 Vantive ID:
  

 
  Problem description:
  

  
   

 
   
  Limit of 255 characters.

 
   
   

 
  Resolution:
  
  

 
   
  Limit of 255 characters.

 
   
   

 
   
   
  
   
   
   
  
  

  
  

 
  
 
  




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