Re: [PHP] Re: Retrieving Data To Edit

2004-07-09 Thread Matthew Sims
> I'm getting closer...!
>
> I SELECT:
>
>   $sql = "SELECT UserFirstName FROM RegisteredMembers WHERE
> UserID='$_POST[TXT_UserID]'";
>   $result5 = mysql_query($sql) or die ("error: couldn't select UserID from
> database. Please e-mail: [EMAIL PROTECTED] with this
> error
> message.");
> while($row = mysql_fetch_array($result5))
>   {
>   $User=$row["UserFirstName"];
>   $UserFurtherComments=$row["FurtherComments"];
>   }
>
> I then use a form:
>
> echo "";
> echo "a little about me:";
> echo " value='FurtherComments field should appear here'>";
> echo "20 characters max";
> echo "";
>
> But if is use "value='$UserFurtherComments' nothing appears in the form
> field, even though the database holds a value in that field.
>
> What am I doing wrong...?
>
> --
> -
>  Michael Mason

Do you need to use a while loop? If you're expecting only 1 query result
from the database, skip the while loop and simply use:




'>


If more than 1 result is expected, move your while loop to here:



  
  a little about me:
  '>
  20 characters max
  



And one last thing, you $_POST is set wrong:
$_POST['TXT_UserID']

--Matthew Sims
--

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



[PHP] Re: Retrieving Data To Edit

2004-07-09 Thread Daniel Kullik
Harlequin wrote:
This is really confusing and I'm sure very simple to achieve.
I already have values selected that I want to open and edit:
$sql = "SELECT * FROM RegisteredMembers WHERE UserID='$_POST[TXT_UserID]'";
I basically want to recall these values on screen for the user to edit
themselves. Once I've achieved that I'm assuming that I simply use an INSERT
command but need to achieve the first step first of calling the data up...
Did you define a constant named 'TXT_UserID'?
If 'TXT_UserID' is the name of a form-element you might try this instead 
of your posted line of code:

[code]
$sql = sprintf(
  'SELECT * FROM RegisteredMembers WHERE UserID = "%s"',
  $_POST['TXT_UserID']
);
[/code]
(So maybe you just forgot some quotation-marks (-:)
Daniel
--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Re: Retrieving Data To Edit

2004-07-09 Thread Jay Blanchard
[snip]
  $sql = "SELECT UserFirstName FROM RegisteredMembers WHERE
UserID='$_POST[TXT_UserID]'";
[/snip]

please change
$sql = "SELECT UserFirstName FROM RegisteredMembers WHERE
UserID='$_POST[TXT_UserID]'";

to the proper syntax of
$sql = "SELECT UserFirstName FROM RegisteredMembers WHERE
UserID='" . $_POST['TXT_UserID'] . "' ";

[snip]
echo "";
echo "a little about me:";
echo "";
echo "20 characters max";
echo "";
[/snip]

echo "";

should be

echo "";

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



[PHP] Re: Retrieving Data To Edit

2004-07-09 Thread Harlequin
I'm getting closer...!

I SELECT:

  $sql = "SELECT UserFirstName FROM RegisteredMembers WHERE
UserID='$_POST[TXT_UserID]'";
  $result5 = mysql_query($sql) or die ("error: couldn't select UserID from
database. Please e-mail: [EMAIL PROTECTED] with this error
message.");
while($row = mysql_fetch_array($result5))
  {
  $User=$row["UserFirstName"];
  $UserFurtherComments=$row["FurtherComments"];
  }

I then use a form:

echo "";
echo "a little about me:";
echo "";
echo "20 characters max";
echo "";

But if is use "value='$UserFurtherComments' nothing appears in the form
field, even though the database holds a value in that field.

What am I doing wrong...?

-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-
"Harlequin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> This is really confusing and I'm sure very simple to achieve.
>
> I already have values selected that I want to open and edit:
>
> $sql = "SELECT * FROM RegisteredMembers WHERE
UserID='$_POST[TXT_UserID]'";
>
> I basically want to recall these values on screen for the user to edit
> themselves. Once I've achieved that I'm assuming that I simply use an
INSERT
> command but need to achieve the first step first of calling the data up...
>
> -- 
> -
>  Michael Mason
>  Arras People
>  www.arraspeople.co.uk
> -
>

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



[PHP] Re: Retrieving Data To Edit

2004-07-09 Thread Torsten Roehr
"Harlequin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> This is really confusing and I'm sure very simple to achieve.
>
> I already have values selected that I want to open and edit:
>
> $sql = "SELECT * FROM RegisteredMembers WHERE
UserID='$_POST[TXT_UserID]'";

Hi,

please put quotes around your array keys:
$_POST[TXT_UserID] => $_POST['TXT_UserID']

Regards, Torsten

>
> I basically want to recall these values on screen for the user to edit
> themselves. Once I've achieved that I'm assuming that I simply use an
INSERT
> command but need to achieve the first step first of calling the data up...
>
> --
> -
>  Michael Mason
>  Arras People
>  www.arraspeople.co.uk
> -

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