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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:18:31+00:00 2026-06-05T07:18:31+00:00

I’ve spent hours trying to make this work. No solutions from the search have

  • 0

I’ve spent hours trying to make this work. No solutions from the search have helped me, so I’m finally asking.

What I’m trying to do is: Display a message if no results are found.

This is what I have, and it is currently not working to my dismay.

    $sql = mysql_query("SELECT * FROM cover WHERE MATCH(keyword,description,categories) AGAINST('$search_key' in boolean mode) ORDER BY id DESC LIMIT $from , $perPage");

    $i=1;
    while($result = mysql_fetch_object($sql)) {

    $keyword = $result->keyword;
    $img = $result->img;
    $description = $result->description;

    if($img != null) { DO THIS;
    if($i==2) { require_once(dirname(__FILE__).'/page.php'); }
    $i++; }
    }
    if($img == null) { print "<center>No Results Found</center>"; }

I don’t know how to use mysql_num_rows with this (which is what I’ve seen is the most popular solution around the site), it returns an error and I’m thinking it doesn’t work well with mysql_fetch_object($sql) ? And I don’t think this: $img = $result->img; would work with mysql_num_rows either.

I’m just trying to find a way to do this without having to modify anything inside the brackets, just the ones outside.


When I say “NOT WORKING”, I mean it doesn’t show the message that is supposed to show if results are not found. I’ve tested if($img != null) { print "<center>No Results Found</center>"; } and it works fine, it shows the message. But it doesn’t seem to work the other way, and I’m now just confused.

  • 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-05T07:18:33+00:00Added an answer on June 5, 2026 at 7:18 am

    The following will work:

    $sql = mysql_query("SELECT * FROM cover WHERE MATCH(keyword,description,categories) AGAINST('$search_key' in boolean mode) ORDER BY id DESC LIMIT $from , $perPage");
    if(mysql_num_rows($sql) > 0)
    {
        $i=1;
        while($result = mysql_fetch_object($sql)) 
        {
            $keyword = $result->keyword;
            $img = $result->img;
            $description = $result->description;
    
            if($img != null) 
            { 
                DO THIS;
                if($i==2) 
                { 
                    require_once(dirname(__FILE__).'/page.php'); 
                }
                $i++; 
            }
        }
    }
    else
    { 
        print "<center>No Results Found</center>"; 
    }
    

    I see no reason why you would want to store the values from $result into separate variables when you can simply use the $result->keyword directly.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string

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.