Jump to content

[SOLVED] Searching in database


aashcool198

Recommended Posts

hi..

 

i am trying to make a small search engine.

where user fills value in form and it is searched in database.

 

$text = $_POST['search'];
$q = "SELECT name_id, firstname, lastname FROM personal where firstname LIKE '%'$text'%'";

$query = mysql_query($q);
while($row = mysql_fetch_array($query)){
echo $row['firstname'];

 

I think there is some problem with LIKE '%'$text'%'.

 

please tell me the right syntax.

Link to comment
https://forums.phpfreaks.com/topic/161910-solved-searching-in-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.