SUCCESS!!!!
Ok, I have fixed the problem.  Here is the code, I hope it helps anyone that
comes accross something like this.  Sorry for being a "troll".
Jas
// Displays select form of current users in database table for editing
$table = "users";
 $record = @mysql_query("SELECT * FROM $table",$dbh);
  while ($row = mysql_fetch_array($record)) {
    $user_id = $row['user_id'];
    $f_name = $row['f_name'];
    $l_name = $row['l_name'];
    $email_addy = $row['email_addy'];
    $un = $row['un'];
    $pw = $row['pw'];
    $option .="<OPTION VALUE=\"$user_id\">$f_name $l_name</OPTION>";
    $var_form = "<p><FORM METHOD=\"post\" ACTION=\"edit_account.php\">
    <b>Please select the user you would like to edit from the list</b><br>
    <SELECT NAME=\"blank\">$option</SELECT>
    <INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\">
    </FORM><br>";
// Takes value of "blank" and looks for a record matching selected user and
puts the results into a form for editing
$table = "auth_users";
 $record = @mysql_query("SELECT * FROM $table WHERE user_id =
'$blank'",$dbh);
   while ($row = mysql_fetch_array($record)) {
    $user_id = $row['user_id'];
    $f_name = $row['f_name'];
    $l_name = $row['l_name'];
    $email_addy = $row['email_addy'];
    $un = $row['un'];
    $pw = $row['pw']; }
    $var_form .= "<table width=\"100%\" border=\"0\" cellpadding=\"7\"><form
name=\"$user_id\" method=\"post\" action=\"del_account.php\">
      <tr><td width=\"20%\" colspan=\"2\"><b>Edit Account
$user_id</b></td></tr>
    <tr><td width=\"20%\">First Name:</td><td width=\"80%\"><input
type=\"text\" name=\"$f_name\" size=\"30\" maxlength=\"30\"
value=\"$f_name\"><font class=\"copyright\">i.e. John</font></td></tr>
    <tr><td width=\"20%\">Last Name:</td><td width=\"80%\"><input
type=\"text\" name=\"$l_name\" size=\"30\" maxlength=\"30\"
value=\"$l_name\"><font class=\"copyright\">i.e. Doe</font></td></tr>
          <tr><td width=\"20%\">Email:</td><td width=\"80%\"><input
type=\"text\" name=\"$email_addy\" size=\"30\" maxlength=\"30\"
value=\"$email_addy\"><font class=\"copyright\">i.e.
[EMAIL PROTECTED]</font></td></tr>
    <tr><td width=\"20%\">User Name:</td><td width=\"80%\"><input
type=\"text\" name=\"$un\" size=\"30\" maxlength=\"30\" value=\"$un\"><font
class=\"copyright\">i.e. j-doe</font></td></tr>
    <tr><td width=\"20%\">Password:</td><td width=\"80%\"><input
type=\"password\" name=\"$pw\" size=\"30\" maxlength=\"30\"><font
class=\"copyright\">(password must be alpha-numeric, i.e.
pAs5w0rd)</font></td></tr>
                <tr><td width=\"20%\">Confirm Password:</td><td
width=\"80%\"><input type=\"password\" name=\"$pw\" size=\"30\"
maxlength=\"30\"><font class=\"copyright\">please confirm password
entered</font></td></tr>
                <tr><td width=\"20%\">&nbsp;</td><td width=\"80%\"><input
type=\"submit\" name=\"add\" value=\"edit user\">&nbsp;&nbsp;<input
type=\"reset\" name=\"reset\" value=\"reset\"></td></tr>
       </form></table>";
*** The problem was that I was looking for the variable $user_id in my
select statement not the option name which is "blank" (just me getting ahead
of myself, sorry once again) ***

"Natalie Leotta" <[EMAIL PROTECTED]> wrote in message
7546CB15C0A1D311BF0D0004AC4C4B0C024AC468@SSIMSEXCHNG">news:7546CB15C0A1D311BF0D0004AC4C4B0C024AC468@SSIMSEXCHNG...
> From what I've seen on the PHP.net site, it doesn't look like people use
the
> @ in @mysql_query, and I know that I don't use it for sybase_query.  Where
> did it come from?
>
> Assuming that's not the problem, I'd try printing out everything.  Right
> after your while, print $row - it should say "array", then try printing
> $row[0] and see if that works.  Then try printing $row['user_id'].
>
> You may also want to try doing a SELECT with the fieldnames, instead of
just
> the *.  Also, make sure you're typing the field names correctly - they are
> case sensitive.
>
> Hopefully one of these suggestions will help you.
>
> -Natalie
>
> -----Original Message-----
> From: Jas [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 30, 2002 2:18 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Re[2]: [PHP-DB] how to pull array out?
>
>
> Ok, given there are people out there that expect people to "do the work
for
> them", however if you look at my original post (today) you will see that I
> have queried the database, feed the results into an array, then called the
> array elements into my form, however simple this may be for you it is
still
> not pulling out the results of the array into my form.  I do believe I am
> missing something, and doing homework is a part of my everyday routine
> trying to develop web based apps.  The code again:
>
> $table = "auth_users"; // names the table to query correct?
>  $record = @mysql_query("SELECT * FROM $table WHERE user_id =
> '$user_id'",$dbh); // pulls all records in relation to $user_id correct?
>    while ($row = mysql_fetch_array($record)) { // pulls results of query
> into an array correct?
>     $user_id = $row['user_id']; // assigns unique names for my different
> editable regions correct?
>     $f_name = $row['f_name'];
>     $l_name = $row['l_name'];
>     $email_addy = $row['email_addy'];
>     $un = $row['un'];
>     $pw = $row['pw']; }
>     $var_form .= <form name=\"$user_id\" method=\"post\"
> action=\"del_account.php\">
>       <b>Edit Account $user_id</b><br> // echoes the $user_id that is
going
> to be edited correct?
>     First Name:<input type=\"text\" name=\"f_name\" size=\"30\"
> maxlength=\"30\" value=\"$f_name\"><br> // displays text box to edit with
> $f_name variable from resulting array correct?
>     Last Name:<input type=\"text\" name=\"l_name\" size=\"30\"
> maxlength=\"30\" value=\"$l_name\"><br> // displays text box to edit with
> $l_name variable from resulting array correct?
>     Email:<input type=\"text\" name=\"email_addy\" size=\"30\"
> maxlength=\"30\" value=\"$email_addy\"><br> // displays text box to edit
> with $email_addy variable from resulting array correct?
>     User Name:<input type=\"text\" name=\"un\" size=\"30\"
maxlength=\"30\"
> value=\"$un\"><br>  // displays text box to edit with $un variable from
> resulting array correct?
>     Password:<input type=\"password\" name=\"pw\" size=\"30\"
> maxlength=\"30\"><br> // displays text box to edit with $pw variable from
> resulting array correct?
>     Confirm Password:<input type=\"password\" name=\"cpw\" size=\"30\"
> maxlength=\"30\">
>     &nbsp;<input type=\"submit\" name=\"add\" value=\"edit
> user\">&nbsp;&nbsp;<input type=\"reset\" name=\"reset\" value=\"reset\">";
>
> Any help or examples are appreciated.  Please understand I am trying to
> learn this scripting language and RTFM does not help as most of the time I
> post here as a LAST resort, i.e. after I have indeed RTFM'ed.
> Thanks again,
> Jas
>
>
> "Julie Meloni" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Jas (and anyone else) -
> >
> > With all due respect, you're acting like a troll.  Posting a question,
> > getting MANY correct answers, then reposting the question and bitching
> > about not understanding the answers, well, that's troll-like.
> >
> > Granted, many responses on this list over the past while have been
> > sarcastic, but usually also have the answer in them.  The tone comes
> > from people asking the questions not doing their own homework.
> >
> > e.g. http://www.tuxedo.org/~esr/faqs/smart-questions.html
> >
> > Mailing lists such as this one are not intended to give people
> > verbatim answers to their problems, such as "I have to write an
> > application for my university class, please do it for me" and the
> > like.  Instead, these lists will help those who attempt to help
> > themselves.
> >
> > The fact of the matter is, RTFM is the right answer.  The very
> > simplistic method of reading the results of a MySQL query are right
> > there in the manual, in the MySQL query functions section.  Also,
> > they're in zillions of tutorials, any basic book on PHP, and so on.
> >
> > In short:
> >
> > 1) connect to db server -- mysql_connect()
> > 2) select db -- mysql_select_db()
> > 3) issue query -- mysql_query()
> > 4) from there you get a result identifier.  You feed that into
> > mysql_result() or mysql_fetch_array() or mysql_fetch_row()
> >
> > Read the manual for the differences -- including examples.
> >
> >
> > You say:
> > J> rest of us we rely on examples, etc to get it done.
> >
> > They ARE in the manual, which is pretty much the best manual out there
> > for just about anything.
> >
> > Good luck,
> > - Julie
> >
> > --> Julie Meloni
> > --> [EMAIL PROTECTED]
> > --> www.thickbook.com
> >
> > Find "Sams Teach Yourself MySQL in 24 Hours" at
> > http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20
> >
>
>
>
> --
> 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

Reply via email to