Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Creating Update and deleting Records Forms

Guest
Mar 20, 2009 Mar 20, 2009

Copy link to clipboard

Copied

Hi Guys

Hopefully some one can help me with this, I am using php and mysql, I already have a page that shows all the records of customers details, which I can navigate through the pages of records.

I have created a update page, using the update wizard, which works but only shows the first record. I have added a repeat region and page navigation which allows me to choose individual records but wont update those records.

I also took a look at a tutorial video that had you adding an extra column and add the word update to add a hyperlink that took you to the update form with that particular record for updating, the video was using cold fusion the link was update page address then this ?ID=#ID#, I tried different versions of this with no success.

I also tried to alter the record set and added a filter using Member_ID and = paramater URL, this made my cusomter detail page stop working.

can some one help please

Cheers
Mark
TOPICS
Server side applications

Views

1.1K
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 20, 2009 Mar 20, 2009

Copy link to clipboard

Copied

burkeslaw wrote:
> I also took a look at a tutorial video that had you adding an extra column and
> add the word update to add a hyperlink that took you to the update form with
> that particular record for updating, the video was using cold fusion the link
> was update page address then this ?ID=#ID#, I tried different versions of this
> with no success.

That's ColdFusion syntax. The correct syntax for PHP is shown on this
Dreamweaver help page:

http://help.adobe.com/en_US/Dreamweaver/10.0_Using/WScbb6b82af5544594822510a94ae8d65-78b3a.html

--
David Powers
Adobe Community Expert, Dreamweaver
http://foundationphp.com

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 21, 2009 Mar 21, 2009

Copy link to clipboard

Copied

Hi David

Thanks for your help I will give this a try, it seems the most simple way to update and delete records in the database.

One question do I have to add a filter, using the field id to the recordset or will this work without the filter which is how it is now.

Cheers
Mark

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 21, 2009 Mar 21, 2009

Copy link to clipboard

Copied

Hi again David

I tried using the correct php syntax, it seems to be partially working, when I test the page using localhost, and mouse over the individual update hyperlinks for each record it returns the linked file name with the correct ID number such as
members_admin_update.php?recordID=12345 ect of each individual record. but when the members update page opens with the update form it always shows the first record, wont show the record of the ID in the URL. How do I fix this?

Cheers
Mark

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 22, 2009 Mar 22, 2009

Copy link to clipboard

Copied

burkeslaw wrote:
> when the members update page opens with the update form it always shows the
> first record, wont show the record of the ID in the URL. How do I fix this?

Before applying the update record server behavior, you need to create a
recordset that uses the URL parameter as a filter.

--
David Powers
Adobe Community Expert, Dreamweaver
http://foundationphp.com

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 22, 2009 Mar 22, 2009

Copy link to clipboard

Copied

Hi David

Thanks for helping with this, I have actually already tried this using the URL paramenter in the recordset that I used for creating an Update form, I used Update Form wizard which was based on this particular recordset with a URL parameter. When you clicked on the update hyperlink from the recordset display page, it opened the update form put with no record data of the record I selected, all fields where blank. When I moused over the individual records update links, the URL in the bottom left hand corner would'nt show the record ID number, as it did before when I used the recordset I created for the recordset display page, I mentioned this earlier.

Is it that I have to create the update form manually and then select it and add the update form behaviour? Is there an Go to Detailed Page server behaviour for php, or is this just for ASP technology.

Cheers
Mark

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 23, 2009 Mar 23, 2009

Copy link to clipboard

Copied

burkeslaw wrote:
> Is it that I have to create the update form manually and then select it and
> add the update form behaviour? Is there an Go to Detailed Page server behaviour
> for php, or is this just for ASP technology.

I'm not familiar with the ASP server behaviors, but there is a Master
Detail Page Set for PHP (it's on the Insert > Data Objects menu).

Creating an update page is very easy.

1. Create a page that lists all records in the database.
2. Alongside each record, create a link to the update page.
3. When creating the link, click the Parameters button inside the Select
File dialog box.
4. In the Name field of the Parameters dialog box, type the name of the
primary key (ID).
5. Click the lightning bolt icon to the right of the Value field, and
select the primary key from the recordset.
6. Click OK twice to close both dialog boxes.
7. Save the page and test it in a browser. When you mouse over each
link, it should display a URL that looks something like this:
update.php?id=3. The name/value pair after the question mark pass the
details of the record as a URL parameter to the update page.
8. In the update page, create a recordset that uses the URL parameter as
a filter to select a single record depending on the value sent from the
previous page.
9. In the update page, create a hidden field to store the ID from the
recordset (click the lightning bolt icon alongside the Value field to
insert the dynamic data).
10. Apply an Update Record server behavior. Make sure the primary key
gets its value from the hidden field in the form.

Alternatively, if you don't want to build your own update form, replace
steps 9 and 10 by using the Record Update Form Wizard (Insert > Data
Objects > Update Record > Record Update Form Wizard).

--
David Powers
Adobe Community Expert, Dreamweaver
http://foundationphp.com

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 23, 2009 Mar 23, 2009

Copy link to clipboard

Copied

Hi David

Thanks for your instructions, I followed them and added a column to the far right of my members details page which is working well and adding the text Update and created a hyperlink to this text as you instructed me the href link ended up like this <td><strong><a href="update_members.php?<?php echo $row_rsUpdate_MembersDetails['Member_Id']; ?>=">Update</a></a></a></strong></td>. I tested it in my browser as you sugested and got the following URL http://localhost/fidc/update_members.php?= and no Member_Id number which should of come up.
it doesnt seem to be picking this up from the admin_members detail page. My record set rsUpdate_members has a URL parameter filter using Member_Id must = Member_Id which is the primary key. I also put a hidden field in my update form and assigned Member_Id to its value.

I dont really quite understand what you ment bymake sure the primary key gets its value from the hidden field in the form.

Consiquently no data shows up in the update form.

I must be doing someting wrong, I have attached the to files involved may be this might give you a clue on whats going on here.

Cheers
Mark

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 23, 2009 Mar 23, 2009

Copy link to clipboard

Copied

burkeslaw wrote:
> I must be doing someting wrong, I have attached the to files involved may be
> this might give you a clue on whats going on here.

Your files are so long, only part of the first one shows up in the news
server. However, it's obvious to me that you're making the classic
beginner's mistake of adding new server behaviors to your page without
understanding the underlying code or how to remove a server behavior
that's no longer required. (Don't worry, I did the same with Dreamweaver
UltraDev and ASP many years ago.)

The problem is that you have a complete mishmash of code in there. To
start off with, you have an update and a delete server behavior on the
same page. As a result, the record will be updated and deleted in the
same operation! You're also creating a recordset of all results on the
same page as the update server behavior.

Sorry, your page is such a complete mess that you need to start again.

As I said before, one page lists all records. You need two completely
separate pages for the update and delete operations. On the update page,
you need to make sure that the column that contains the primary key gets
its value from the hidden field by selecting the id in the Columns field
of the Update Record dialog box, and making sure that the Value
drop-down is set to FORM.name_of_hidden_field. Dreamweaver should set
this automatically, but you just need to double check.

If you're struggling with using the PHP server behaviors, you might find
it useful to check out one of my Dreamweaver books. There are editions
for DW8, CS3, and CS4, which cover all the PHP server behaviors in great
detail. There's more information on my website (link in sig).

--
David Powers
Adobe Community Expert, Dreamweaver
http://foundationphp.com

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 23, 2009 Mar 23, 2009

Copy link to clipboard

Copied

Hi David

Thanks again for your help, I had a feeling that I have generated unwanted code. I have been copying and pasting recordsets from the update page. When you copy a recordset from another page does this put code into that page from what I can see it does. I have to agree I need to learn more about the individual server behaviours, I will take a look at your website.

I will start from scratch with my admin_members.php page which is my master members detail page, am i better to use the Master Detail Page Set for PHP, when I re create this page?

With the Update and Delete pages I created a form manually for these and put the hidden field in, binding it to the Members_Id, do I still Have to put this hidden field in if I have the primary key Members_Id in the top of my forms but as text only so it can not be changed by others, I saw the update wizard does this?

Thanks for your help
Mark

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2009 Mar 24, 2009

Copy link to clipboard

Copied

burkeslaw wrote:
> With the Update and Delete pages I created a form manually for these and put
> the hidden field in, binding it to the Members_Id, do I still Have to put this
> hidden field in if I have the primary key Members_Id in the top of my forms but
> as text only so it can not be changed by others, I saw the update wizard does
> this?

No, you don't need a hidden field if the primary key is in the form as
text only. I use a hidden field because I don't normally want to display
the primary key, but either method is fine.

--
David Powers
Adobe Community Expert, Dreamweaver
http://foundationphp.com

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 26, 2009 Mar 26, 2009

Copy link to clipboard

Copied

Hi David

I have done what you said, and recreated the members_details page, added extra columns one before the Members_ID for delete records link and one for update records after the last field column at the end of the table.
I created a hyperlink using youir method using the paramenter box in the select file dialog and tested using localhost the URL it returns is the following; http://localhost/fidc/members_admin.php?5=, instead of http://localhost/fidc/update_membersdetails.php?=5.

I believe this is because when I created the hyperlink it is pointing to the recordset rsMembers_Details which is the recordset for the main members details page and not the update page recordset, I then change this to the update record set in the hyperlink code to this update_members.php?<?php echo $row_rsUpdate_MembersDetails['Member_Id']; ?>=. When I test this in localhost the URL returned when you mouse over the link is the following
http://localhost/fidc/update_membersdetails.php?=, it doesnt return the Members_Id and opens the Update_ Members form with no records

Is this because I havent got the recordset for the update page rsUpdate_MembersDetails in the server behaviours for members_details.php page?

I hope this is the case , because I just cant seem to get this members detail page to open the correct members details for updating or deleting, when you click the update link. Otherwise what am I doing wrong?

Cheers
Mark

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 27, 2009 Mar 27, 2009

Copy link to clipboard

Copied

LATEST
burkeslaw wrote:
> I created a hyperlink using youir method using the paramenter box in the
> select file dialog and tested using localhost the URL it returns is the
> following; http://localhost/fidc/members_admin.php?5=, instead of
> http://localhost/fidc/update_membersdetails.php?=5.

Read my instructions again:

4. In the Name field of the Parameters dialog box, type the name of the
primary key (ID).
5. Click the lightning bolt icon to the right of the Value field, and
select the primary key from the recordset.

What you should be seeing in the URL is
http://localhost/fidc/update_membersdetails.php?Member_Id=5

--
David Powers
Adobe Community Expert, Dreamweaver
http://foundationphp.com

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 23, 2009 Mar 23, 2009

Copy link to clipboard

Copied


> burkeslaw wrote:
>> Is it that I have to create the update form manually and then select it
>> and add the update form behaviour? Is there an Go to Detailed Page server
>> behaviour for php, or is this just for ASP technology.

DW does not come with a "go to detail page" SB for PHP, but there is one out
there that you can grab for PHP. You can find it at www.felixone.it
(although I'm having trouble reaching that site this a.m.)... look for the
PHP Missing Tools extension.


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 23, 2009 Mar 23, 2009

Copy link to clipboard

Copied

Hi Elliott

I will chech this site out, thanks, I have down loaded this extention from the behviour extensions downloads at Adobe's website it was freeware. It was created in 2002 for MX but apparently works with CS3, havent had a real chance to chech it out yet.

I used Davids way, which uses the parameters button in the select file dialog box. David explains it very well in one of his aswers to my problems.

Cheers
Mark

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines