0

I am running a WHILE loop and pulling data from a mySQL database.

The source for the output looks something like as follows:

<li class='list-item'><a itemprop='url' href=/new-years-eve-gossip-bar><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 04:00:00:4:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/15-4-gossip-bar-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Gossip Bar & Restaurant</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>733 9th Avenue</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10019</span></div></h5><p itemprop='description' class='tagline'>Rated Best Bar In Times Square</p></strong><p itemprop='offers' class='price'>Starting at <b>$65 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/the-counter-times-square-new-years><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 01:00:00:1:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/5-4-the-counter-times-square-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>The Counter NYC</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>1451 Broadway</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Closest Venue To The Live Ball Drop</p></strong><p itemprop='offers' class='price'>Starting at <b>$195 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-dave-and-busters-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 01:00:00:1:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/7-4-dave-and-busters-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Dave and Busters</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>234 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Rated #1 NYC Mega-Entertainment Center in the Heart of Times Square</p></strong><p itemprop='offers' class='price'>Starting at <b>$65 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/times-square-family-pass><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 01:00:00:1:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/30-4-family-pass-times-square-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Times Square Family Pass</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>Times Square New York</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>The perfect ALL AGES option to be in Times Square with your Family and Friends</p></strong><p itemprop='offers' class='price'>Starting at <b>$95 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-ruby-tuesday><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 21:00:00T9:00PM><strong class='highlight'><b>December 31, 2013 at 9:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/6-4-ruby-tuesday-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Ruby Tuesday</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>585 7th Avenue</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Two-Level Restaurant Located 1 Block From The LIVE Ball Drop</p></strong><p itemprop='offers' class='price'>Starting at <b>$145 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-bowlmor-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 21:00:00T9:00PM><strong class='highlight'><b>December 31, 2013 at 9:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/13-4-bowlmor-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Bowlmor NYC</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>222 West 44th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Voted Best Entertainment Center For Times Square NYE 2014</p></strong><p itemprop='offers' class='price'>Starting at <b>$75 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-dallas-bbq><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 02:00:00:2:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/2-4-dallas-bbq-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Dallas BBQ</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>241 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>What better way to ring in the New Year than a slow cooked BBQ buffet!</p></strong><p itemprop='offers' class='price'>Starting at <b>$125 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-madame-tussauds><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/1-4-madame-tussauds-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Madame Tussauds NYC</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>234 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Biggest and Best Party in Times Square. Unique atmosphere and live attraction throughout the evening.</p></strong><p itemprop='offers' class='price'>Starting at <b>$85 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-amc-42-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/4-4-amc-42-times-square-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>AMC 42nd Street NYC</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>234 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Voted The #1 Party In Times Square with 6 Floors of Custom Nightclubs, Movies, Family Fun, and 7 Hour Open Bar!</p></strong><p itemprop='offers' class='price'>Starting at <b>$35 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-aspen-social-club><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 04:00:00:4:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/28-4-aspen-social-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Aspen Social</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>157 West 47th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Rated #1 Times Square's Most Fashionable NYC VIP Lounge for New Year's Eve 2014</p></strong><p itemprop='offers' class='price'>Starting at <b>$95 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-applebees-50th-street-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:30:00T7:30PM><strong class='highlight'><b>December 31, 2013 at 7:30PM</b></strong><meta itemprop='endDate' content=2014-01-01 00:00:00:12:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/19-4-applebees-50-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Applebee's 50th Street</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>205 West 50th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10019</span></div></h5><p itemprop='description' class='tagline'>Enjoy The Best Of Applebee's</p></strong><p itemprop='offers' class='price'>Starting at <b>$375 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-beer-authority><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 02:00:00:2:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/image_listing_315x215.jpg /><strong class='event-info'><h3 itemprop='name'>Beer Authority</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>300 West 40th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10018</span></div></h5><p itemprop='description' class='tagline'>Upscale Pub and Restaurant Right In The Heart of Times Square</p></strong><p itemprop='offers' class='price'>Starting at <b>$0 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-lucky-chengs-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:30:00T8:30PM><strong class='highlight'><b>December 31, 2013 at 8:30PM</b></strong><meta itemprop='endDate' content=2014-01-01 02:00:00:2:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/10-4-lucky-chengs-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Lucky Cheng's</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>240 West 52nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10019</span></div></h5><p itemprop='description' class='tagline'>Dance The Night Away At This Times Square Hot Spot</p></strong><p itemprop='offers' class='price'>Starting at <b>$75 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-chevys-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/3-4-chevys-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Chevy's NYC</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>259 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Voted Wildest Times Square Fiesta At Chevys NYE 2014</p></strong><p itemprop='offers' class='price'>Starting at <b>$55 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/times-square-all-access-pass><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/29-4-balldrop-pass-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>BallDrop Pass</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>Times Square NYC</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Multiple Parties at top bars, lounges, and restaurants in and around Times Square...all for ONE price</p></strong><p itemprop='offers' class='price'>Starting at <b>$225 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-times-scare><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 21:00:00T9:00PM><strong class='highlight'><b>December 31, 2013 at 9:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 01:00:00:1:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/11-4-times-scare-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Times Scare</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>669 8th Avenue</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Rated Most Original NYE Experience</p></strong><p itemprop='offers' class='price'>Starting at <b>$85 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-cellar-bar><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 21:00:00T9:00PM><strong class='highlight'><b>December 31, 2013 at 9:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 04:00:00:4:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/14-4-cellar-bar-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Cellar Bar</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>40 West 40th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10018</span></div></h5><p itemprop='description' class='tagline'>Voted #1 Most Fashionable Hotel Lounge in Midtown</p></strong><p itemprop='offers' class='price'>Starting at <b>$85 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-planet-hollywood-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 01:00:00:1:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/26-4-planet-hollywood-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Planet Hollywood </h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>1540 Broadway</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Experience the magic of Hollywood right here in NYC on the biggest night of the year!</p></strong><p itemprop='offers' class='price'>Starting at <b>$195 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-ripleys-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 01:00:00:1:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/9-4-ripleys-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Ripley's Believe It Or Not</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>234 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Premiere NYC Attraction. Home To Over 500 Fun, Outrageous and Amazing Exhibits</p></strong><p itemprop='offers' class='price'>Starting at <b>$235 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-applebees-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:30:00T7:30PM><strong class='highlight'><b>December 31, 2013 at 7:30PM</b></strong><meta itemprop='endDate' content=2014-01-01 00:00:00:12:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/8-4-applebees-42-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Applebee's 42nd</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>234 West 42nd Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Enjoy The Best Of Applebee's</p></strong><p itemprop='offers' class='price'>Starting at <b>$375 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-penthouse-760><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 20:00:00T8:00PM><strong class='highlight'><b>December 31, 2013 at 8:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 04:00:00:4:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/46-4-penthouse-760-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Penthouse 760</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>760 Eighth Avenue</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>New Years Eve 2014 at Penthouse 760 in Times Square</p></strong><p itemprop='offers' class='price'>Starting at <b>$115 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-fashion-forty-lounge><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 04:00:00:4:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/12-4-fashion-40-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Fashion Forty Lounge</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>202 West 40th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10036</span></div></h5><p itemprop='description' class='tagline'>Rated Trendiest Lounge In Times Square</p></strong><p itemprop='offers' class='price'>Starting at <b>$65 </b></p></div></a></li><li class='list-item'><a itemprop='url' href=/new-years-eve-hurleys-times-square><div itemscope itemtype='http://schema.org/Event'><span datetime='startDate' content=2013-12-31 19:00:00T7:00PM><strong class='highlight'><b>December 31, 2013 at 7:00PM</b></strong><meta itemprop='endDate' content=2014-01-01 03:00:00:3:00AM><meta itemprop='duration' content='0000-00-00T07:00'><img itempromp='image' src=/images/venues/18-4-hurleys-nyc.jpg /><strong class='event-info'><h3 itemprop='name'>Hurley's</h3><h5><div itemscope itemtype='http://schema.org/PostalAddress'><span itemprop='streetAddress'>232 West 48th Street</span>, <span itemprop='addressRegion'>NY</span>, <span itemprop='postalCode'>10019</span></div></h5><p itemprop='description' class='tagline'>Rustic Irish Pub In Times Square</p></strong><p itemprop='offers' class='price'>Starting at <b>$85 </b></p></div></a></li>

This is all in one jarbled line of code. How do I separate the loop out, so everything is organized in the HTML sourcecode?

Here is the actual WHILE loop:

    while ($row = mysql_fetch_array($result))
    {
        // VARIABLES

        $image_list     = $row['image_listing_315x215'];
        $date           = $row['start_date'];
        $startDate      = convertDate ($date);
        $startTime      = convertTime ($date);
        $endDate        = $row['end_date'];
        $endTime        = convertTime($endDate);
        $venueName      = $row['venue_name'];
        $venueName2     = $row['alt_venue_name'];
        $eventTag       = $row['event_tag'];
        $eventBlurb     = $row['event_blurb'];
        $venueAddress   = $row['venue_address1'];
        $venueCity      = $row['city_name'];
        $venueState     = $row['state_abb'];
        $venueZip       = $row['zip'];
        $lowestTicket   = $row['ticket_lowest'];
        $url            = $row['event_url'];

        echo "<li class='list-item'>";
        echo "<a itemprop='url' href=".$url.">"; 
        echo "<div itemscope itemtype='http://schema.org/Event'>"; 
        echo "<meta content=".$venueName2." is ".$eventTag.">"; 
        echo "<meta itemprop='startDate' content=".$startDate."T".$startTime."Q><strong class='highlight'><b>".$startDate." from ".$startTime." to ".convertTime($endDate)." </b></strong>";
        echo "<meta itemprop='endDate' content=".$endDate.":".$endTime.">";
        echo "<meta itemprop='duration' content='0000-00-00T07:00'>";
        echo "<img itempromp='image' src=". DIR_IMAGES . $image_list ." />";
        echo "<strong class='event-info'>";
        echo "<h3 itemprop='name'>".$venueName."</h3>";
        echo "<h5>"; 
        echo "<div itemscope itemtype='http://schema.org/PostalAddress'>";
        echo "<span itemprop='streetAddress'>".$venueAddress."</span>, "; 
        echo "<meta itemprop='addressLocality' content=".$venueCity.">";
        echo "<span itemprop='addressRegion'>".$venueState."</span>, ";
        echo "<span itemprop='postalCode'>".$venueZip."</span>"; 
        echo "<meta itemprop='addressCountry' content='USA'></div>";
        echo "</h5>";
        echo "<p itemprop='description' class='tagline'>".$eventBlurb."</p>";
        echo "</strong>";
        echo "<p itemprop='offers' class='price'>Starting at <b>$".$lowestTicket."</b></p>";
        echo "</div>";
        echo "</a>";
        echo "</li>";

    }
6
  • 6
    Add tabs and newlines in your loop. Commented Oct 6, 2013 at 22:29
  • if you notice in the sample code above, it is displaying 1 continuous line...that is how it is basically displaying in the source...as one massive long line of code. Commented Oct 6, 2013 at 22:34
  • If it's only for your better readability, did you know that you can use code inspectors like firebug or the chrome developer mode (hit F12) to have a clean view on the code? Commented Oct 6, 2013 at 22:45
  • No I am trying to resolve for crawling purposes. I assume if all of this chunk of code is being viewing as 1 line, then it will create an issue when trying to generate rich snippets and what not. There is 100+ lines of code all being viewed as 1-line. My goal is to separate it out. Commented Oct 6, 2013 at 22:48
  • Is only the output from this while-loop put into one line, or the whole website code in total? Commented Oct 6, 2013 at 22:53

3 Answers 3

1

if you echo "\n" it will introduce a line break.

Sign up to request clarification or add additional context in comments.

4 Comments

I have tried both adding <br/> and \n within the loop and nothing happens. It is literally this massive chunk of code generated and display as line #621 [this chunk of code] and then when the loop ends, goes to #622. I hope I am explaining it where everyone can understand what the issue is...
This is the correct answers. <br /> will create a newline in the markup, and \n will create a newline in the source-code.
so I will add \n inside the while loop at the end of the code before?
@user2763616 - Add \n at the end of every echo-line to introduce a new linebreak at the point.
1

Add \n to each line in your code, e.g. like this

echo "<h5>"."\n";

Be aware that adding \n only works, if you use double quotation marks.

echo "\n"; // Adds a linebreak
echo '\n'; // Does not add a linebreak

3 Comments

I tried to implement and nothing happened. The same output is taking place.
I tried implementing as follows: echo "<li class='list-item'>"."\n"; and it did not work
That is correct implementation. Can you post both, code and HTML result anywhere like pastebin (pastebin.com)?
1

Another way to create organized output:

while ($row = mysql_fetch_array($result))
{
    // VARIABLES

    $image_list     = $row['image_listing_315x215'];
    $date           = $row['start_date'];
    $startDate      = convertDate ($date);
    $startTime      = convertTime ($date);
    $endDate        = $row['end_date'];
    $endTime        = convertTime($endDate);
    $venueName      = $row['venue_name'];
    $venueName2     = $row['alt_venue_name'];
    $eventTag       = $row['event_tag'];
    $eventBlurb     = $row['event_blurb'];
    $venueAddress   = $row['venue_address1'];
    $venueCity      = $row['city_name'];
    $venueState     = $row['state_abb'];
    $venueZip       = $row['zip'];
    $lowestTicket   = $row['ticket_lowest'];
    $url            = $row['event_url'];

    ?> 
        <li class='list-item'>
            <a itemprop='url' href=<?php echo $url; ?>> 
                <div itemscope itemtype='http://schema.org/Event'> 
                    <meta content=<?php echo $venueName2; ?> is <?php echo $eventTag; ?>> 
                    <meta itemprop='startDate' content=<?php echo $startDate; ?>T<?php echo $startTime; ?>Q>
                    <strong class='highlight'>
                        <b><?php echo $startDate; ?> from <?php echo $startTime; ?> to <?php echo convertTime($endDate); ?> </b>
                    </strong>
                    <meta itemprop='endDate' content=<?php echo $endDate; ?>:<?php echo $endTime; ?>>
                    <meta itemprop='duration' content='0000-00-00T07:00'>
                    <img itempromp='image' src=<?php echo DIR_IMAGES . $image_list ; ?> />
                    <strong class='event-info'>
                        <h3 itemprop='name'><?php echo $venueName; ?></h3>
                        <h5> 
                            <div itemscope itemtype='http://schema.org/PostalAddress'>
                                <span itemprop='streetAddress'><?php echo $venueAddress; ?></span>,  
                                <meta itemprop='addressLocality' content=<?php echo $venueCity; ?>>
                                <span itemprop='addressRegion'><?php echo $venueState; ?></span>, 
                                <span itemprop='postalCode'><?php echo $venueZip; ?></span> 
                                <meta itemprop='addressCountry' content='USA'>
                            </div>
                        </h5>
                        <p itemprop='description' class='tagline'><?php echo $eventBlurb; ?></p>
                    </strong>
                    <p itemprop='offers' class='price'>Starting at <b>$<?php echo $lowestTicket; ?></b></p>
                </div>
            </a>
        </li>

    <?php } 

By the way, the offers property must be Offer not the Starting at $***.

10 Comments

This is supposed to generate multiple listings from the loop. So if the <li> is after then it wont create the multiple listings, no?
<li> . . . </li> will be created for every row from DB, because it is inside while ($row = mysql_fetch_array($result)) loop.
In whole, this is the same behavior you have right now, just added some formatting to output.
This code set worked, but did not fix the chunk of code issue...it still is displaying all of the code in 1 line
Have you ob_start(), ob_get_contents(), ob_end_flush() in your code? Is your code is a part of some framework? Was this PHP file called directly or it was included in another file (which may contains output buffering functions), have you any include or requre calls in this file?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.