Hello
I have tries to create at PHP/MySql search funktion, where you seek several tables, but it does not work.
When I paste in the seek word and press submit I get a long row of the samme artikle - and the keyword is not even among.
What am I doing wrong?
Regards Jan
<?
function Search(){
global $text_search;
$query = mysql_query("SELECT visions.text,texts.text
FROM visions, texts
WHERE visions.text LIKE '%$text_search%' OR texts.text LIKE '%$text_search%'") or die ("Can't connect to SQL-server!");
while($data = mysql_fetch_array($query)){
extract($data);
$text=str_replace("\n","<br>",$text);
$sum=substr("$text",0,300);
print $sum;
print "...<br/>";
print "<a class=\"textlink\" href= <!-- m --><a class="postlink" href="http://www.phpbuilder.com/board/archive/index.php/">http://www.phpbuilder.com/board/archive/index.php/</a><!-- m -->\"news.php?id=$id\">Read more...</a><br/>";
}
return;
}
I have tries to create at PHP/MySql search funktion, where you seek several tables, but it does not work.
When I paste in the seek word and press submit I get a long row of the samme artikle - and the keyword is not even among.
What am I doing wrong?
Regards Jan
<?
function Search(){
global $text_search;
$query = mysql_query("SELECT visions.text,texts.text
FROM visions, texts
WHERE visions.text LIKE '%$text_search%' OR texts.text LIKE '%$text_search%'") or die ("Can't connect to SQL-server!");
while($data = mysql_fetch_array($query)){
extract($data);
$text=str_replace("\n","<br>",$text);
$sum=substr("$text",0,300);
print $sum;
print "...<br/>";
print "<a class=\"textlink\" href= <!-- m --><a class="postlink" href="http://www.phpbuilder.com/board/archive/index.php/">http://www.phpbuilder.com/board/archive/index.php/</a><!-- m -->\"news.php?id=$id\">Read more...</a><br/>";
}
return;
}