0

I searched for answers and found that missing quote or brackets would cause that error. I have checked several times and added missing quote but line 91 is at the bottom, so I couldn't figure it out unless it is "else:" I looked from top to bottom but I am not sure which could cause the error. Please lend me your eyes to find the problem. Thank you

<?php

if( ereg( '/[a-z-]+/[a-z]/$', $_SERVER['REQUEST_URI'])) {

$url_array = explode('/', $_SERVER['REQUEST_URI']); 
$alpha = $url_array[sizeof($url_array)-2];

$postids = $wpdb->get_col("
    SELECT p.ID
    FROM $wpdb->posts p
    WHERE p.post_title REGEXP '^" . $wpdb->escape($alpha) . "'
    AND p.post_status = 'publish' 
    AND p.post_type = 'book'
    AND p.post_date < NOW()
    ORDER BY p.post_title ASC"
);


if ($postids) {
  $args=array(
    'post__in' => $postids,
    'post_type' => 'list', 
    'post_status' => 'publish',
    'posts_per_page' => -1,
    'caller_get_posts'=> 1
  );
  $my_query = null;
  $my_query = new WP_Query($args);
  if( $my_query->have_posts() ) {

    while ($my_query->have_posts()) : $my_query->the_post(); ?>

    <div class="listing">

       <h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
        <?php the_excerpt(); ?>             
    </div>

      <?php
    endwhile;
    }

  }

}
 else {
    query_posts(array('post_type'=>'list')); 

    if (have_posts()) : while (have_posts()) : the_post(); 

     ?>          

    <div class="listing">
     <h3><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> </h3>
    <?php the_excerpt(); ?>             
    </div>

    <?php endwhile; else:?>

    <p>Sorry, no profiles matched your criteria.</p>

   <?php  endif; ?>
</div>

<?php get_sidebar(); ?>

</div>
<?php get_footer(); ?>

1 Answer 1

1
 ...
  else {
    query_posts(array('post_type'=>'list')); 

    if (have_posts()) : while (have_posts()) : the_post(); 

     ?>          

You haven't ended that else { which will be throwing that error.

Change it to like:

else {
    query_posts(array('post_type'=>'list')); 

    if (have_posts()) : while (have_posts()) : the_post(); 

 ?>          

<div class="listing">
 <h3><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> </h3>
<?php the_excerpt(); ?>             
</div>

<?php endwhile; else:?>

<p>Sorry, no profiles matched your criteria.</p>

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

1 Comment

@tehluz - yeah thank you and i found the error before I checked back here. Thank you again.

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.