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

  • Home
  • SEARCH
  • 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 944823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:39:26+00:00 2026-05-15T22:39:26+00:00

Heres my code <?php session_start(); include(‘config.php’); if(isset($_GET[‘search_word’])) { // echo $_GET[‘search_word’] . ‘<br />’;

  • 0

Heres my code

<?php
session_start();

include('config.php');
if(isset($_GET['search_word']))
{
    // echo $_GET['search_word'] . '<br />'; // debugging
    $search_word = $_GET['search_word'];
    $search_word = mysql_escape_string($search_word);
    $search_word_fix = str_replace(" ","%",$search_word);

    $query = "SELECT * FROM article WHERE article_title LIKE '%" . $search_word . "%' AND article_live = '1' ORDER BY article_id DESC";
    // echo $query . '<br />'; // debugging

    $sql = mysql_query($query);
    $count = mysql_num_rows($sql);
    // echo $count . '<br />'; // debugging
    // echo mysql_num_rows($sql) . '<br />'; // debugging
    if($count > 0)
    {
        while($row=mysql_fetch_array($sql))
        {
            $msg=$row['article_title'];
            $bold_word='<b>'.$search_word.'</b>';
            $final_msg = str_ireplace($search_word, $bold_word, $msg);

            echo $final_msg; 
        }
    }
    else
    {
        echo "No Results";
    }
}?>

Can anyone see an issue with it? I cant pick out what is not working with this script and ive been staring at it for a while. It never makes it to the WHILE loop only the “No Results” and the count returns blank when i uncomment my debugging.

  • 1 1 Answer
  • 1 View
  • 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-15T22:39:26+00:00Added an answer on May 15, 2026 at 10:39 pm

    Count returning blank means your query failed for some reason.

    • Are you connecting to the db properly? Try using mysql_error() right after your query:

      $error_msg = mysql_error();
      
    • Use mysql_real_escape_string() instead of mysql_escape_string() – it respects the character set so that you don’t have UTF8 issues

    If you’re using this publicly, you may want to learn about using binds to eliminate the possibility of SQL injection via a library like PDO.

    Here’s a pretty good tutorial/introduction to PDO explaining why it’s important!

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

Sidebar

Ask A Question

Stats

  • Questions 490k
  • Answers 490k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The first thing to check would be the security settings… May 16, 2026 at 9:53 am
  • Editorial Team
    Editorial Team added an answer If you want trim strings that Users have entered then… May 16, 2026 at 9:53 am
  • Editorial Team
    Editorial Team added an answer solved it. After realizing SWFUpload is already used is Wordpress… May 16, 2026 at 9:53 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Here's my code: RewriteEngine on RewriteRule page/(.*) index.php?url=$1 [NC] When I access page/ http://google.com/
I have created an admin panel for a client in PHP, which requires a
I'm validating a login form with jQuery AJAX call to PHP. In php, I
I am having a problem when trying to login.. below is my code for
I am making a simple Dynamic Website using PHP, where i allow the user
Parse error: syntax error, unexpected $end in blah/blah/blah.php line 1 This is the error
I'm writing a quiz program using PHP and a bit of Javascript. The questions
We recently upgraded our PHP and apache versions on our server. Prior to this
Please see the code here: http://pastie.org/1092106 When I call the method createPost on Blog,
I've done tons of redirects using PHP's header function. This one has stumped me.

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.