Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1054307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:23:05+00:00 2026-05-16T17:23:05+00:00

I have a working pagination script, it displays the data with few issues. However,

  • 0

I have a working pagination script, it displays the data with few issues.

However, the issue I’m having is trying to get my data to enclose it in quotes if it’s not null.

This is the part of my pagination script:

//This function shows the data
public function display()
{
    if(date('Y-m-d') == date('Y-m-d', $this->airdate)) $dateFormat = 'g:ia';
    elseif(date('Y') == date('Y', $this->airdate)) $dateFormat = 'F jS - g:ia';
    else $dateFormat = 'F jS, Y - g:ia';

    echo '<tr>'."\n".
         '  <td><strong>'.$this->program.'</strong></td>'."\n".
         '  <td>showing on '.$this->channel.'</td>'."\n".
         '  <td>'.date($dateFormat, $this->airdate).'</td>'."\n".
         '  <td><b>'.$this->episode.'</b></td>'. "\n".
         '  <td>'.$this->setReminder.'</td>'."\n".
         '</tr>'."\n";
}

However, it’s the $this->episode. part which I’m having trouble with.

The data renders correctly:

Episode Name
<null>
Episode Name 2

but I would like it to be like this:

"Episode Name"
<null>
"Episode Name 2"

I tried:

        echo '<tr>'."\n".
         '  <td><strong>'.$this->program.'</strong></td>'."\n".
         '  <td>showing on '.$this->channel.'</td>'."\n".
         '  <td>'.date($dateFormat, $this->airdate).'</td>'."\n".
         '  <td><b>"'.$this->episode.'"</b></td>'. "\n".
         '  <td>'.$this->setReminder.'</td>'."\n".
         '</tr>'."\n";
}

but the formatting came out as:

"Episode Name"
"<null>"
"Episode Name 2"

which wasn’t how I expected it to turnout.

I’m not sure what the right solution is – is ifelse the best one, and if so what code would you recommend for this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:23:05+00:00Added an answer on May 16, 2026 at 5:23 pm

    You could pass the value through a function, which would add the quotes where necessary.

    function encloseNullWithQuotes($a)
    {
        if ($a == "<null>")
            return $a;
        return '"'.$a.'"';
    }
    

    Then, change the $this->episode in your code to encloseNullWithQuotes($this->episode).

    Not entirely sure whether the episode is the literal string <null> or not… if it’s not, you could do a test for NULL or anything like that in the function too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP-based pagination system and it is working fine, I'm using GET
i have a pagination script which working with jquery and php scripts, i am
I have a div selector script with icons as pagination that I'm working on.
I have working registration script the only problem is that i do not know
I am working with http://plugins.jquery.com/project/pagination and want to have the pagination applied to both
I was working with getResources and getPages for pagination. Now, I have a requirement
I currently have pagination working in my MVC 3 project using the PagedList library
HI i have a working php based pagination which works fine, but when i
I'm working on some search engine and I would like to have nice pagination,
I am trying to implement pagination in my search results with Yii. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.