Forums
This topic is locked
recordset will not update table
Posted 29 May 2008 19:41:40
1
has voted
29 May 2008 19:41:40 john henderson posted:
Hi all,I wonder if anyone can give me some directions please <img src=../images/dmxzone/forum/icon_smile_blush.gif border=0 align=middle>.
I have a web page that contains 2 frames, a top and a bottom frame. they are linked to a mysql database using php.
The top frame allows you to search and display a list of addresses. The bottom frame displays a list of payments.
By selecting the property number in the top list, which is a link a further list is displayed in the bottom frame.
This bottom list contains numerous payment details associated with each of the above property numbers.
I have managed to get everything to work except the update?
When an individual payment is selected as there can be more than one. I need to be able to update each individual record.
The way I have things set up, the only record being updated is the very first one. When I attempt to update any of the other records I still see the URL updating record 1.
This is the sql code that I am using in my recordset
SELECT *
FROM payments
WHERE customerid = colname OR paymentid = colname2
ORDER BY datecreated DESC
The customerid = colname always works but I know that I need the paymentid to update the individual payments.
If you need any more info I can happily expand
john
Replies
Replied 30 May 2008 11:26:30
30 May 2008 11:26:30 Alan C replied:
Hi John,
I don't know if I'll be able to solve this or not, but could use a bit more information - that might get other responses too.
I guess people select the payment in the lower frame, by updating a textbox with an amount (?) and could update several, then click an update button - if that how it should work?
Then the server receives all the textboxes and processes them and it's at this point that it should update all the individual payment records (or only those that have changed)
If that's it, then it could be something to do with identifying the changed records, if there is a loop it could be that it only executes once.
Can you expand a little on the how things are working?
I don't know if I'll be able to solve this or not, but could use a bit more information - that might get other responses too.
I guess people select the payment in the lower frame, by updating a textbox with an amount (?) and could update several, then click an update button - if that how it should work?
Then the server receives all the textboxes and processes them and it's at this point that it should update all the individual payment records (or only those that have changed)
If that's it, then it could be something to do with identifying the changed records, if there is a loop it could be that it only executes once.
Can you expand a little on the how things are working?
Replied 01 Jun 2008 17:26:45
01 Jun 2008 17:26:45 john henderson replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hi John,
I don't know if I'll be able to solve this or not, but could use a bit more information - that might get other responses too.
I guess people select the payment in the lower frame, by updating a textbox with an amount (?) and could update several, then click an update button - if that how it should work?
Then the server receives all the textboxes and processes them and it's at this point that it should update all the individual payment records (or only those that have changed)
If that's it, then it could be something to do with identifying the changed records, if there is a loop it could be that it only executes once.
Can you expand a little on the how things are working?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Hi Alan,
My first chance to get back to work and solve this problem. It might be easier if I show you what I mean. I have put up a temporary web site, so with a bit of luck you can see what I mean. The web site has been designed soley for mobile operators.
www.midas.horandesigns.net/m_login.php
name = chris horan
password = 3333
Now click on the link called 'Search'
this is the page in question, which has a top frame and a bottom frame.
You can type the following in the search box "week1 bolton blen" this will ensure that specific records are displayed
Select the property link number '12'
Now you can see the list that displays all the payments relating to property No 12
as you can see the link on the left displays the record number when you hover the mouse pointer over it.
The button on the right should update the individual record, but this is tied into the customerid no and always shows record number 1.
Hope that helps you a bit Alan
looking forward to your reply
john
Hi John,
I don't know if I'll be able to solve this or not, but could use a bit more information - that might get other responses too.
I guess people select the payment in the lower frame, by updating a textbox with an amount (?) and could update several, then click an update button - if that how it should work?
Then the server receives all the textboxes and processes them and it's at this point that it should update all the individual payment records (or only those that have changed)
If that's it, then it could be something to do with identifying the changed records, if there is a loop it could be that it only executes once.
Can you expand a little on the how things are working?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Hi Alan,
My first chance to get back to work and solve this problem. It might be easier if I show you what I mean. I have put up a temporary web site, so with a bit of luck you can see what I mean. The web site has been designed soley for mobile operators.
www.midas.horandesigns.net/m_login.php
name = chris horan
password = 3333
Now click on the link called 'Search'
this is the page in question, which has a top frame and a bottom frame.
You can type the following in the search box "week1 bolton blen" this will ensure that specific records are displayed
Select the property link number '12'
Now you can see the list that displays all the payments relating to property No 12
as you can see the link on the left displays the record number when you hover the mouse pointer over it.
The button on the right should update the individual record, but this is tied into the customerid no and always shows record number 1.
Hope that helps you a bit Alan
looking forward to your reply
john
Replied 02 Jun 2008 13:51:55
02 Jun 2008 13:51:55 Alan C replied:
Hi John,
That was really helpful, nice bit of design you have there, I like the method - I see what is happening, on each line when the code generates the submit button it always generates the same 'value'
when you have a submit button it takes the form type="submit" value="a value" when that arrives back at the server after the user has clicked the submit button the value goes into the $_POST array and can be accessed as $POST_['submit'] which means you can test it, there is a good explanation here
<pre id=code><font face=courier size=2 id=code> articles.techrepublic.com.com/5100-10878_11-5242116.html</font id=code></pre id=code>
so what you need to do it to have a different submit button for each table row, the appropriate lines in your html are . . .
<pre id=code><font face=courier size=2 id=code> <td nowrap="nowrap"><a href="bottomhistorysearch.php?paymentid=35">2008-05-27 16:37:21 </a><a href="35"></a><a href="35">
. . . .
<td nowrap="nowrap"><input type="submit" name="Update" id="Update" value="Update Payment Details" /></td>
</font id=code></pre id=code>
in your php you will have something that echos the paymentid by setting it to 35, you need to duplicate that as the value of the submit button, then when the form input is processed you can look in the post array and you will find the appropriate number.
While I'm talking, have you considered the security aspects of this? What happens if some unscrupulous person sends different values back - you might consider passing things via the session array, or instead of using the actual id, like 35, passing it as an encrypted value which you could test - just a thought <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
That was really helpful, nice bit of design you have there, I like the method - I see what is happening, on each line when the code generates the submit button it always generates the same 'value'
when you have a submit button it takes the form type="submit" value="a value" when that arrives back at the server after the user has clicked the submit button the value goes into the $_POST array and can be accessed as $POST_['submit'] which means you can test it, there is a good explanation here
<pre id=code><font face=courier size=2 id=code> articles.techrepublic.com.com/5100-10878_11-5242116.html</font id=code></pre id=code>
so what you need to do it to have a different submit button for each table row, the appropriate lines in your html are . . .
<pre id=code><font face=courier size=2 id=code> <td nowrap="nowrap"><a href="bottomhistorysearch.php?paymentid=35">2008-05-27 16:37:21 </a><a href="35"></a><a href="35">
. . . .
<td nowrap="nowrap"><input type="submit" name="Update" id="Update" value="Update Payment Details" /></td>
</font id=code></pre id=code>
in your php you will have something that echos the paymentid by setting it to 35, you need to duplicate that as the value of the submit button, then when the form input is processed you can look in the post array and you will find the appropriate number.
While I'm talking, have you considered the security aspects of this? What happens if some unscrupulous person sends different values back - you might consider passing things via the session array, or instead of using the actual id, like 35, passing it as an encrypted value which you could test - just a thought <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 02 Jun 2008 19:06:36
02 Jun 2008 19:06:36 john henderson replied:
Thanks for the feedback Alan <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Just got back from a meeting in Leeds. Will sit down and go through your notes tomorrow. Hopefully will have time to sit down and take
in your feedback.
Once again thanks
john
p.s no doubt you will hear from me again
Just got back from a meeting in Leeds. Will sit down and go through your notes tomorrow. Hopefully will have time to sit down and take
in your feedback.
Once again thanks
john
p.s no doubt you will hear from me again