PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
i used this code
<?php
/* call this script "advs.php" */
if(!$c) {
?>
<form action="advs.php?c=1" method=POST>
<b>Find Results with: </b><br>
Any of these words: <input type="text" length=40 name="any"> <br>
All of these words: <input type="text" length=40 name="all"> <br>
None of these words: <input type="text" length=40 name="none"> <br>
<input type="submit" value="Search">
</form>
<?
} else if($c) {
MySQL_connect("hostname", "username", "password");
MySQL_select_db("database");
if((!$all) || ($all == "")) { $all = ""; } else { $all = "+(".$all.")"; }
if((!$any) || ($any == "")) { $any = ""; }
if((!$none) || ($none == "")) { $none = ""; } else { $none = "-(".$none.")"; }
$query = "
SELECT *,
MATCH(title, story) AGAINST ('$all $none $any' IN BOOLEAN MODE) AS score
FROM compsite
WHERE MATCH(title, story) AGAINST ('$all $none $any' IN BOOLEAN MODE)";
$artm1 = MySQL_query($query);
if(!$artm1) {
echo MySQL_error()."<br>$query<br>";
}
echo "<b>Article Matches</b><br>";
if(MySQL_num_rows($artm1) > 0) {
echo "<table>";
echo "<tr><td>Score </td><td>Title </td><td>Body</td></tr>";
while($artm2 = MySQL_fetch_array($artm1)) {
$val = round($artm2['score'], 3);
$val = $val*100;
echo "<tr><td>$val</td>";
echo "<td>{$artm2['title']}</td>";
echo "<td>{$artm2['body']}</td></tr>";
}
echo "</table>";
}
else {
echo "No Results were found in this category.<br>";
}
echo "<br>";
}
and gave it a form of page
made all necessary changes
the first error it showed was
undefined variable c in .....
how can it be removed
i named the file
advs.php
but no thing is happening when i click search button....i think the file contains both scripts and code
any changes required
(extracted from zend.com ,tutorials)
thanks
rami
Do you understand what your code does or have you copied it somewhere?
I can only advise you to copy from a different source, because that script seems to rely on register_globals=on in your php configuration, and that has a default value off for years now...
timvw wrote:Do you understand what your code does or have you copied it somewhere?
I can only advise you to copy from a different source, because that script seems to rely on register_globals=on in your php configuration, and that has a default value off for years now...
dear sir,
thanks for reply
i dont know how windows was made (codes) but i am still using it...
any way nothing offending
i have already listed that
it is extracted it from http://www.zend.com
its tutorials and there it says nothing
i have understood all in that tutorials...nothing as global or so in that tutorials
any way still it is not running
full tutorials is here http://www.zend.com/zend/tut/tutorial-ferrara1.php
thanks for reply
really thanks
ya i have that article also as i found it through google
as it is some what long i am going though it
hope it works
thanks for all help
really appreciated
rami