Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - My search returns no results! >Thread Next - Re: My search returns no results! Re: My search returns no results!To: NULL Date: 12/3/2004 9:58:00 AM You're a student, go figure this yourself - it's not an XML question.
Ask on a PHP list for the correct way to build XML data from a DB
transcaction.
First View->Source to see if you have any XML in the page
Your 2nd step will be to establish if you get any output, so turn on
<?php error_reporting(E_ALL); ?>
Bye,
Neil
On 2 Dec 2004 14:13:01 -0800, tessan@t... (Tessie Sweden) wrote:
>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);
>
>?>
>***************************************************************************''
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
