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 9004527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:55:00+00:00 2026-06-16T00:55:00+00:00

I think I have it partly working, but for some reason, it’s not getting

  • 0

I think I have it partly working, but for some reason, it’s not getting the article’s content..

<?php

        $amount_get = mysql_query("SELECT * FROM comment WHERE articleid='" . mysql_real_escape_string($_GET['id']) . "'"); 
        $comments = mysql_num_rows($amount_get);            

        $grab = mysql_query("SELECT * FROM articles WHERE id='" . mysql_real_escape_string($_GET['id']) . "' LIMIT 1");    
        $grab = mysql_query("SELECT id, news_title, news_content, news_author, news_day, news_month, news_year, news_date FROM articles ORDER BY id DESC limit 3"); 
        $news_day =$row['news_day'];
        $news_month =$row['news_month'];
        $news_year =$row['news_year'];

        if (mysql_num_rows($grab)==0) {
        echo "<div class='alert alert-note-x'>Sorry, it looks like their are no articles posted!</div>";
        }

        else if(strlen($row['news_contents']) > 135) {
                    $news_content = substr($news_content, 0, 135) . "....";
        }

         while($row = mysql_fetch_array($grab)){

    ?>

    <div class="post-container">
        <div class="post">
        <div class="left">
        <div class="date"><span class="day"><?php echo $row['news_day'] ?></span> <span class="month"><?php echo $row['news_month'] ?></span> <span class="year"><?php echo $row['news_year'] ?></span></div></div>
        <div class="postcontent"><h5 class="posttitle"><a href="#/media/<?php echo $row['id'] ?>.<?php echo stripslashes(str_replace(" ", "-", $row['news_title'])); ?>"><?php echo stripslashes($row['news_title']); ?></a></h5>                       

                <?php echo (strlen($row['news_content']) > 135); ?>

            </div>
    </div>​
    </div>  

  <?php } ?>

This is what it looks like: http://puu.sh/1CD32

Do you guys know why it’s showing a “1” instead of what’s in the database?

<?php echo (strlen($row['news_content']) > 135); ?>
  • 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-06-16T00:55:01+00:00Added an answer on June 16, 2026 at 12:55 am

    You are asking it if the variable $row[‘news_content’] is greater than 135 characters. It will print 1 for true and 0 for false.

    If you are trying to print the first 135 characters of the variable you are looking for substr not strlen

    echo substr($row['news_content'], 0, 135);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some fundamental points/questions about OpenGL, not all involving code but concepts as
I have done this sort of thing before, but it's not working for me
I think I have a basic understanding of this, but am hoping that someone
I have an issue that (I think) might have to do with scope, but
I think I have a basic understanding of REST, but something I'm stuck on
I have a page with user controls getting dynamically added. Inside some of these
I have an issue with a 3rd party DLL, which is NOT thread-safe, but
Think I have an integer array like this: a[0]=60; a[1]=321; a[2]=5; now I want
I think I have a problem with casting. $db = mysqli_connect('127.0.0.1','root','password','test'); if (! $db)
I think I have a big problem. I have a two projects solution. First

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.