If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Problem with a searcher, help.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-07-05, 19:57
0utKast 0utKast is offline
Registered User
 
Join Date: Jan 2005
Posts: 5
Problem with a searcher, help.

Greetings and thanks for the great information that we can find in these forums

to solve our doubts. But I have a problem and I have not been able to find solution, I

hope somebody can help me. This is the problem:


I want to create a searcher. In a form a user can enter a keyword that will look for

in the data base. A field type varchar(100) that contains key words like: "car,

travels, clothes"

This is my query:

Code:
mysql_connect("localhost","root","") or die ("No pude conectarme"); 
mysql_select_db("mibase") or die("No puedo acceder a la base de datos"); 

// This is the query 
$res=mysql_query("SELECT * FROM `mitabla` WHERE `$campo` LIKE '%$palabra_clave%' "); 


if(!mysql_fetch_array($res)){ 
echo "No se encontraron registros Registros"; 
} 
else{ 
$con=0; 
while($nd=mysql_fetch_array($res)){ 
$con++; 
echo "Nombre: ".$nd[nombre]." puesto: " .$nd[puesto]. 
" conocimientos: ".$nd[conocimientos]."
"; 
} 
echo "
Numero de registros: ".$con.""; 
}

This works partly. The search only gives back three records although the key word is

in more. Which is the problem?

thx for all sincerely

Last edited by 0utKast; 02-08-05 at 11:05.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On