[PHP-DB] Re: posting information from a textarea

2006-07-06 Thread Dave W

O, I also tried to change it to a $_FILES array, but that didn't work
either.
On 7/6/06, Dave W [EMAIL PROTECTED] wrote:


I seem to be having a problem posting text from a text area. I have a form
that posts data into a database and there are input fields which seem to
post the data fine. I know this because the entry is changing in the
database, but the text area text doesn't seem to be posting. I double
checked to make sure i got the names right, but it still doesn't seem to be
working. Before I put it into the database I'm using stripslashes. I thought
that might of been the problem and I changed it to trim, but that didn't
work. In the database, the field that I'm putting it into is a longtext type
with fulltext.

--
Dave W



[PHP-DB] posting information from a textarea

2006-07-06 Thread Dave W

I seem to be having a problem posting text from a text area. I have a form
that posts data into a database and there are input fields which seem to
post the data fine. I know this because the entry is changing in the
database, but the text area text doesn't seem to be posting. I double
checked to make sure i got the names right, but it still doesn't seem to be
working. Before I put it into the database I'm using stripslashes. I thought
that might of been the problem and I changed it to trim, but that didn't
work. In the database, the field that I'm putting it into is a longtext type
with fulltext.

--
Dave W


Re: [PHP-DB] posting information from a textarea

2006-07-06 Thread Brad Bonkoski

stripslashes should not be needed...

if anything addslashes() may be needed if you have single quotes in the 
text area.
I would say step 1 is to echo out your insert query to the page before 
you even excute the insert, to verify the query, and that you are 
getting the proper information from the form.

-B

Dave W wrote:

I seem to be having a problem posting text from a text area. I have a 
form

that posts data into a database and there are input fields which seem to
post the data fine. I know this because the entry is changing in the
database, but the text area text doesn't seem to be posting. I double
checked to make sure i got the names right, but it still doesn't seem 
to be
working. Before I put it into the database I'm using stripslashes. I 
thought

that might of been the problem and I changed it to trim, but that didn't
work. In the database, the field that I'm putting it into is a 
longtext type

with fulltext.



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



Re: [PHP-DB] posting information from a textarea

2006-07-06 Thread Dave W

The inputs are posting, but the textarea still isn't. Argh!

On 7/6/06, Brad Bonkoski [EMAIL PROTECTED] wrote:


stripslashes should not be needed...

if anything addslashes() may be needed if you have single quotes in the
text area.
I would say step 1 is to echo out your insert query to the page before
you even excute the insert, to verify the query, and that you are
getting the proper information from the form.
-B

Dave W wrote:

 I seem to be having a problem posting text from a text area. I have a
 form
 that posts data into a database and there are input fields which seem to

 post the data fine. I know this because the entry is changing in the
 database, but the text area text doesn't seem to be posting. I double
 checked to make sure i got the names right, but it still doesn't seem
 to be
 working. Before I put it into the database I'm using stripslashes. I
 thought
 that might of been the problem and I changed it to trim, but that didn't
 work. In the database, the field that I'm putting it into is a
 longtext type
 with fulltext.






--
Dave W


Re: [PHP-DB] Re: posting information from a textarea

2006-07-06 Thread Chris

Dave W wrote:

I saw this bug: http://bugs.php.net/bug.php?id=22427. Could this be related
to problem I'm having?


Simplify your example and test it, only way to know.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Re: posting information from a textarea

2006-07-06 Thread Chris

Dave W wrote:

I saw this bug: http://bugs.php.net/bug.php?id=22427. Could this be related
to problem I'm having?



Actually, show us the form you're trying to submit before doing anything 
else. Since we haven't seen any html or php code, guessing it's a bug is 
a bit of a stretch.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP-DB] Taking care of an auto_increment field!

2006-07-06 Thread Miguel Guirao


Hi pals,

I have a module in my PHP application that creates and id (string + the 
auto_increment field). I read the last auto_increment value from the table, 
then in my code I use it as the base to create a second id (the auto_increment 
field + string).

This happens for as many hardware the user has selected to send for repairment 
but, What if another user also is sending hardware for repairment? His process 
will also read the same auto_increment value from the table, will use it to 
create the second id field in my code, so, probably I will have ids like:

Last auto_increment value = 1

User A
VSA002
VSA003

User B
TUX002
TUX003

I have a constraint: The ID part (from string + the auto_increment field) 
should be continuos! I can not have two IDs with the same auto_increment value 
in it!!

Is there a way to use transactios in MySQL??
Or maybe using a global variable accesed by all the processes running in the 
server?
Or actually creating the auto_increment fields by inserting as many rows 
needed, but what if the user cancels the operatuion?
Or another different approach to solve this problem?

Regards,
Miguel Guirao


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

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



Re: [PHP-DB] Taking care of an auto_increment field!

2006-07-06 Thread Chris



Is there a way to use transactios in MySQL??


Of course. They only work properly with innodb tables though. This is 
all in the mysql documentation (http://dev.mysql.com)



Or maybe using a global variable accesed by all the processes running in the 
server?


You could create a global 'sequence' table and use that to get the id's.

create table my_sequence(id int auto_increment);

when you need a new number,

$query = update my_sequence set id=last_insert_id(id+1);
$result = mysql_query($query);
$new_id = mysql_insert_id();


Or actually creating the auto_increment fields by inserting as many rows 
needed, but what if the user cancels the operatuion?


What difference does that make? You'll have id's in the sequence but not 
used anywhere. No big deal.



PS: Can you get rid of all that other crap when you send to a mailing 
list? Sign up for a gmail or hotmail account or something (if you need 
an invite let me know).


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Re: posting information from a textarea

2006-07-06 Thread Dave W

I'll show you all the steps it passes through.
Here's the form:

form action=proc.php method=post
   fieldset
   label for=MottoMotto:/label
   input class=text type=text size=25 name=motto
value=?php if($form-value(motto) == ){
  echo $session-nationinfo['motto'];
}else{
  echo $form-value(motto);
} ? /
   label for=descNation Description:/label
   textarea name=desc cols=50 rows=5?php
if($form-value(desc) == ){
  echo $session-nationinfo['desc'];
}else{
  echo $form-value(desc);
}
?/textarea
input type=submit value= Edit Nation  /
/fieldset
/form

It's echoing the nationinfo right, but its not posting it. The motto also
works too. When it's submitted, it goes through the function
procEditNation().

$session-editNation($_POST['motto'], $_POST['desc']);

The editNation function:

  function editNation($motto, $desc){
 global $database, $form;

 if($motto){
$field = motto;
$motto = htmlspecialchars($motto);
$database-updateNationField($this-username,motto,$motto);

}

 if($desc){
$field = desc;
$desc = htmlspecialchars($desc);
$database-updateNationField($this-username,desc,$desc);


 }

 return true;
  }

Then finally the updateNationField function:

  function updateNationField($username, $field, $value){
 $q = UPDATE nations SET .$field. = '$value' WHERE username =
'$username';
 return mysql_query($q, $this-connection);
  }

I just don't know what's wrong since it's posting the motto (which is just a
text-type input) and not the description (which is a textarea). I echo'd out
the mysql queries and excuted them myself from what echo'd out and it's
selecting the desc column just fine.



On 7/6/06, Chris [EMAIL PROTECTED] wrote:


Dave W wrote:
 I saw this bug: http://bugs.php.net/bug.php?id=22427. Could this be
related
 to problem I'm having?


Actually, show us the form you're trying to submit before doing anything
else. Since we haven't seen any html or php code, guessing it's a bug is
a bit of a stretch.

--
Postgresql  php tutorials
http://www.designmagick.com/

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





--
Dave W


Re: [PHP-DB] Re: posting information from a textarea

2006-07-06 Thread Chris

Dave W wrote:

I'll show you all the steps it passes through.
Here's the form:

 form action=proc.php method=post
fieldset
label for=MottoMotto:/label
input class=text type=text size=25 name=motto 
value=?php if($form-value(motto) == ){

   echo $session-nationinfo['motto'];
}else{
   echo $form-value(motto);
} ? /
label for=descNation Description:/label
textarea name=desc cols=50 rows=5?php
if($form-value(desc) == ){
   echo $session-nationinfo['desc'];
}else{
   echo $form-value(desc);
}
?/textarea
input type=submit value= Edit Nation  /
 /fieldset
/form

It's echoing the nationinfo right, but its not posting it. The motto 
also works too. When it's submitted, it goes through the function 
procEditNation().


$session-editNation($_POST['motto'], $_POST['desc']);

The editNation function:

   function editNation($motto, $desc){
  global $database, $form;
 
  if($motto){

 $field = motto;
 $motto = htmlspecialchars($motto);
 $database-updateNationField($this-username,motto,$motto);

 }
 
  if($desc){

 $field = desc;
 $desc = htmlspecialchars($desc);
 $database-updateNationField($this-username,desc,$desc);

 
  }
 
  return true;

   }

Then finally the updateNationField function:

   function updateNationField($username, $field, $value){
  $q = UPDATE nations SET .$field. = '$value' WHERE username = 
'$username';

  return mysql_query($q, $this-connection);
   }

I just don't know what's wrong since it's posting the motto (which is 
just a text-type input) and not the description (which is a textarea). I 
echo'd out the mysql queries and excuted them myself from what echo'd 
out and it's selecting the desc column just fine.


That definitely all looks fine.

If you do:

echo 'post vars: ' . print_r($_POST, true) . 'br/';

does it show up in post at all?

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP-DB] Re: posting information from a textarea

2006-07-06 Thread Dave W

hmm..interesting. Neither the motto or desc is showing up in the array. I
made a simple form and the
echo 'post vars: ' . print_r($_POST, true) . 'br/';

works fine. I'm just perplexed on why the motto is still working and not the
desc. Maybe it's because I'm using a fieldset, but then why wouldn't just
one not work?

On 7/6/06, Chris [EMAIL PROTECTED] wrote:


Dave W wrote:
 I'll show you all the steps it passes through.
 Here's the form:

  form action=proc.php method=post
 fieldset
 label for=MottoMotto:/label
 input class=text type=text size=25 name=motto
 value=?php if($form-value(motto) == ){
echo $session-nationinfo['motto'];
 }else{
echo $form-value(motto);
 } ? /
 label for=descNation Description:/label
 textarea name=desc cols=50 rows=5?php
 if($form-value(desc) == ){
echo $session-nationinfo['desc'];
 }else{
echo $form-value(desc);
 }
 ?/textarea
 input type=submit value= Edit Nation  /
  /fieldset
 /form

 It's echoing the nationinfo right, but its not posting it. The motto
 also works too. When it's submitted, it goes through the function
 procEditNation().

 $session-editNation($_POST['motto'], $_POST['desc']);

 The editNation function:

function editNation($motto, $desc){
   global $database, $form;

   if($motto){
  $field = motto;
  $motto = htmlspecialchars($motto);
  $database-updateNationField($this-username,motto,$motto);

  }

   if($desc){
  $field = desc;
  $desc = htmlspecialchars($desc);
  $database-updateNationField($this-username,desc,$desc);


   }

   return true;
}

 Then finally the updateNationField function:

function updateNationField($username, $field, $value){
   $q = UPDATE nations SET .$field. = '$value' WHERE username =
 '$username';
   return mysql_query($q, $this-connection);
}

 I just don't know what's wrong since it's posting the motto (which is
 just a text-type input) and not the description (which is a textarea). I
 echo'd out the mysql queries and excuted them myself from what echo'd
 out and it's selecting the desc column just fine.

That definitely all looks fine.

If you do:

echo 'post vars: ' . print_r($_POST, true) . 'br/';

does it show up in post at all?

--
Postgresql  php tutorials
http://www.designmagick.com/





--
Dave W


Re: [PHP-DB] Re: posting information from a textarea

2006-07-06 Thread Dave W

I think I might have found the problem, but I'm not sure how to fix it. I'm
just going to rebuild the form and it make it seperate (with all the
database calls in one page). For some reason, if I add another field before
the motto and i change it, it changes motto too...w/e I'll just make a new
one.

On 7/6/06, Dave W [EMAIL PROTECTED] wrote:


hmm..interesting. Neither the motto or desc is showing up in the array. I
made a simple form and the

echo 'post vars: ' . print_r($_POST, true) . 'br/';

works fine. I'm just perplexed on why the motto is still working and not
the desc. Maybe it's because I'm using a fieldset, but then why wouldn't
just one not work?

On 7/6/06, Chris [EMAIL PROTECTED] wrote:

 Dave W wrote:
  I'll show you all the steps it passes through.
  Here's the form:
 
   form action=proc.php method=post
  fieldset
  label for=MottoMotto:/label
  input class=text type=text size=25 name=motto
  value=?php if($form-value(motto) == ){
 echo $session-nationinfo['motto'];
  }else{
 echo $form-value(motto);
  } ? /
  label for=descNation Description:/label
  textarea name=desc cols=50 rows=5?php
  if($form-value(desc) == ){
 echo $session-nationinfo['desc'];
  }else{
 echo $form-value(desc);
  }
  ?/textarea
  input type=submit value= Edit Nation  /
   /fieldset
  /form
 
  It's echoing the nationinfo right, but its not posting it. The motto
  also works too. When it's submitted, it goes through the function
  procEditNation().
 
  $session-editNation($_POST['motto'], $_POST['desc']);
 
  The editNation function:
 
 function editNation($motto, $desc){
global $database, $form;
 
if($motto){
   $field = motto;
   $motto = htmlspecialchars($motto);
   $database-updateNationField($this-username,motto,$motto);

 
   }
 
if($desc){
   $field = desc;
   $desc = htmlspecialchars($desc);
   $database-updateNationField($this-username,desc,$desc);
 
 
}
 
return true;
 }
 
  Then finally the updateNationField function:
 
 function updateNationField($username, $field, $value){
$q = UPDATE nations SET .$field. = '$value' WHERE username =
  '$username';
return mysql_query($q, $this-connection);
 }
 
  I just don't know what's wrong since it's posting the motto (which is
  just a text-type input) and not the description (which is a textarea).
 I
  echo'd out the mysql queries and excuted them myself from what echo'd
  out and it's selecting the desc column just fine.

 That definitely all looks fine.

 If you do:

 echo 'post vars: ' . print_r($_POST, true) . 'br/';

 does it show up in post at all?

 --
 Postgresql  php tutorials
 http://www.designmagick.com/




--
Dave W





--
Dave W


[PHP-DB] Populating an array to the next script!

2006-07-06 Thread Miguel Guirao


Hello,

Is there a way to populate an array from one script to the next one?
I'm using a form, and a hidden field for such desire:

input name=hwt[] type=hidden value=?php echo($hwGSM);?

but it returns this:

input name=hwt[] type=hidden value=Array

then I pretend to read the array again at the target script by coding the 
following:

$hw=$_POST['hwt'];
$hwGSM=$hw[0];
for($i=0;$i=$maxpoint;$i++){
echo($hwGSM[$i]);
}

It should be pretty easy but I have not done it ever!

Regards,
Miguel Guirao

P.S. I can not get rid of of the below crap!! I know is annoying, but it's a 
policy!


Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta 
dirigido; contiene informacion estrictamente confidencial y legalmente 
protegida, cuya divulgacion es sancionada por la ley. Si el lector de este 
mensaje no es a quien esta dirigido, ni se trata del empleado o agente 
responsable de esta informacion, se le notifica por medio del presente, que su 
reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio 
este comunicado por error, favor de notificarlo inmediatamente al remitente y 
destruir el mensaje. Todas las opiniones contenidas en este mail son propias 
del autor del mensaje y no necesariamente coinciden con las de Radiomovil 
Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, 
afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos.

This message is for the sole use of the person or entity to whom it is being 
sent.  Therefore, it contains strictly confidential and legally protected 
material whose disclosure is subject to penalty by law.  If the person reading 
this message is not the one to whom it is being sent and/or is not an employee 
or the responsible agent for this information, this person is herein notified 
that any unauthorized dissemination, distribution or copying of the materials 
included in this facsimile is strictly prohibited.  If you received this 
document by mistake please notify  immediately to the subscriber and destroy 
the message. Any opinions contained in this e-mail are those of the author of 
the message and do not necessarily coincide with those of Radiomovil Dipsa, 
S.A. de C.V. or any of its control, controlled, affiliates and subsidiaries 
companies. No part of this message or attachments may be used or reproduced in 
any manner whatsoever.

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