[PHP] Problem updating

2003-03-06 Thread Steve Jackson
Been on this a couple of hours... anyone see what I'm doing wrong?
I get a result of 1 when I echo $result but it doesn't want to update at
all.
The action of this form index.php?action=update-account is just a switch
case 
Which asks you to use the function update_subscriber_account() below...

form method='post' action='index.php?action=update-account'
   input type='hidden' name='old_id' value='$email'
   tr
 th colspan = 2 bgcolor = '#5B69A6'
$title 
 /th
   /tr
   tr
 tdReal Name:/td
 tdinput type = text name='new_realname' maxlength = 100 
  value ='$realname'/td
   /tr
   tr
 tdPreferred Name:/td
 tdinput type = text name='new_nickname' maxlength = 100 
  value ='$nickname'/td
   /tr
   tr
 tdCompany:/td
 tdinput type = text name='new_company' maxlength = 100 
  value ='$company'/td
   /tr
   tr
 tdEmail Address:/td
 tdinput type = text name='new_email' maxlength = 100 
  value ='$email'/td
   /tr
   tr
 tdRequested Email Format:/td;
 echo tdselect name='new_mimetype'option; 
   if ($mimetype == 'T') 
  echo  selected;
   echo Text Onlyoption;
   if ($mimetype == 'H') 
  echo  selected;
   echo HTML/select/td;
print /tr
tr
td colspan=2 align=center;
display_form_button('save-changes');
print /td/tr/form/table/centerbr;
}
}

function update_subscriber_account()
{

db_connect();
$query = update subscribers 
set email = '$new_email',
nickname = '$new_nickname',
fullname = '$new_realname',
company = '$new_company',
mimetype = '$new_mimetype'
where email = '$old_id';
$result = mysql_query($query)or die(Error: Could not update
queryBR$queryBR.mysql_error());
if (!$result)
{
echo An error occurred when trying to update the DB;
}
else
{
echo $result  Successfully updated the details;
}
}


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



Re: [PHP] Problem updating

2003-03-06 Thread Rick Emery
Is this HTML in a print or echo statement?  If not, then the variables will not 
display.  You can
View Source to verify this.
- Original Message -
From: Steve Jackson [EMAIL PROTECTED]
To: PHP General [EMAIL PROTECTED]
Sent: Thursday, March 06, 2003 8:27 AM
Subject: [PHP] Problem updating


Been on this a couple of hours... anyone see what I'm doing wrong?
I get a result of 1 when I echo $result but it doesn't want to update at
all.
The action of this form index.php?action=update-account is just a switch
case
Which asks you to use the function update_subscriber_account() below...

form method='post' action='index.php?action=update-account'
   input type='hidden' name='old_id' value='$email'
   tr
 th colspan = 2 bgcolor = '#5B69A6'
$title
 /th
   /tr
   tr
 tdReal Name:/td
 tdinput type = text name='new_realname' maxlength = 100
  value ='$realname'/td
   /tr
   tr
 tdPreferred Name:/td
 tdinput type = text name='new_nickname' maxlength = 100
  value ='$nickname'/td
   /tr
   tr
 tdCompany:/td
 tdinput type = text name='new_company' maxlength = 100
  value ='$company'/td
   /tr
   tr
 tdEmail Address:/td
 tdinput type = text name='new_email' maxlength = 100
  value ='$email'/td
   /tr
   tr
 tdRequested Email Format:/td;
 echo tdselect name='new_mimetype'option;
   if ($mimetype == 'T')
  echo  selected;
   echo Text Onlyoption;
   if ($mimetype == 'H')
  echo  selected;
   echo HTML/select/td;
print /tr
tr
   td colspan=2 align=center;
display_form_button('save-changes');
print /td/tr/form/table/centerbr;
}
}

function update_subscriber_account()
{

db_connect();
$query = update subscribers
set email = '$new_email',
nickname = '$new_nickname',
fullname = '$new_realname',
company = '$new_company',
mimetype = '$new_mimetype'
where email = '$old_id';
$result = mysql_query($query)or die(Error: Could not update
queryBR$queryBR.mysql_error());
if (!$result)
{
echo An error occurred when trying to update the DB;
}
else
{
echo $result  Successfully updated the details;
}
}


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




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



Re: [PHP] Problem updating

2003-03-06 Thread Tom Rogers
Hi,

Friday, March 7, 2003, 12:27:27 AM, you wrote:
SJ Been on this a couple of hours... anyone see what I'm doing wrong?
SJ I get a result of 1 when I echo $result but it doesn't want to update at
SJ all.
SJ The action of this form index.php?action=update-account is just a switch
SJ case 
SJ Which asks you to use the function update_subscriber_account() below...

SJ form method='post' action='index.php?action=update-account'
SJinput type='hidden' name='old_id' value='$email'
SJtr
SJ  th colspan = 2 bgcolor = '#5B69A6'
SJ $title 
SJ  /th
SJ/tr
SJtr
SJ  tdReal Name:/td
SJ  tdinput type = text name='new_realname' maxlength = 100 
SJ   value ='$realname'/td
SJ/tr
SJtr
SJ  tdPreferred Name:/td
SJ  tdinput type = text name='new_nickname' maxlength = 100 
SJ   value ='$nickname'/td
SJ/tr
SJtr
SJ  tdCompany:/td
SJ  tdinput type = text name='new_company' maxlength = 100 
SJ   value ='$company'/td
SJ/tr
SJtr
SJ  tdEmail Address:/td
SJ  tdinput type = text name='new_email' maxlength = 100 
SJ   value ='$email'/td
SJ/tr
SJtr
SJ  tdRequested Email Format:/td;
SJ  echo tdselect name='new_mimetype'option; 
SJif ($mimetype == 'T') 
SJ   echo  selected;
SJecho Text Onlyoption;
SJif ($mimetype == 'H') 
SJ   echo  selected;
SJecho HTML/select/td;
SJ print /tr
SJ tr
SJ td colspan=2 align=center;
SJ display_form_button('save-changes');
SJ print /td/tr/form/table/centerbr;
SJ }
SJ }

SJ function update_subscriber_account()
SJ {

SJ db_connect();
SJ $query = update subscribers 
SJ set email = '$new_email',
SJ nickname = '$new_nickname',
SJ fullname = '$new_realname',
SJ company = '$new_company',
SJ mimetype = '$new_mimetype'
SJ where email = '$old_id';
SJ $result = mysql_query($query)or die(Error: Could not update
SJ queryBR$queryBR.mysql_error());
SJ if (!$result)
SJ {
SJ echo An error occurred when trying to update the DB;
SJ }
SJ else
SJ {
SJ echo $result  Successfully updated the details;
SJ }
SJ }

You will need to use the global vars and also escape quotes like this:

function update_subscriber_account()
{
 $new_email = addslashes($_POST['new_email']);
 .
 .
 .
$query = update subscribers

set email = '$new_email',
.
.

-- 
regards,
Tom


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



RE: [PHP] Problem updating

2003-03-06 Thread Steve Jackson
Actually it didn't need the globals,
But I did need to pass the variables into the function!
Update_subscriber_account($var1, $var2 etc)
I feel a right plonker now!

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159





 -Original Message-
 From: Tom Rogers [mailto:[EMAIL PROTECTED] 
 Sent: 6. maaliskuuta 2003 16:28
 To: Steve Jackson
 Cc: PHP General
 Subject: Re: [PHP] Problem updating
 
 
 Hi,
 
 Friday, March 7, 2003, 12:27:27 AM, you wrote:
 SJ Been on this a couple of hours... anyone see what I'm 
 doing wrong? I 
 SJ get a result of 1 when I echo $result but it doesn't want 
 to update 
 SJ at all. The action of this form 
 index.php?action=update-account is 
 SJ just a switch case
 SJ Which asks you to use the function 
 update_subscriber_account() below...
 
 SJ form method='post' action='index.php?action=update-account'
 SJinput type='hidden' name='old_id' value='$email'
 SJtr
 SJ  th colspan = 2 bgcolor = '#5B69A6'
 SJ $title 
 SJ  /th
 SJ/tr
 SJtr
 SJ  tdReal Name:/td
 SJ  tdinput type = text name='new_realname' maxlength = 100 
 SJ   value ='$realname'/td
 SJ/tr
 SJtr
 SJ  tdPreferred Name:/td
 SJ  tdinput type = text name='new_nickname' maxlength = 100 
 SJ   value ='$nickname'/td
 SJ/tr
 SJtr
 SJ  tdCompany:/td
 SJ  tdinput type = text name='new_company' maxlength = 100 
 SJ   value ='$company'/td
 SJ/tr
 SJtr
 SJ  tdEmail Address:/td
 SJ  tdinput type = text name='new_email' maxlength = 100 
 SJ   value ='$email'/td
 SJ/tr
 SJtr
 SJ  tdRequested Email Format:/td;
 SJ  echo tdselect name='new_mimetype'option; 
 SJif ($mimetype == 'T') 
 SJ   echo  selected;
 SJecho Text Onlyoption;
 SJif ($mimetype == 'H') 
 SJ   echo  selected;
 SJecho HTML/select/td;
 SJ print /tr
 SJ tr
 SJ td colspan=2 align=center;
 SJ display_form_button('save-changes');
 SJ print /td/tr/form/table/centerbr;
 SJ }
 SJ }
 
 SJ function update_subscriber_account()
 SJ {
 
 SJ db_connect();
 SJ $query = update subscribers 
 SJ set email = '$new_email',
 SJ nickname = '$new_nickname',
 SJ fullname = '$new_realname',
 SJ company = '$new_company',
 SJ mimetype = '$new_mimetype'
 SJ where email = '$old_id';
 SJ $result = mysql_query($query)or die(Error: Could not update 
 SJ queryBR$queryBR.mysql_error());
 SJ if (!$result)
 SJ {
 SJ echo An error occurred when trying to update the DB;
 SJ }
 SJ else
 SJ {
 SJ echo $result  Successfully updated the details;
 SJ }
 SJ }
 
 You will need to use the global vars and also escape quotes like this:
 
 function update_subscriber_account()
 {
  $new_email = addslashes($_POST['new_email']);
  .
  .
  .
 $query = update subscribers
 
 set email = '$new_email',
 .
 .
 
 -- 
 regards,
 Tom
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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



RE: [PHP] Problem updating[Scanned]

2003-03-06 Thread Michael Egan
Join the club.

I spent some time looking at your original post - submitted a response - but 
associated it with the wrong thread!

Apologies to all!

Michael

-Original Message-
From: Steve Jackson [mailto:[EMAIL PROTECTED]
Sent: 06 March 2003 15:00
To: 'Tom Rogers'
Cc: 'PHP General'
Subject: RE: [PHP] Problem updating[Scanned]


Actually it didn't need the globals,
But I did need to pass the variables into the function!
Update_subscriber_account($var1, $var2 etc)
I feel a right plonker now!

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159





 -Original Message-
 From: Tom Rogers [mailto:[EMAIL PROTECTED] 
 Sent: 6. maaliskuuta 2003 16:28
 To: Steve Jackson
 Cc: PHP General
 Subject: Re: [PHP] Problem updating
 
 
 Hi,
 
 Friday, March 7, 2003, 12:27:27 AM, you wrote:
 SJ Been on this a couple of hours... anyone see what I'm 
 doing wrong? I 
 SJ get a result of 1 when I echo $result but it doesn't want 
 to update 
 SJ at all. The action of this form 
 index.php?action=update-account is 
 SJ just a switch case
 SJ Which asks you to use the function 
 update_subscriber_account() below...
 
 SJ form method='post' action='index.php?action=update-account'
 SJinput type='hidden' name='old_id' value='$email'
 SJtr
 SJ  th colspan = 2 bgcolor = '#5B69A6'
 SJ $title 
 SJ  /th
 SJ/tr
 SJtr
 SJ  tdReal Name:/td
 SJ  tdinput type = text name='new_realname' maxlength = 100 
 SJ   value ='$realname'/td
 SJ/tr
 SJtr
 SJ  tdPreferred Name:/td
 SJ  tdinput type = text name='new_nickname' maxlength = 100 
 SJ   value ='$nickname'/td
 SJ/tr
 SJtr
 SJ  tdCompany:/td
 SJ  tdinput type = text name='new_company' maxlength = 100 
 SJ   value ='$company'/td
 SJ/tr
 SJtr
 SJ  tdEmail Address:/td
 SJ  tdinput type = text name='new_email' maxlength = 100 
 SJ   value ='$email'/td
 SJ/tr
 SJtr
 SJ  tdRequested Email Format:/td;
 SJ  echo tdselect name='new_mimetype'option; 
 SJif ($mimetype == 'T') 
 SJ   echo  selected;
 SJecho Text Onlyoption;
 SJif ($mimetype == 'H') 
 SJ   echo  selected;
 SJecho HTML/select/td;
 SJ print /tr
 SJ tr
 SJ td colspan=2 align=center;
 SJ display_form_button('save-changes');
 SJ print /td/tr/form/table/centerbr;
 SJ }
 SJ }
 
 SJ function update_subscriber_account()
 SJ {
 
 SJ db_connect();
 SJ $query = update subscribers 
 SJ set email = '$new_email',
 SJ nickname = '$new_nickname',
 SJ fullname = '$new_realname',
 SJ company = '$new_company',
 SJ mimetype = '$new_mimetype'
 SJ where email = '$old_id';
 SJ $result = mysql_query($query)or die(Error: Could not update 
 SJ queryBR$queryBR.mysql_error());
 SJ if (!$result)
 SJ {
 SJ echo An error occurred when trying to update the DB;
 SJ }
 SJ else
 SJ {
 SJ echo $result  Successfully updated the details;
 SJ }
 SJ }
 
 You will need to use the global vars and also escape quotes like this:
 
 function update_subscriber_account()
 {
  $new_email = addslashes($_POST['new_email']);
  .
  .
  .
 $query = update subscribers
 
 set email = '$new_email',
 .
 .
 
 -- 
 regards,
 Tom
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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


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



[PHP] Problem updating post on a basic weblog system

2002-09-12 Thread Jesse Lawrence

Hello all,

I've got a bit of a code problem that's been baffling
me for a while now.

I'm working on a basic weblog system for personal use,
using MySQL.  I've got the new post and delete a
post aspects working fine, but for some reason, I
can't get the update a post part happening.  

What happens is I select a post to update, and then
the post comes up in a textarea box.  You then make
your update, and submit.

Doing this calls the following function:

 function updateBlog($input,$edit_blog) { 


 include 'db_connect.php';
$update_query = update $table set blog='$input'
where id='$edit_blog';
if(mysql_db_query ($database, $update_query,
$link)) {
   print Successfully Edited!!;
}else{
print no;

}   

 The variables being passed to the function are:
  $input = The body of the post
 and
  $edit_blog =  id # of post

At this point everything appears to have been a
success.  The Successfully Edited!! confirmation
appears, and everything seems fine, but when I look at
my database, nothing has been updated or changed in
any way.

Does anyone have any suggestions or help they could
lend me?  I've been facing this problem for a while
now, and can't seem to get my head around it.

You can view the entire code here:
http://soniceast.d2g.ca/~jalaw/blog/admin.txt

Thanks a bunch for any help,

Jesse Lawrence
 

__ 
Post your free ad now! http://personals.yahoo.ca

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




Re: [PHP] Problem updating post on a basic weblog system

2002-09-12 Thread Chris Wesley

code snippet
   if ($post == post) {
  postBlog ($post,$input,$title);
   }elseif ($post == edit){

  updateBlog ($input,$edit_post);  //   BINGO!
   }
/code snippet

Just looking at the code you posted to your site, there's only one thing
obvious to me: You want to use $edit_blog in that call to updateBlog
instead of $edit_post?

g.luck,
~Chris

On Thu, 12 Sep 2002, Jesse Lawrence wrote:

 Hello all,

 I've got a bit of a code problem that's been baffling
 me for a while now.

 I'm working on a basic weblog system for personal use,
 using MySQL.  I've got the new post and delete a
 post aspects working fine, but for some reason, I
 can't get the update a post part happening.

 What happens is I select a post to update, and then
 the post comes up in a textarea box.  You then make
 your update, and submit.

 Doing this calls the following function:

  function updateBlog($input,$edit_blog) {


  include 'db_connect.php';
 $update_query = update $table set blog='$input'
 where id='$edit_blog';
 if(mysql_db_query ($database, $update_query,
 $link)) {
print Successfully Edited!!;
 }else{
 print no;

 }

  The variables being passed to the function are:
   $input = The body of the post
  and
   $edit_blog =  id # of post

 At this point everything appears to have been a
 success.  The Successfully Edited!! confirmation
 appears, and everything seems fine, but when I look at
 my database, nothing has been updated or changed in
 any way.

 Does anyone have any suggestions or help they could
 lend me?  I've been facing this problem for a while
 now, and can't seem to get my head around it.

 You can view the entire code here:
 http://soniceast.d2g.ca/~jalaw/blog/admin.txt


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