473,554 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Selecting Table row records for editing

I¹m not sure if this a PHP question or an MySQL question but here it goes.

I have a repeat region of a table called userid

What I¹m trying to accomplish is being able to edit the record and then
update it by clicking a submit button on the same line. I¹m doing it this
way so the user can quickly update a number of records one at a time. I know
I could do this by passing the userid info to a detail page but really want
to do it the way described. My problem is how do you select and then update
a specific row record ?

Thanks in advance.

Jul 17 '05 #1
4 3657
webhigh wrote:
I’m not sure if this a PHP question or an MySQL question but here it goes.

I have a repeat region of a table called userid

What I’m trying to accomplish is being able to edit the record and then
update it by clicking a submit button on the same line. I’m doing it
this way so the user can quickly update a number of records one at a
time. I know I could do this by passing the userid info to a detail page
but really want to do it the way described. My problem is how do you
select and then update a specific row record ?


I do 'inline' editing in quite a few of my scripts. It often makes
things easier. The way to do that is as follows:

foreach ($userrecords as $userid => $userrecord) {
if ($userid == $_REQUEST['currentid']) {
# output the edit form for this record
} else {
# output a display row for this record
# ensure there is a link to $PHP_SELF?curre ntid=$userid
}
}

Then your initial display will be a page listing all your user records.
Click on the select link and you will get the same page with the chosen
record in a form for amendment. The form submit will then save your
changes and go back to the list. You can fiddle with currentid to select
the next record if you wish.
Jul 17 '05 #2
Selecting Table row records for editing
"webhigh" <we*****@attbi. com> wrote in message
news:BCAA8580.1 285A%we*****@at tbi.com...
I'm not sure if this a PHP question or an MySQL question but here it goes.

I have a repeat region of a table called userid

What I'm trying to accomplish is being able to edit the record and then
update it by clicking a submit button on the same line. I'm doing it this
way so the user can quickly update a number of records one at a time. I know
I could do this by passing the userid info to a detail page but really want
to do it the way described. My problem is how do you select and then update
a specific row record ?

----------------------------------------

What you can do is give each record a separate form, each with its submit
button. Say the records are listed in a table...

<table>
<tr>
<form action="save_re cord.php" method="post">
<td><input type ="text" name="name"></td>
...
<td><input type="hidden" name="userid" value="42">
<input type="submit" value="Save"></td>
</td>
</form>
</tr>

Save_record.php would changes to that record. Now here's the trick: if no
error was encountered, the script returns the HTTP status code 204 ("No
Content"). The browser's response to this is to keep the current page. No
refresh happens so you user doesn't lose the place s/he's at.
Jul 17 '05 #3
Selecting Table row records for editingIn my humble opinion your approach is all wrong. You should not allow updates on a list/browse form. Instead you should allow the user to select one or more entries on the current screen then press an UPDATE button which will go into a detail screen with its own SUBMIT button. If more than one record was selected you should display links which allow the user to step forwards and backwards through the selected items.

If you visit http://www.tonymarston.net/php-mysql...plication.html this will give you access to an online demonstration. You can then download the code and run it locally.

HTH

--
Tony Marston

http://www.tonymarston.net
"webhigh" <we*****@attbi. com> wrote in message news:BCAA8580.1 285A%we*****@at tbi.com...
I'm not sure if this a PHP question or an MySQL question but here it goes.

I have a repeat region of a table called userid

What I'm trying to accomplish is being able to edit the record and then update it by clicking a submit button on the same line. I'm doing it this way so the user can quickly update a number of records one at a time. I know I could do this by passing the userid info to a detail page but really want to do it the way described. My problem is how do you select and then update a specific row record ?

Thanks in advance.
Jul 17 '05 #4
On 4/21/04 6:37 AM, in article c6************* ******@news.dem on.co.uk, "Tony
Marston" <to**@NOSPAM.de mon.co.uk> wrote:
In my humble opinion your approach is all wrong. You should not allow updates
on a list/browse form. Instead you should allow the user to select one or more
entries on the current screen then press an UPDATE button which will go into a
detail screen with its own SUBMIT button. If more than one record was selected
you should display links which allow the user to step forwards and backwards
through the selected items.

If you visit http://www.tonymarston.net/php-mysql...plication.html this
will give you access to an online demonstration. You can then download the
code and run it locally.

HTH


Thanks * It looks great would love to have something like this but I down
loaded the code and it is way beyond me. Which I could just upload and
select the table and the fields to show.

I kept getting the following:
This application has encountered an unrecoverable error

The following has been reported to the administrator:

2004-04-21 08:33:19

Fatal Error: MySQL error: 1044 : Access denied for user: 'value@localhos t'
to database 'sample' (# 256).

Error in line 173 of file
'/home/value/public_html/phpapps/sample/std.dml.class.i nc'.

Script: '/phpapps/sample/person_list.php '.

Object/Class: 'dml', Parent Class: ''.

Remote Address: (I deleted)

Warning: error_log(/home/value/public_html/errorlog.html): failed to open
stream: Permission denied in
/home/value/public_html/phpapps/sample/error.inc on line 88
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1914
by: Oren | last post by:
Hi, I have an Access application with linked tables via ODBC to MSSQL server 2000. Having a weird problem, probably something i've done while not being aware of (kinda newbie). the last 20 records (and growing)of a specific table are locked - cant change them - ("another user is editing these records ... ").
28
4025
by: Lee Rouse | last post by:
Hello all, This is going to be a rather lengthy "question". I have an Access 2k database, separated front end/back end. Front end copies are on about 30 workstations and used frequently during the work day. The backend has a table called CLIENTS with approximately 6000 client records. Changes to data in the table are made via a frontend...
0
1798
by: allyn44 | last post by:
HI--I have 2 tables Cut: cut ID, HistNumb, Block, date: Cut Id is the primary key, the other 3 fileds are indexed to be unique Slides: Cutid SlideID, and various other fields: there can be multiple slide records per CutID. This table is a subdatashet of the Cut table--so the CutId is stored in it I have a form based on a query between...
1
2556
by: Ramesh | last post by:
hi, I am selecting fields from three table for manupulating data and i want to display total number of records selected. But i am always getting -1 value, eventhough 1000 of records are selected. Below is my code. here strSelectSQL value is strSelectSQL = "Select emp.Empno, emp.FirstName, emp.LastName, emp.DB,...
48
3819
by: phillip.s.powell | last post by:
MySQL 3.23.58 - 4.0.17 (yep, several database server instances, don't ask) I have database Spring with table Students I have database Summer with table Students I am tasked to produce a query of all students in both tables with no duplicates. No clue whatsoever.
2
3315
by: Catch_22 | last post by:
Hi, I have a stored procedure that has to extract the child records for particular parent records. The issue is that in some cases I do not want to extract all the child records only a certain number of them. Firstly I identify all the parent records that have the requird number of child records and insert them into the result table.
4
1814
by: J | last post by:
I am editing a pre-existing view. This view is already bringing data from 40+ tables so I am to modify it without screwing with anything else that is already in there. I need to (left) join it with a new table that lists deposits and the dates they are due. What I need is to print, for each record in the view, the due date for the next...
2
2592
by: movieking81 | last post by:
If someone could help me with this, that would be great. I need to select a number of records from an SQL table based on a date range, so I started with this select. <html> <code> resultssql = "SELECT * FROM testtable where name = '" & request("name") & "' AND fromd >= '" & getdatefrom & "' AND fromd <= '" & getdateto & "'" </code> </html>...
2
2126
by: Gord | last post by:
Is it possible to get a table type grid to appear on a custom dialog form? Basically, get the same thing as when you open a table in Datasheet view and can edit the individual columns. I'd like to make a custom dialog (free floating without the tab) with some textual instructions and then have a few records displayed (probably from a query)...
0
7535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8051
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7574
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7894
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3561
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2026
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1145
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.