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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:38:39+00:00 2026-06-16T01:38:39+00:00

Got this script partially working, but if there are 3 tags on 1 video,

  • 0

Got this script partially working, but if there are 3 tags on 1 video, and I type all 3 tags, the video comes back 3 times, not sure how to rectify this.

$search = sanitize($_GET['search']);
$array = explode(" ", $search);
foreach($array as $mySearch)
{
  $query = mysql_query("SELECT * FROM `videos`");
  while($mad = mysql_fetch_array($query))
  {
    if(strpos($mad['tags'], $mySearch))
    {
      // show results
      echo "<div class='comment_1'>$mad[title]</div>";
    }
  }
}

Any help is always greatly appreciated.

  • 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-16T01:38:41+00:00Added an answer on June 16, 2026 at 1:38 am

    Got this script partially working

    Well that’s fine, however, scripts are like being pregnant: There is no partially. A system either works or not, not much between the lines.

    You have a logical problem here, resulting from a wrong order of processing with your control structures.

    The normal procedure is:

    1. Validate and process the input data.
    2. Work with the data, transform it. In your case, use it to fetch data from the database.
    3. Output the data fetched from the store.

    In your script you mix all these three things into each other instead of doing one part after the other:

    $tags_array = get_tags_array_from_input();
    
    $result = mysql_query_result_based_on_tags_array($tags_array);
    
    display_results($result);
    
    /**
     * exemplary only
     */
    function mysql_query_result_based_on_tags_array(array $tags)
    {
        $mask = "SELECT * FROM videos WHERE tags REGEXP '%s'";
        $sql  = sprintf($mask, implode('|', $tags));
    
        return mysql_query($sql);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got this script I'm working on to rate music, there are no errors,
I've got this script for calculating square area, which works perfect: <script language=javascript type=text/javascript>
I currently got this script, which compresses byte arrays. But I need it rewritten,
Alright so I've got this script sort of working. The ajax call works and
Im really really new to Javascript but Ive got this script that loads the
Im new to this, but have got a generation script to ics file, to
I got this script which works perfect when i am not using jquery's alert
I've got this script which I'm using with succes, but I've tried, and failed,
Ive got this script: $(function(){ $(.submenu li:even).addClass(oddrow); }); It works great - but it
I got this upload script but when I want to run it, the page

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.