close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

create variable for Record ID and send in URL

Thread began 9/05/2010 12:26 pm by neilo | Last modified 9/06/2010 1:50 pm by neilo | 1281 views | 8 replies |

neilo

create variable for Record ID and send in URL

As you well know, I have the ability to look at a page full of PHP code, and within just a few seconds, come up with a recipe for lemon-drizzle cake. I need help to do this simple procedure:

I have done a couple of sites that have a 'Quick Links' area which draws its content from a database (here and here)

On the page I have a recordset (calendar).

I have a repeating region containing the dynamic text drawn from the recordset, therefore I have (once the HTML is stripped out) the following, which is all OK:

<?php echo date('jS F Y',strtotime($row_calendar['event_begin'])); ?>
<?php echo date('g:ia',strtotime($row_calendar['event_time'])); ?>
<?php echo $row_calendar['event_title']; ?>
<?php echo $row_calendar['event_short']; ?>

I need to add in to the repeating region a value for event_id from the recordset (hidden) as a variable that I can carry forward in a URL to another page, so that I can do a SELECT FROM using that ID on the new page.

The simple aim is to have a 'more . . . ' link for each record in the repeating region that links to a page with full details of that particular event.

Please could someone baby-step me through this apparently simple procedure?

Thanks

Sign in to reply to this post

John LangerBeta Tester

Hi Neilo,

Jason and I answered a similar request only the other day here.

If that doesn't do it, post back. I'm actually off on holiday now for a week but I'm sure someone will pick up on it.

Sign in to reply to this post

neilo

Hi John,

Yes - that is exactly what I needed!

Many thanks, and have a great holiday,

best,

Sign in to reply to this post

neilo

I can't seem to get this working. Both sets of instruction given were very clear, and I'm convinced all is entered correctly.

The link is this:

<a href="eventInfo.php?id=<?php echo $row_calendar['event_id']; ?>">more . . .</a>

There is currently only one record, so the link directs correctly to the page with the query string in the URL ( eventInfo.php?id=1)

That (detail) page - eventInfo.php - has the recordset properly added, filtering by event_id (which is the unique auto-incrementing primary key) equal to 'URL', and populating the box next to it correctly with event_id. (Image: recordset.jpg)

When I press the 'Test' button (CS5) i get the message asking me to provide a test value for the URL Parameter: event_id. I enter the Test value 1 (the only record) and the test succeeds and shows me the correct data for that query. (Image: Test_SQL_Statement.jpg)

Howevr, when I click the 'more . . .' link from the home page, I get to a blank 'detail' page, with no record pulled from the database.

I hope someone may be able to throw some light on this.

Thanks.

P.S - I'm also getting an error message at the bottom of the page, if I use a template page with the 'Quick Links' include on the page:

Warning: mysql_free_result(): 17 is not a valid MySQL result resource in /home/users/uks45031/html/katelissauer.com/eventInfo.php on line 185.
(I don't know what the '17' is about)

If I create a 'detail' page from a blank .php page, I don't get that error, but I still don't get a record returned.

Sign in to reply to this post

neilo

Doh!

I'd put 'php?id=' instead of 'php?event_id='. What an idiot.

I still have the error message at the bottom of the page, though. Can I just delete the mysql_free_result php block to make the error go away, or will that cause problems?

Am also getting a character encoding glitch, with the £ sign and apostrophes being represented by the &#65533; symbol.

You can see the effect by clicking the 'more . . . ' link in the 'Quick Links' area HERE

If anyone has any ideas about the encoding or the 'mysql_free_results' glitches, I'd appreciate your thoughts.

Sign in to reply to this post

Dave BuchholzBeta Tester

this error

Warning: mysql_free_result(): 17 is not a valid MySQL result resource in /home/users/uks45031/html/katelissauer.com/eventInfo.php on line 185



is caused by the fact there is no recordset code on the page created from the template I suspect but without seeing the actual files it is difficult to be certain

  Am also getting a character encoding glitch, with the £ sign and apostrophes being represented by the &#65533; symbol.  



try using the html entity equivalents, there is a great list here

Sign in to reply to this post

neilo

Hi Dave,

Thanks for the link to the 'entities' page - that is a really complete and useful resource.

I do have the recordset code on the page, though. I am thinking now that the error might be caused because the 'Quick Link' include page has a 'mysql_free_results' php block at the bottom of the page, so that when this appears at the bottom of the detail page as well, the browser reads two such blocks of code when it only needs one (i.e. it acts on one, then gets the same request again). Could that be why I get the error?

Thanks

Sign in to reply to this post

Dave BuchholzBeta Tester

yes you only need one block of that code

Sign in to reply to this post

neilo

Thanks Dave,

I have removed the duplicate, and all works well.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...