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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:17:43+00:00 2026-06-17T10:17:43+00:00

In a site I’m making, I need a search engine to find songs for

  • 0

In a site I’m making, I need a search engine to find songs for people to listen to. I have it working to the point that it can get info from the database and display them on the page. The problem comes when there are two songs with the same name. I have a system so the results will go to separate links, but when I search them they display the same image even though there is two separate sources for them. It also will make extra results for some reason. Here’s my code:

<?php
if (isset($_GET['q'])) {
    $q = $_GET['q'];
    mysql_connect('********', '********', '********');
    mysql_select_db('********');
    $query = mysql_query("SELECT * FROM ******** WHERE title LIKE '$q'");
    $numrows = mysql_num_rows($query);
} else {
    echo "
<span style='font-family: Helvetica, Arial;font-weight: bold;font-size: 25px;'>Search</span>
<form action='http://www.example.com/search' method='get'>
<input placeholder='Search for music' type='text' name='q' style='font-weight:bold;padding:5px;width:300px;border-top-left-radius: 4px;border-top-right-radius: 10px;border-bottom-left-radius: 10px;border-bottom-right-radius: 4px;border: 3px solid gray;background-color:#000000;color:#FFFFFF;' />
</form>
    ";
}
if ($numrows != 0) {
    $index = 0;
    $results = array();
    while($row = mysql_fetch_assoc($query)) {
        $results[$index] = $row;
        $index++;
        foreach ($results as $result) {
            $url = "http://www.example.com?id=" . $row['id'];
            $title = $row['title'];
            $arturl = $row['art_url'];
            if ($_GET['q'] != "") {
                echo "
                    <a href='$url'>
                    <table>
                    <tr style='text-align:left;'>
                    <td><img src='$arturl' style='width:100px;height:100px;'></td>
                    <td>
                    <span class='songTitle'>$title</span>
                    <br/>
                    <span class='songArtist'>By: Unknown</span>
                    </td>
                    </tr>
                    </table>
                    </a>
                    <br />              
                ";
            }
        }   
    }
} else {
    if ($_GET['q'] != "") {
        echo "
<span style='font-family: Helvetica, Arial;font-weight: bold;font-size: 25px;'>Search</span>
<form action='********' method='get'>
<input placeholder='Search for music' type='text' name='q' style='font-weight:bold;padding:5px;width:300px;border-top-left-radius: 4px;border-top-right-radius: 10px;border-bottom-left-radius: 10px;border-bottom-right-radius: 4px;border: 3px solid gray;background-color:#000000;color:#FFFFFF;' />
</form>
        ";
        echo "<br />No results where found.";
    }
}
?>
  • 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-17T10:17:45+00:00Added an answer on June 17, 2026 at 10:17 am

    while($row = mysql_fetch_array($result))Try $result['title'] instead of $row['title'];. Same goes to $url and $arturl

    This should work.

    if ($numrows != 0) {
        $index = 0;
        $results = array();
        while($row = mysql_fetch_array($query)) {
                $url = "http://www.example.com?id=" . $row['id'];
                $title = $row['title'];
                $arturl = $row['art_url'];
                if ($_GET['q'] != "") {
                    echo "
                        <a href='$url'>
                        <table>
                        <tr style='text-align:left;'>
                        <td><img src='$arturl' style='width:100px;height:100px;'></td>
                        <td>
                        <span class='songTitle'>$title</span>
                        <br/>
                        <span class='songArtist'>By: Unknown</span>
                        </td>
                        </tr>
                        </table>
                        </a>
                        <br />              
                    ";
                }
        }           
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My site has three columns. I have two fields within a form that need
I have a French site that I want to parse, but am running into
My site is like a search engine with 2 types of search. Type 1
My site has a few pages that point to the same child page. I'm
Site that have nice but raising number of visits / hits, heavily operates on
Site: http://clientfiles.priworks.com/lgmanagedportfolios/test/investment.html I have been working at this web page for a while now
Site here . Why is it that the code works for $('#club').change(function(event) but not
The site I'm currently working on has a series of videos on a carousel
Live site. My site is set up so that an image or gallery is
Site: http://na.leagueoflegends.com/ladders/solo-5x5 Search for a a player (example: Jaiybe) You get redirected (in this

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.