problem combining multi and single record

7 posts by 2 authors in: Forums > CMS Builder
Last Post: March 13, 2011   (RSS)

By yusuke - March 8, 2011

I made a file combining a multi and a single record. There is something very strange happening. An URL's record number and actual displaying record number does not match.

1) Please take a look at the below page and click on one of the Users' link except for User: cmsf4.

http://keep-stock-p.com/verjp/index.php

2) Click on "COMMENT".

The filename shows, for example, shopDetail.php?5 and it should display num: 5, instead, it displays num: 3.

Please help!
Attachments:

comment.php 6K

Re: [yusuke] problem combining multi and single record

By Jason - March 8, 2011

Hi,

I took a look and I wasn't able to recreate the issue.

For example:

http://keep-stock-p.com/verjp/shopDetail.php?5

displays a num of 5, which is what we would expect.

Can you give me some more information about this issue?

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] problem combining multi and single record

By yusuke - March 8, 2011

Hi Jason,

Sure, it first displays the correct num when opening the link.
The problem occurs "after" clicking the "COMMENT" link.

Will you please try it again?

FYI: clicking "COMMENT" link again will fix the issue.

Re: [yusuke] problem combining multi and single record

By Jason - March 9, 2011

Hi,

I think the problem is you where using getNumberFromEndOfUrl(). This would get the 5 and put it in your where clause. Try replacing it with whereRecordNumberInUrl() like this:


list($accountsRecords, $accountsMetaData) = getRecords(array(
'tableName' => 'accounts',
'where' => whereRecordNumberInUrl(),
'limit' => '1',
'allowSearch' => '0',
));
$accountsRecord = @$accountsRecords[0]; // get first record


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] problem combining multi and single record

By yusuke - March 10, 2011 - edited: March 10, 2011

Hi Jason,

Thank you so much the answer.
It fixed the existing problem however created another problem.

Please take a look and follow the steps to view the problem.

1) Open the below URL
http://keep-stock-p.com/verjp/comment.php?3

2) Click on the "Next >>" button

3) It should keep the same ACCOUNT-Detail since the COMMENT-List applies to the ACCOUNT-Detail of the previous page BUT it doesn't.

Please Help.

Re: [yusuke] problem combining multi and single record

By Jason - March 11, 2011

Hi,

What's happening is that the page number is appearing at the end of your URL, so it's being used as the next user number.

There are a couple of ways of getting around this. Probably the best would be to output your own next/previous page link and giving your user number a variable name instead of just the number. You can rearrange the variables so that the user number appears at the end of the URL. What's we're looking for is a URL like this:

http://keep-stock-p.com/verjp/comment.php?page=3&user=3

For example, you could create your Next link like this:

<?php if ($kuchikomiMetaData['nextPage']): ?>
<a href="?page=<?php echo $kuchikomiMetaData['nextPage'];?>&user=<?php echo $accountsRecord['num'];?> ">Next &raquo;</a>
<?php else: ?>
Next &raquo;
<?php endif ?>


Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/