Get ready for BLACK FRIDAY shopping starting in

Forums

PHP

This topic is locked

Update/Delete Records help!

Posted 29 Jan 2006 22:48:54
1
has voted
29 Jan 2006 22:48:54 B D posted:
I've been using Dreamweaver for about 3 years but am just getting into PHP and here's where I'm stuck:

I'm just barely understanding the concept of passing the URL parameter from one page to another and can't seem to find a more comprehensive explanation anywhere.

I have a mysql db with one table and a "news.php" page that displays all of that tables records (except the id). I can't figure out how to have a dynamic link created per each entry that takes the user to a separate update page, "edit.php" (or delete for that matter) and my confusion is in the URL parameter's role. The dreamweaver help files seem to be too vague to be entirely applicable.

Can somebody please explain how to create a link on the "news.php" page that simultaneously takes the user to "edit.php" while telling "edit.php" what record is to be updated?


thanks!
brando

Replies

Replied 01 Feb 2006 10:01:23
01 Feb 2006 10:01:23 Simon Zielonka replied:
Hi Brandon.

From what I understand from your post, you need a link per record on the news.php page. This link will then take you to the edit.php page where that record can be edited. Right?

If that is the case, then you need a link on each record to point to something like

edit.php?newsID=<?php echo $row_recordsetname[newsitemID]?>

where 'recordsetname' is the name of your recordset on your news page
and 'newsitemID' is the record ID in your recordset (usually your primary key)

When you create your recordset for edit.php, you will have to get the recordset to look for the itemID in the URL. (in this example it is identified by the ?newsID= of the dynamic link above. So, create a recordet on edit.php, select your database, tables and fields, and then in the filter box, select recordID(your primary key), then =, then URL Parameter, then newsID. Ignore the sort.

This will then pick up your URL dynamic parameter, and the recordet will be populated with the appropriate record.

I hope this helps.

Simon
Replied 01 Feb 2006 18:50:10
01 Feb 2006 18:50:10 B D replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
where 'recordsetname' is the name of your recordset on your news page
and 'newsitemID' is the record ID in your recordset (usually your primary key)
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

This is EXACTLY what I was confused about but now it makes sense to me. Thank you Simon. I'll repost if I still have a problem with it later thanks!!

DMX | PHP | SQL
Replied 02 Feb 2006 06:37:56
02 Feb 2006 06:37:56 B D replied:
ah yes..it worked. when I get the chance I'll post on here a little more detail about it to help others, but for now it worked! thanks Simon.

brando

DMX | PHP | SQL
Replied 24 Feb 2006 22:41:14
24 Feb 2006 22:41:14 Ann Thomas replied:
A really good Blog tutorial can be found at www.macromedia.com/devnet/dreamweaver/articles/php_blog1 (hope thats the right address cos I'm reading it from my printed copy). Its helped me understand the dynamic concept no end. Another good thing about it is that there are several advanced stages to go through - from basic to complex.

Ann

Replied 24 Feb 2006 22:42:58
24 Feb 2006 22:42:58 Ann Thomas replied:
Replied 27 Oct 2007 14:54:38
27 Oct 2007 14:54:38 R D replied:
Hi, i ve got this problem but i need it in asp .
pls someone help me on this

Reply to this topic