Help with the Limit / Offset commands

I need to output results of my query starting with the 2nd row. I’ve tried the limit command but it returned an error.

Here is the live link:
http://www.johndc.com/events/shows2.php

and here is the code without any limit commands. Could anyone let me know the proper place to put the Limit command (or if there is another way to start with the 2nd row of data)? Thanks soooo much in advance. ~John

[php]<?php

// Connect to the database server
include_once ‘pw.inc.php’;

$today = date(“Y-m-d”);
$timestamp = strtotime("-6 days",strtotime($today));
$mynewdate = strftime("%Y-%m-%d",$timestamp);
$event_count=‘1’;

$showlist = mysql_query ('SELECT show_id, venue_id, artist_id, show_time, start_hour, start_minute, start_meridian, show_note, entry_date, show_date, date_format(show_date, “%W, %M %D”) as show_date1, venue_name, venue_address, venue_city, venue_zip, venue_state, venue_phone, venue_url, artist_name, artist_url, artist_mp3, artist_pic

from

showlister_shows, showlister_venue, showlister_artists

where

venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=1 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=3 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=6 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=35 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=58 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=55 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=391 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=480 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=458 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=486 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=603 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=605 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=678 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=741 or
venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=526

order by show_date, start_hour’) ;

if (!$showlist) {
exit('

Error performing query: ’ . mysql_error() . ‘

’);
}

while ($show = mysql_fetch_array($showlist)) {
$showid = $show[‘show_id’];
$showtime = $show[‘show_time’];
$starthour = $show[‘start_hour’];
$startminute = $show[‘start_minute’];
$startmeridian = $show[‘start_meridian’];
$showdate0 = $show[‘show_date’];
$showdate = $show[‘show_date1’];
$entrydate = $show[‘entry_date’];
$artistid = $show[‘artist_id’];
$address1 = $show[‘venue_address’];
$city = $show[‘venue_city’];
$state = $show[‘venue_state’];
$venuename = $show[‘venue_name’];
$venuezip = $show[‘venue_zip’];
$artistname = $show[‘artist_name’];
$artisturl = $show[‘artist_url’];
$artistmp3 = $show[‘artist_mp3’];
$artistpic = $show[‘artist_pic’];
$venueid = $show[‘venue_id’];
$venuephone = $show[‘venue_phone’];
$venueurl = $show[‘venue_url’];
$shownote = $show[‘show_note’];
$address2 = “$address1”;
$google0 = str_replace(" “, “+”, $address2);
$google = str_replace(”.", “”, $google0);
$startminute1 = “:$startminute”;
$address = “$address1,”;

if ($startminute1==’:0’) {
$startminute1=’’;
}

if ($starthour>‘12’) {
$starthour=$starthour-12;
}

if ($showdate0 >= $today and $entrydate >= $mynewdate and !$shownote and ($event_count >= 1) and $artistmp3) {

     // echo shows in current month, today and later

echo "


$artistname @ $venuename
$showdate $address $city $state $venuephone
$starthour$startminute1 $startmeridian
";

$event_count++;

}

//Original Code

if ($showdate0 >= $today and $entrydate < $mynewdate and !$shownote and ($event_count >= 1) and $artistmp3) {

     // echo shows in current month, today and later

echo "


$showdate $artistname @ $venuename
$starthour$startminute1 $startmeridian $address $city $state $venuephone
";

$event_count++;

}

if ($showdate0 >= $today and !$shownote and ($event_count >= 1) and !$artistmp3) {

     // echo shows in current month, today and later

echo "


$showdate $artistname @ $venuename
$starthour$startminute1 $startmeridian $address $city $state $venuephone
";

$event_count++;

}

if ($showdate0 >= $today and $shownote == ‘Acoustic Duo’ and ($event_count >= 1) and $artistmp3

) {
// echo shows in current month, today and later

echo "


$showdate $artistname @ $venuename
$starthour$startminute1 $startmeridian $address $city $state $venuephone
Acoustic Duo (Ed & John)
";

$event_count++;

}

if ($showdate0 >= $today and $shownote == ‘Acoustic Duo’ and ($event_count >= 1) and !$artistmp3

) {
// echo shows in current month, today and later

echo "


$showdate $artistname @ $venuename
$starthour$startminute1 $startmeridian $address $city $state $venuephone
Acoustic Duo (Ed & John)
";

$event_count++;

}

// NEW CODE FOR NEW EVENT

if ($showdate0 >= $today and $entrydate >= $mynewdate and $shownote and $shownote != ‘Acoustic Duo’ and $shownote != ‘Ed will be hosting open mic!’ and $shownote != ‘Ed will be hosting open mic!’ and ($event_count >= 1) and $artistmp3

) {
// echo shows in current month, today and later ------

echo "


$artistname @ $venuename
$showdate $address $city $state $venuephone
$starthour$startminute1 $startmeridian $shownote
";

$event_count++;

}

// Original Code

if ($showdate0 >= $today and $entrydate < $mynewdate and $shownote and $shownote != ‘Acoustic Duo’ and $shownote != ‘Ed will be hosting open mic!’ and $shownote != ‘Ed will be hosting open mic!’ and ($event_count >= 1) and $artistmp3

) {
// echo shows in current month, today and later ------

echo "


$showdate $artistname @ $venuename
$starthour$startminute1 $startmeridian $address $city $state $venuephone
$shownote
";

$event_count++;

}

if ($showdate0 >= $today and $shownote and $shownote != ‘Acoustic Duo’ and $shownote != ‘Ed will be hosting open mic!’ and ($event_count >= 1) and !$artistmp3

) {
// echo shows in current month, today and later

echo "


$showdate $artistname @ $venuename
$starthour$startminute1 $startmeridian $address $city $state $venuephone
$shownote
";

$event_count++;

}

}

?>[/php]

You can do with LIMIT in sql, but if it’s 2nd ignore first results
[php]

<?php // Connect to the database server include_once 'pw.inc.php'; $today = date("Y-m-d"); $timestamp = strtotime("-6 days",strtotime($today)); $mynewdate = strftime("%Y-%m-%d",$timestamp); $event_count='1'; $showlist = mysql_query ('SELECT show_id, venue_id, artist_id, show_time, start_hour, start_minute, start_meridian, show_note, entry_date, show_date, date_format(show_date, "%W, %M %D") as show_date1, venue_name, venue_address, venue_city, venue_zip, venue_state, venue_phone, venue_url, artist_name, artist_url, artist_mp3, artist_pic from showlister_shows, showlister_venue, showlister_artists where venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=1 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=3 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=6 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=35 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=58 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=55 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=391 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=480 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=458 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=486 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=603 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=605 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=678 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=741 or venue_id=showlister_venue.id and artist_id=showlister_artists.id and artist_id=526 order by show_date, start_hour') ; if (!$showlist) { exit('

Error performing query: ' . mysql_error() . '

'); } $ignoredShow = mysql_fetch_array($showlist) while ($show = mysql_fetch_array($showlist)) { $showid = $show['show_id']; $showtime = $show['show_time']; $starthour = $show['start_hour']; $startminute = $show['start_minute']; $startmeridian = $show['start_meridian']; $showdate0 = $show['show_date']; $showdate = $show['show_date1']; $entrydate = $show['entry_date']; $artistid = $show['artist_id']; $address1 = $show['venue_address']; $city = $show['venue_city']; $state = $show['venue_state']; $venuename = $show['venue_name']; $venuezip = $show['venue_zip']; $artistname = $show['artist_name']; $artisturl = $show['artist_url']; $artistmp3 = $show['artist_mp3']; $artistpic = $show['artist_pic']; $venueid = $show['venue_id']; $venuephone = $show['venue_phone']; $venueurl = $show['venue_url']; $shownote = $show['show_note']; $address2 = "$address1"; $google0 = str_replace(" ", "+", $address2); $google = str_replace(".", "", $google0); $startminute1 = ":$startminute"; $address = "$address1,"; if ($startminute1==':0') { $startminute1=''; } if ($starthour>'12') { $starthour=$starthour-12; } if ($showdate0 >= $today and $entrydate >= $mynewdate and !$shownote and ($event_count >= 1) and $artistmp3) { // echo shows in current month, today and later echo "

$artistname @ $venuename
$showdate $address $city $state $venuephone
$starthour$startminute1 $startmeridian
"; $event_count++; } //Original Code if ($showdate0 >= $today and $entrydate < $mynewdate and !$shownote and ($event_count >= 1) and $artistmp3) { // echo shows in current month, today and later echo "

$showdate $artistname @ $venuename
$starthour$startminute1 $startmeridian $address $city $state $venuephone
"; $event_count++; } if ($showdate0 >= $today and !$shownote and ($event_count >= 1) and !$artistmp3) { // echo shows in current month, today and later echo "

$showdate $artistname @ $venuename
$starthour$startminute1 $startmeridian $address $city $state $venuephone
"; $event_count++; } if ($showdate0 >= $today and $shownote == 'Acoustic Duo' and ($event_count >= 1) and $artistmp3 ) { // echo shows in current month, today and later echo "

$showdate $artistname @ $venuename
$starthour$startminute1 $startmeridian $address $city $state $venuephone
Acoustic Duo (Ed & John)
"; $event_count++; } if ($showdate0 >= $today and $shownote == 'Acoustic Duo' and ($event_count >= 1) and !$artistmp3 ) { // echo shows in current month, today and later echo "

$showdate $artistname @ $venuename
$starthour$startminute1 $startmeridian $address $city $state $venuephone
Acoustic Duo (Ed & John)
"; $event_count++; } // NEW CODE FOR NEW EVENT if ($showdate0 >= $today and $entrydate >= $mynewdate and $shownote and $shownote != 'Acoustic Duo' and $shownote != 'Ed will be hosting open mic!' and $shownote != 'Ed will be hosting open mic!' and ($event_count >= 1) and $artistmp3 ) { // echo shows in current month, today and later ------ echo "

$artistname @ $venuename
$showdate $address $city $state $venuephone
$starthour$startminute1 $startmeridian $shownote
"; $event_count++; } // Original Code if ($showdate0 >= $today and $entrydate < $mynewdate and $shownote and $shownote != 'Acoustic Duo' and $shownote != 'Ed will be hosting open mic!' and $shownote != 'Ed will be hosting open mic!' and ($event_count >= 1) and $artistmp3 ) { // echo shows in current month, today and later ------ echo "

$showdate $artistname @ $venuename
$starthour$startminute1 $startmeridian $address $city $state $venuephone
$shownote
"; $event_count++; } if ($showdate0 >= $today and $shownote and $shownote != 'Acoustic Duo' and $shownote != 'Ed will be hosting open mic!' and ($event_count >= 1) and !$artistmp3 ) { // echo shows in current month, today and later echo "

$showdate $artistname @ $venuename
$starthour$startminute1 $startmeridian $address $city $state $venuephone
$shownote
"; $event_count++; } } ?>[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service