August 12th, 2000, 12:05 AM
-
Once I inserted & modified a little script to get multiple keyword results my page stopped working. Now, the only part of it that works is the bottom part. If you know what is wrong or think you can help, I'd be really grateful!.
Thanks in advance. 
<html>
<head>
<title>Projects</title>
</head>
<body bgcolor="#FFCC99" text="#804000" link="#ff8040" vlink="#ff8080" alink="#ff8000">
<i><CENTER>Search for volunteer projects here. <BR>There are four options to search from: keywords, the writer, <BR>people needed for the project, and money needed for the project.<BR>Do not use AND, OR, or NOT if you want to receive results.<BR> Keep your search general to receive the most possible results.<BR>
<BR></i>You can also submit a project of your own <a href="AddProject.htm">here.</a>
<form action="SearchProjects.php" method=GET name=projects>
<table>
<tr><td><input type="textbox" name="Keywords" value="Keywords">
<td><SELECT name="People">
<OPTION VALUE='unknown'>Unknown</OPTION>
<OPTION VALUE='small'>1-5</OPTION>
<OPTION VALUE='medium'>6-10</OPTION>
<OPTION VALUE='large'>11-20</OPTION>
<OPTION VALUE='extra large'>21-50</OPTION>
<OPTION VALUE='great'>over 50</OPTION>
<OPTION VALUE='unspecified'>Any Amount</OPTION>
</SELECT>
<td><SELECT NAME="Money">
<OPTION VALUE='unknown'>Unknown</OPTION>
<OPTION VALUE='none'>$0 to $25</OPTION>
<OPTION VALUE='twenty'>$26 to $50</OPTION>
<OPTION VALUE='fifty'>$51 to $100</OPTION>
<OPTION VALUE='hundred'>$101 to $250 </OPTION>
<OPTION VALUE='more'>$250 and Up</OPTION>
</SELECT>
<td><input type="textbox" name="Writer" value="Writer"></td>
<TD><input type="submit" name="Search" value="Search"></td>
</tr>
</form>
</table> <BR>
<img src="VC/Images/border.jpg">
<TABLE><BR>
<?php
$con = mysql_connect('hostname', 'username', 'password');
//database connectivity.
mysql_select_db('dbname',$con);
//Select your database.
$Wsql = "SELECT * FROM Projects WHERE Writer LIKE '$Writer'";
/* execute sql query and get result */
$WriterSearch = mysql_query ("$Wsql", $con);
if ($Writers = mysql_fetch_row ($WriterSearch)){
print "<TR><TD>Similar Writers:</TD></TR>";
do{
print "<h2>Results!</h2";
print "<TR><TD><font color='#32CD32'>";
print $Writers[0];
print "</TD>   by ";
print $Writers[1];
print "</TR><TR><BR><TD><i>";
print $Writers[2];
print "</td></TR><TR><TD>People needed:    ";
print $Writers[3];
print "</TD></TR><TR><TD>Money needed:   ";
print $Writers[4];
print "</font></TD></TR><BR>";
}
while($Writers = mysql_fetch_array($WriterSearch));
}
else {
print "<h2>Results:</h2>";
print "<No Writer results yet...";}
$Ksql = "SELECT * FROM Projects WHERE";
/* execute sql query and get result */
******************************************************
$pieces = explode (" ", $Keywords);
$count = count($pieces);
if ($count==1){
$Ksql.="Keywords LIKE '$Keywords'";
$yellow = $Ksql;
$KeywordSearch = mysql_query("$yellow", $con);
}elseif ($count>=1){
for($a=0;$a<$count;$a++){
$Ksql.="Keywords LIKE '%$pieces[$a]%'";
if ($a != $count){
$Ksql.=" OR ";
$yellow = $Ksql;
$yellow = substr ($yellow, 0,-3);
}}}
*****************************************
$KeywordSearch = mysql_query("$Ksql", $con);
IF ($Ksearch = mysql_fetch_row($KeywordSearch)){
print "<TR><TD>Similar Writers:</TD></TR>";
do{
print "<TR><TD><font color='#BA55D3'>";
print $Ksearch[0];
print "</TD>   by ";
print $Ksearch[1];
print "</TR><TR><BR><TD><i>";
print $Ksearch[2];
print "</td></TR><TR><TD>People needed:</td><TD>";
print $Ksearch[3];
print "</TD></TR><TR><TD>Money needed:</TD><TD>";
print $Ksearch[4];
print "</TD></TR><BR></font>";
}
while($Ksearch = mysql_fetch_row($KeywordSearch));
}else {
print "<BR><BR>";
print "No Keyword results yet....";}
$MPsql = "SELECT * FROM Projects WHERE Money = '$Money' OR People = '$People'";
/* execute sql query and get result */
$MoneypplSearch = mysql_query("$MPsql", $con);
IF ($MPsearch = mysql_fetch_row($MoneypplSearch)){
print "<TR><TD></TD></TR>";
do{
print "<TR><TD><font color='#6495ED'>";
print $MPsearch[0];
print "</TD>   by ";
print $MPsearch[1];
print "</TR><TR><BR><TD><i>";
print $MPsearch[2];
print "</td></TR><TR><TD>People needed:</td><TD>";
print $MPsearch[3];
print "</TD></TR><TR><TD>Money needed:</TD><TD>";
print $MPsearch[4];
print "</TD></TR><BR>";
}
while($MPsearch = mysql_fetch_row($MoneypplSearch));
}else {
print "<BR><BR>";
print "No Money or People results yet....";}
?>
<BR><BR><BR>
<img src="VC/Images/border.jpg">
<?php include("http://dev.thinkquest.org/C004065/Quotes.php"); ?>
</CENTER>
</TABLE>
</BODY>
</HTML>
August 12th, 2000, 01:32 AM
-
Hi,
just try the following one.i have changed some portion of your script.
------------------------
<html>
<head>
<title>Projects</title>
</head>
<body bgcolor="#FFCC99" text="#804000" link="#ff8040" vlink="#ff8080" alink="#ff8000">
<i><CENTER>Search for volunteer projects here. <BR>There are four options to search from: keywords, the writer, <BR>people needed for the project, and money needed for the project.<BR>Do not use AND, OR, or NOT if you want to receive results.<BR> Keep your search general to receive the most possible results.<BR>
<BR></i>You can also submit a project of your own <a href="AddProject.htm">here.</a>
<form action="SearchProjects.php" method=GET name=projects>
<table>
<tr><td><input type="textbox" name="Keywords" value="Keywords">
<td><SELECT name="People">
<OPTION VALUE='unknown'>Unknown</OPTION>
<OPTION VALUE='small'>1-5</OPTION>
<OPTION VALUE='medium'>6-10</OPTION>
<OPTION VALUE='large'>11-20</OPTION>
<OPTION VALUE='extra large'>21-50</OPTION>
<OPTION VALUE='great'>over 50</OPTION>
<OPTION VALUE='unspecified'>Any Amount</OPTION>
</SELECT>
<td><SELECT NAME="Money">
<OPTION VALUE='unknown'>Unknown</OPTION>
<OPTION VALUE='none'>$0 to $25</OPTION>
<OPTION VALUE='twenty'>$26 to $50</OPTION>
<OPTION VALUE='fifty'>$51 to $100</OPTION>
<OPTION VALUE='hundred'>$101 to $250 </OPTION>
<OPTION VALUE='more'>$250 and Up</OPTION>
</SELECT>
<td><input type="textbox" name="Writer" value="Writer"></td>
<TD><input type="submit" name="Search" value="Search"></td>
</tr>
</form>
</table> <BR>
<img src="VC/Images/border.jpg">
<TABLE><BR>
<?php
$con = mysql_connect('hostname', 'username', 'password');
//database connectivity.
mysql_select_db('dbname',$con);
//Select your database.
$Wsql = "SELECT * FROM Projects WHERE Writer LIKE '%$Writer%'";
/* execute sql query and get result */
$WriterSearch = mysql_query ($Wsql, $con);
if (mysql_num_rows($WriterSearch)>0){
print "<TR><TD>Similar Writers:</TD></TR>";
do{
print "<h2>Results!</h2";
print "<TR><TD><font color='#32CD32'>";
print $Writers[0];
print "</TD> by ";
print $Writers[1];
print "</TR><TR><BR><TD><i>";
print $Writers[2];
print "</td></TR><TR><TD>People needed: ";
print $Writers[3];
print "</TD></TR><TR><TD>Money needed: ";
print $Writers[4];
print "</font></TD></TR><BR>";
}while($Writers = mysql_fetch_array($WriterSearch));
}else {
print "<h2>Results:</h2>";
print "<No Writer results yet...";
}
$Ksql = "SELECT * FROM Projects WHERE";
/* execute sql query and get result */
******************************************************
$pieces = explode (" ", $Keywords);
$count = count($pieces);
if ($count==1){
$Ksql.="Keywords LIKE '%$Keywords%'";
$yellow = $Ksql;
//$KeywordSearch = mysql_query($yellow, $con);
}elseif ($count>1){
for($a=0;$a<$count;$a++){
$Ksql.="Keywords LIKE '%$pieces[$a]%'";
if ($a != $count){
$Ksql.=" OR ";
$yellow = $Ksql;
$yellow = substr ($yellow, 0,-3);
}
}
}
*****************************************
$KeywordSearch = mysql_query($yellow,$con);
IF (mysql_num_rows($KeywordSearch)>0){
print "<TR><TD>Similar Writers:</TD></TR>";
do{
print "<TR><TD><font color='#BA55D3'>";
print $Ksearch[0];
print "</TD> by ";
print $Ksearch[1];
print "</TR><TR><BR><TD><i>";
print $Ksearch[2];
print "</td></TR><TR><TD>People needed:</td><TD>";
print $Ksearch[3];
print "</TD></TR><TR><TD>Money needed:</TD><TD>";
print $Ksearch[4];
print "</TD></TR><BR></font>";
}while($Ksearch = mysql_fetch_row($KeywordSearch));
}else {
print "<BR><BR>";
print "No Keyword results yet....";
}
$MPsql = "SELECT * FROM Projects WHERE Money = '$Money' OR People = '$People'";
/* execute sql query and get result */
$MoneypplSearch = mysql_query($MPsql, $con);
IF (mysql_num_rows($MoneypplSearch)>0){
print "<TR><TD></TD></TR>";
do{
print "<TR><TD><font color='#6495ED'>";
print $MPsearch[0];
print "</TD> by ";
print $MPsearch[1];
print "</TR><TR><BR><TD><i>";
print $MPsearch[2];
print "</td></TR><TR><TD>People needed:</td><TD>";
print $MPsearch[3];
print "</TD></TR><TR><TD>Money needed:</TD><TD>";
print $MPsearch[4];
print "</TD></TR><BR>";
}while($MPsearch = mysql_fetch_row($MoneypplSearch));
}else {
print "<BR><BR>";
print "No Money or People results yet....";
}
?>
<BR><BR><BR>
<img src="VC/Images/border.jpg">
<?php include("http://dev.thinkquest.org/C004065/Quotes.php"); ?>
</CENTER>
</TABLE>
</BODY>
</HTML>
------------------
SR -
webshiju.com
www.jobxyz.com-IT Career Portal
ezipindia.com--WebStudio
"The fear of the LORD is the beginning of knowledge..."
[This message has been edited by Shiju Rajan (edited August 12, 2000).]