On Friday 31 May 2002 02:17, Jas wrote:
> 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']; }

1) Check that the stuff you're getting from the query is correct by making 
liberal use of echo() eg echo("f_name is $f_name") etc.

>     $var_form .= <form name=\"$user_id\" method=\"post\"
> action=\"del_account.php\">

2) You seem to be missing an opening double-quote:

  $var_form .= "<form name=\"$user_id\" method=\"post\"

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

The trick is to start with something simple then build upon it. Don't try to 
write your complete program in one go, build it up step by step.

For example if I was writing the above stuff I would have split it into at 
least 2 steps.

1) Connect to db and make query. Verify that query gives expected results.
2) Incorporate the results of query into the form.

One last tip: do try to make your db connection code like it is done in the 
manual -- ie incorporate some error handling. You'll save yourself a lot of 
grief in the long run.

Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

You are deeply attached to your friends and acquaintances.

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

Reply via email to