Creating Search Engine: MySQL Warning

hello,

i am creating a search engine..

and i am getting an error

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in c:\wamp\www\major project\search.php on line 22

in the command written below

sql_select_db ("music_park");

$get= mysql_query("SELECT * from searchengine");
while ($getrow= mysql_fetch_assoc($get))
{

//explode our search

$search_explode = explode(" ", $search);

foreach ($search_explode as $search_each)
{
//construct query

$x++;
if ($x==1)

$construct .= "keywords LIKE '%$search_each%'";
else
$construct .= "OR keywords LIKE '%$search_each%'";

}

//echo out construct

$construct = "SELECT * from searchengine WHERE '$construct'";
$run = mysql_query ('$construct');
$foundnum = mysql_num_rows('$run');

if ($foundnum ==0)
echo "no result found";
else
{
echo "$foundnum result found!

";
}
}


please somebody help me out to remove this error..

thank you very much...!!!

Replies

  • Manish Goyal
    Manish Goyal
    Re: warning message

    which database are you using for this?
  • manojsinghrana
    manojsinghrana
    Re: warning message

    hello,
    if you are asking me the name of my database then it is music_park.

    and i am working on wampserver.
  • Manish Goyal
    Manish Goyal
    no i am asking are you using mysql or something else
  • silverscorpion
    silverscorpion
    Wamp server uses MySQL only..

    Well, I don't see mysql_connect function being used to connect to the database first.
    If you have used it in the code before, fine.

    Also, use mysql_select_db instead of sql_select_db. That seems to be the only mistake to me.. try it.

    You can also try printing the result of your query to know if the query is actually executed or not.
    After the mysql_query line, just include a line to print the variable get.

    $get = mysql_query("SELECT * from searchengine");
    echo $get;
    Now you'll know what is stored in the variable when you are running the while loop.
  • manojsinghrana
    manojsinghrana
    yes i am using mysql.
  • garima8905
    garima8905
    sir, please help me to make a project in search engine in asp.net.
  • garima8905
    garima8905
    Re: warning message

    can you help me by guiding me how to make a search engine.?

You are reading an archived discussion.

Related Posts

i actully saved a song in my picture and tried to send to my friend,but it was not sent kindly say the reason "why the message was not sent" or...
hello i m a mechanical engg student
1. “We're about to go into beta testing.” This is a meaningless statement because it doesn't matter when you go into beta testing--what matters is when you come out of...
how electrical layout design is done in thermal power plant or industrial plant?
*Quick Heal* CEan Of The Month December 2010 Is... *Quick Heal* CEan of the month September 2010 is... 😁CEan - Praveena211😁 ​CEan Praveena joined CE on 14 November 2009 and...