Jump to content

[SOLVED] PHP MYSQL + SEARCH HELP


logicopinion

Recommended Posts

hello, i have database which stores news.

 

i have for columns in it :

 

1. id

2. title

3. date

4. full text

 

so, in each row of an id, and date there is only one word, or numbers, and when search by id, or date, php can easily find exact match.

but if i want to search a word which is stored in column "full text" (some sentance forexample) and the middle word is "seachword" or even if the word is in the beggining or at the and of the sentance, and i use it for search php give 0 results.

 

why does it happen? do i miss something?

 

here is the whole code:

 

<?php

$keyword = $_POST['keyword'];


mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("mynews") or die(mysql_error());
$query = "SELECT * FROM newsdb WHERE date='$keyword' or title='$keyword' or rte1='$keyword'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result))


echo $row['rte1']; 
print "<br>";


?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.