Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


My search returns no results!

From: tessan@------.-- (------ ------)
To: NULL
Date: 12/2/2004 2:13:00 PM
A search from my input form returns no results from the database! An
exact match for "recipe_name"; for example: "fiskgryta" - only returns
a blank page! This should be a transformation from "php" through an
"xsl-stylesheet" and generate a nice html page of results. Please
refer to:

http://www.student.nada.kth.se/~u1j80hrt/2D1517/XMLprojekt/

to access all of my files!  I might add that this is ALL new to me!
Thanks in advance :)

Here's my "search.php"-file:
******************************************************************
<?php header("Content-type:text/xml;charset=utf-8");?>
<?php echo '<?xml-stylesheet type="text/xsl"
href="stylesheetrecept5.xsl"?>' ?>

<title>Receptdatabas</title>
<?php     

if (isset ($_GET['search']))// perform search only if a string was
entered.
  
{     
$srch="%".$search."%"; 
$dbH = mysql_connect("pub.gt.kth.se", "lisaalf", "lisaalf") or die
('Could not connect to MySQL server');
mysql_select_db("lisaalf") or die("Could not select database");  
$returnstring ="";

$query = "SELECT * FROM DESCRIPTION WHERE RECIPE_NAME ='$srch'"; 

$result = mysql_query($query)
or die("Query failed");

if ($result) 
{ 
while ($line = mysql_fetch_object($result)) { 

 	 $returnstring = $returnstring . "<recipe>";
 	 	  
   $RECIPE_ID = $line->RECIPE_ID;
   $RECIPE_NAME = $line->RECIPE_NAME;
   $CHEF = $line->CHEF;
   $TYPE = $line->TYPE;
   $DESCRIPTION = $line->DESCRIPTION;
	 
  $returnstring = $returnstring .
"<recipe_name>$RECIPE_NAME</recipe_name>";
  $returnstring = $returnstring . "<type>$TYPE</type>";
  $returnstring = $returnstring . "<chef>$CHEF</chef>";
  $returnstring = $returnstring .
"<description>$DESCRIPTION</description>";
	  
       $returnstring = $returnstring . "</recipe>"; 
       $query2 = "SELECT  RECIPE_ID, INGREDIENT, AMOUNT, UNIT
            FROM COOKBOOK
            WHERE RECIPE_ID=$RECIPE_ID
            ORDER BY RECIPE_ID ASC";
 
	$result2 = mysql_query($query2)
        or die("Query failed");

	while ($line = mysql_fetch_object($result2)){

	$RECIPE_ID = $line->RECIPE_ID;
        $INGREDIENT = $line->INGREDIENT;
        $AMOUNT = $line->AMOUNT;
        $UNIT = $line->UNIT;

     $returnstring = $returnstring . "<amount>$AMOUNT</amount>";
     $returnstring = $returnstring . "<unit>$UNIT</unit>";
     $returnstring = $returnstring .
"<ingredient>$INGREDIENT</ingredient>";
}	  
} // end while 


} else { echo "problems...."; } 
} else {  echo "Sokfaltet ar tomt.";
} 
    print utf8_encode($returnstring); 

?> 
***************************************************************************''


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent