MySQL UPDATE after use $uniqueID to find table row, etc

This is a discussion on "MySQL UPDATE after use $uniqueID to find table row, etc" within the PHP Forum section. This forum, and the thread "MySQL UPDATE after use $uniqueID to find table row, etc are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Dec 6th, 2005, 06:10
Junior Member
Join Date: Sep 2005
Location: kNot in Kansas
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
MySQL UPDATE after use $uniqueID to find table row, etc

i have a table with 7 writable fields. i've already populated column1 w/ data. so, 6 fields in each row need updating.

the data in field #1 is a "unique identifier" code, but not the auto_increment field, and therefore should NOT be updated along with its row's neighboring cells. this "unique Identifier" column is used as a human-friendly reference-point for sifting through records in the table via HTML select dropdown box, and its value should remain static once entered into the db.

currently, the HTML from is set up as a dropdown list containing all $uniqueID options, and then 6 remaining <input type="text"> fields. i want to select one of those ID's and enter data in its 6 remaining fields-- preferrably all from one page. but, what if some, or all of those 6 remaining field properties of this ID are already populated? i need to be able to check the data in those cells which neighbor the unique ID option selected from the dropdown of so that i can recognize which fields of that row do not yet contain info, or if any existing info needs to be updated-- which might look something like this (off the top-of-my head):
PHP: Select all

<select name="rowID">
<
option value="$uniqueID">$uniqueID</option>
</
select>
$sql "SELECT * from table where uID = $_POST['rowID']";

etc... 
i'd prefer to have this function happen all w/in one nice, tidy form-- so i can come upon this form, select my row ID, verify and/ or update existing data, OR add new data if the resulting fields are blank.

my obstacle is finding a way to populate those <input> fields. If there is already data in the uniqueID row's 6 other fields, i want that data to "populate" those text input fields so if modifications need to be done to the existing data, the data is already in the <input type="text"> fields-- making it very convenient for the user to manipulate-- so one needs only to put the cursor in the field and update the info.
if the fields in uniqueID's row are empty, then it would be as if it were any other form field w/ blank text input areas.

i hope this makes sense to you. i had difficulty in articulating what i'm trying to do here. sorry it took so many words to "talk it out"!

EDIT: if javascript is the answer, please give me a tip, or point me in the direction of a tutorial if you can-- i'm rather inexperienced in javascript. thanks!

thanks!!

Last edited by jswebdev; Dec 6th, 2005 at 06:27.
Reply With Quote

  #2 (permalink)  
Old Dec 6th, 2005, 12:09
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Re: MySQL UPDATE after use $uniqueID to find table row, etc

What you are trying to do is a very standard thing.

All you need to do is to select an ID (row) from a dropdown.... the page should then (via javascript) throw the ID over to the script which will get the record and you can then populate the data into the form.

To use Pseudo code:-
Code: Select all
mode = [passed in via querystring]
 
if mode = "get"
   grab record number from querystring
   grab record data from DB into an array (based on the passed ID)
   set flag indicating we have a record
if mode = "update"
   get posted form data into an array
   update the record in the database
 
for both the above, redisplay the form with relevant record.
 
if no mode, just display the form
Crude.... but just to give you a general idea.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
Reply With Quote
Reply

Tags
mysql, update, use, uniqueid, table, row, etc

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Count something in MySQL Table? Jack Franklin PHP Forum 5 Jan 11th, 2008 17:46
Viewing the contents of a table in MySQL nemmea Databases 3 Sep 6th, 2007 22:01
Find(on this Page) Feature for HTML table sameer2k JavaScript Forum 1 Jul 8th, 2006 12:51
mysql update record djme Databases 4 Nov 28th, 2005 11:12
Update Table ekendricks Classic ASP 1 Sep 8th, 2003 08:28


All times are GMT. The time now is 07:17.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43