RE: Re[2]: [PHP-DB] how to pull array out?

From: Date: Thu, 30 May 2002 18:44:47 +0000
Subject: RE: Re[2]: [PHP-DB] how to pull array out?
Groups: php.db 
Request: Send a blank email to php-db+get-19534@lists.php.net to get a copy of this message
Thanks! I'd never heard of that. I use: sybase_min_server_severity(11); -Natalie -----Original Message----- From: Ed Gorski [mailto:gorskie@spjc.edu] Sent: Thursday, May 30, 2002 2:37 PM To: Leotta, Natalie (NCI/IMS); 'Jas'; php-db@lists.php.net Subject: RE: Re[2]: [PHP-DB] how to pull array out? People use to suppress errors / warning messages....I know I use it a lot with obdc and SQL SERVER procedures... ed At 02:32 PM 5/30/2002 -0400, Leotta, Natalie (NCI/IMS) wrote: > 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:jlgerfen@hotmail.com] >Sent: Thursday, May 30, 2002 2:18 PM >To: php-db@lists.php.net >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" <julie@thickbook.com> wrote in message >news:473149194.20020530103942@thickbook.com... > > 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 > > --> julie@thickbook.com > > --> 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

« previous php.db (#19534) next »