close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


alternating background div

Thread began 6/14/2021 2:01 pm by JBWebWorks | Last modified 6/14/2021 7:34 pm by Ray Borduin | 88 views | 2 replies |


alternating background div

Have mysqli repeat region for a div#eventsdiv. here is code

$wa_startindex = 0;
while(!$rs_events->atEnd()) {
$wa_startindex = $rs_events->Index;
<div id="eventsdiv" align="center"><?php /*START_PHP_SIRFCIT*/ if ($rs_events->getColumnVal("events_photo")!=""){ ?><img width="20%" src="images/events/<?php echo($rs_events->getColumnVal("events_photo")); ?>" /><?php } else echo''; /*END_PHP_SIRFCIT*/ ?> <br />
<h2><?php echo($rs_events->getColumnVal("events_name")); ?></h2>
<table width="60%" border="1" cellpadding="10"><tr><td width="50%" align="center" valign="top"><?php echo($rs_events->getColumnVal("events_time")); ?></td><td width="50%" align="center" valign="top"><?php echo($rs_events->getColumnVal("events_location")); ?></td></tr></table><br />
<div id="eventdescribe"><?php echo($rs_events->getColumnVal("events_description",false)); ?></div><br />
<br /><br />

$rs_events->moveFirst(); //return RS to first record

Want the divs to alternate background color from #76323f to #d7cec7

What code do i need to add?

Sign in to reply to this post

Ray BorduinWebAssist

You could wrap it all in a div like:

<div id="altbg">
[your repeat code here]

Then use CSS like:
#altbg div:nth-child(even) {background: #76323f}
#altbg div:nth-child(odd) {background: #d7cec7}

Sign in to reply to this post
Did this help? Tips are appreciated...


That worked. Thanks Ray.

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





Ease of use


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