hi,
thank you for your suggestion.
but i face another problem.
Parse error: parse error, unexpected $end in c:\program files\apache group\apache\htdocs\supplier\phpsearch.php on line 88
why i get this error?
i more question, is this code correct or not?
please reply back to me ASAP.
hi,
ok now i show all the coding here.
$dbase="supplier";
$table="supp";
mysql_connect("localhost", "", "");
@mysql_select_db($dbase) or die("unable to select database");
$field_to_search="field";
$query="select * from $table where $field_to_search LIKE \"%trimmed%\" ";
$result=mysql_query($query);
$count=mysql_numrows($result);
?>
<form name="search" method="get" action="<? $PHP_SELF ?>">
Search the database for:<input type="text" name="q">
<input type="submit" name="search" value="Search">
</form>
<?php
if($q == true)
{
exit;
}
elseif($q == false)
{
?>
<form name="search" method="get" action="<? $PHP_SELF ?>">
Search all the newsletters for
<input type="text" name="q">
<input type="submit" name="search" value="Search">
</form>
}
<?php
if($trimmed == "")
{
echo "<p>Please enter a search...</p>";
exit;
}
if(!isset($var))
{
echo "<p>We don't seem to have a search parameter!</p>";
exit;
}
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
if($numrows == 0)
{
echo "<h4>Results</h4>";
echo '<p>Sorry, your search: ' . $trimmed . ' returned zero results</p>';
}
if(empty($s))
{
$s=0;
}
$result=mysql_query($query) or die("couldn't execute query");
if($numrows > 1) { $return = "results"; }
else { $return = "result"; }
echo '<p>Your search for ' . $var . ' returned $numrows
$return.</p>';
$count = 1+$s;
while($r=mysql_fetch_array($result))
{
$vendor=$r["vendor"];
$email=$r["email"];
$brand=$r["brand"];
$category=$r["category"];
$count++;
}
?>
Result Number: <? echo $count ?><br><br>
</body>
</html>
Parse error: parse error, unexpected $end in c:\program files\apache group\apache\htdocs\supplier\phpsearch.php on line 83
The error is shown after the </html> tag. i don't why? if there any mistake that i make? can you check for me.
thank you.
sorry me again.
i have another problem but not about search engine.
i show you the coding and the error. hope you can fix my problem.
Notice: Undefined index: username in c:\program files\apache group\apache\htdocs\supplier\index.php on line 1
I don't know much php but in the second one isn't it supposed to have the form of:
if......then
Where's the then?
Sorry I'm not sure why it's throwing up the first error. I orginally thought mayarialbe $end hadn't been defined but in the code you've posted there is no mentionof $end. Is there any more code other than what you supplied?
That just means that something was not closed and so the end of the script was never apparent to php.
Look for stuff like the following:
There should be a ; in there
you have a few places like that.
Recommend a free PHP search engine script:
Sphinx is a free open-source SQL full-text PHP search engine designed from the ground up with performance, relevance (aka search quality), and integration simplicity in mind.
Sphinx lets you either batch index and search data stored in an SQL database, NoSQL storage, or just files quickly and easily — or index and search data on the fly, working with Sphinx pretty much as a database server. A variety of text processing features enable fine-tuning Sphinx for your particular application requirements, and a number of relevance functions ensures you can tweak search quality as well.
hi,
i've try your php search engine script tutorial.
my problem is at
[CODE]
if ($numrows == 0)
{
echo "<h4>Results</h4>";
echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>";
}
i got this message error:
Parse error: parse error, unexpected '"', expecting ',' or ';' in c:\program files\apache group\apache\htdocs\supplier\phpsearch.php on line 53
so, can you help me to solve this problem.
i'll waiting for your reply.