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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Help hiding some content when not enough records in query

Thread began 11/17/2015 2:45 pm by iain331081 | Last modified 11/19/2015 5:12 pm by Ray Borduin | 418 views | 8 replies |

iain331081

Help hiding some content when not enough records in query

I have a page using mysql_data_seek in order to return different records on different parts of the page.

I have it set to hide the first record where no records are in the query, but am having trouble getting it to hide content (non dynamic) where there are no records.

Link and details below...

Sign in to reply to this post

Ray BorduinWebAssist

link and details are missing

Sign in to reply to this post

iain331081

Hi Ray - you're too quick! While I was looking at it, I spotted something else, which I think I've now figured out what it was.

I'll post those details in a few minutes.

Sign in to reply to this post

Ray BorduinWebAssist

You can use this around the div:

<?php if ($row_rsProductUpdates) { ?>

That will prevent the entire row from showing if there is no data in the table after the data seek

Sign in to reply to this post

iain331081

Thanks Ray - will have a look.

If there are two sections:

One to show the most recent news item, i.e. the first record in the query, and
One to show the next three most recent news items, i.e. record 2, 3 and 4.

Then will that hide the non dynamic text from the space for records 3 and 4, if the query contains two records?

Sign in to reply to this post

Ray BorduinWebAssist

Yes it should work... just put the code around the entire <div> you don't want displayed... basically everything inside the current FOR loop.

Sign in to reply to this post

iain331081

Haven't got that - might have that in the wrong place.

Have attached an updated copy of the page below.

With that line added at line 193 and <?php } ?> at line 255 to close it.

Sign in to reply to this post

Ray BorduinWebAssist

I don't see the code I told you to add... it should be right after this:

php:
<?php for($i=1;$i<=3;$i++) { ?> 

                        <?php  
                        mysql_data_seek
($rsProductUpdates$i); 
                        
$row_rsProductUpdates mysql_fetch_assoc($rsProductUpdates); 
                        
?>
<?php 
if ($row_rsProductUpdates) { ?>


and then close it right when you close the for loop like:

php:
<hr>

                        
                
                          <?php // I added this ?>
                          <?php // Show if recordset empty ?>
Sign in to reply to this post

iain331081

Thanks Ray - I just had it around the next <div> up. That's working great now.

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...