Hi Wizards,
I'm working to make a little application where visitors can search for a therapist in our country (Sweden). The options are "part of country" and "female or male therapist".
Everything has gone well until I want the visitor to be able to click a submit button that is there after each therapist name in an array (a little form in every row, with the <input name=\"$terapeutid\">), to send a variable to the presentation page of the therapist.
The presentation page is supposed to make a mysql_query "WHERE terapeutid = $teraputid" and line up all the fields of information for this one therapist (including an image) in a table.
I'm stuck here. I get a Warning that this is not a legal MySQL result resource.
Can anyone see what I have done wrong (or if anything is right ;-)?
Warmly, Lars
Here is the code for the file "teraput.php":
<TABLE CELLSPACING=5 width="500" BORDER="0">
<?
// Create database connection
$link = @mysql_connect ("host", "user", "password")
or die ("Anslutningen funkade inte! Ledsen.");
$databas = mysql_select_db("a0088600_db1");
// Define what'll be selected
$sql = "SELECT * FROM teraputer WHERE terapeutid = $terapeutid";
$result = mysql_query("$sql");
while($rad = mysql_fetch_array($result)) {
echo "<TR>";
echo "<TD VALIGN=\"top\"> </TD>";
echo "<TD VALIGN=\"top\" ALIGN=\"left\">";
echo "<H2><B>";
echo $rad[fornamn]." ".$rad[efternamn];
echo "</B></H2><BR>";
echo "</TD></TR>";
echo "<TR><TD WIDTH=\"150\" VALIGN=\"top\">";
echo "<IMG SRC=\"../images/";
echo $rad[bild];
echo "\" WIDTH=\"150\">";
echo "</TD><TD WIDTH=\"350\" VALIGN=\"top\">";
echo "<TABLE WIDTH=\"350\" BORDER=\"0\" CELLSPACING=\"5\" >";
echo "<TR><TD VALIGN=\"top\"><B>Inriktning:</B></TD>";
echo "<TD VALIGN=\"top\">";
echo $rad[inriktning];
echo "</TD>";
echo "</TR><TR>";
echo "<TD VALIGN=\"top\"><B>Bakgrund:</B></TD>";
echo "<TD VALIGN=\"top\">";
echo $rad[bakgrund];
echo "</TD>";
echo "</TR><TR>";
echo "<TD VALIGN=\"top\"><B>Adress:</B></TD>";
echo "<TD VALIGN=\"top\">";
echo $rad[adress].", ".$rad[ort];
echo "<BR>";
echo "Tel: ";
echo $rad[telefon];
echo ", ";
echo $rad[mobil];
echo ". Fax: ";
echo $rad[fax];
echo "<BR>";
echo "<I>e-post ";
echo $rad[email];
echo "</I><BR>";
echo "Hemsida: ";
echo $rad[web];
echo "</TD></TR></TABLE>";
echo "</TD></TR>";
}
mysql_close($link);
?>
</TABLE>