Re: PHP/Mysql Script help.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have still been getting errors, so here goes again.

 

I am attempting to design a script that presents the user with a form with
26 letters to choose from.  When they pick a letter I want it to take them
to a list of all the entries in my database that begin with the letter they
selected in link form.  When they click on the term, I want it to pull up
the info for that entry.

 

I have made some changes and added some error checking:

 

<?php

            

require("racesetup.php");

$con = mysql_connect($host, $user, $pass) or die(mysql_error());

 

mysql_select_db($db, $con) or die(mysql_error());

 

// display individual record

 

if ($id) {

error_reporting(E_ALL);

   $result = mysql_query("SELECT * FROM nuke_race WHERE id=$id",$con) or
die(mysql_error());

 

   $myrow = mysql_fetch_array($result) or die(mysql_error());

 

   printf("<b>Race:</b> %s\n<br>", $myrow["race"]);

      echo "<br>";           

   printf("<b>Description:</b> %s\n<br>", $myrow["racetxt"]);

      echo "<br>";

      echo "<br><h3><a href=\"javascript:history.go(-1)\">Back</a></h3>";


 

} elseif ($_Post['letter']) {

if ($_Post['letter']) {

$result = mysql_query("SELECT * FROM nuke_race WHERE race LIKE
$_Post['letter']%",$con) or die(mysql_error());

    if ($myrow = mysql_fetch_array($result)) {

 

      // display list if there are records to display

 

      do {

 

        printf("<a href=\"%s?id=%s\">%s</a><br>\n", $PHP_SELF, $myrow["id"],
$myrow["race"]);

 

      } while ($myrow = mysql_fetch_array($result));

   

";          

}

else  {

echo"<form name=\"letter\" method=\"post\" action=\"races.php\">"

  . "  <p>Pick a letter to begin your search</p>"

  . "  <p> "

  . "    <select name=\"select\">"

  . "      <option value=\"a\">A</option>"

  . "      <option value=\"b\">B</option>"

  . "      <option value=\"c\">C</option>"

  . "      <option value=\"d\">D</option>"

  . "      <option value=\"e\">E</option>"

  . "      <option value=\"f\">F</option>"

  . "      <option value=\"g\">G</option>"

  . "      <option value=\"h\">H</option>"

  . "      <option value=\"i\">I</option>"

  . "      <option value=\"j\">J</option>"

  . "      <option value=\"k\">K</option>"

  . "      <option value=\"L\">L</option>"

  . "      <option value=\"m\">M</option>"

  . "      <option value=\"n\">N</option>"

  . "      <option value=\"o\">O</option>"

  . "      <option value=\"p\">P</option>"

  . "      <option value=\"q\">Q</option>"

  . "      <option value=\"r\">R</option>"

  . "      <option value=\"s\">S</option>"

  . "      <option value=\"t\">T</option>"

  . "      <option value=\"u\">U</option>"

  . "      <option value=\"v\">V</option>"

  . "      <option value=\"w\">W</option>"

  . "      <option value=\"x\">X</option>"

  . "      <option value=\"y\">Y</option>"

  . "      <option value=\"z\">Z</option>"

  . "    </select>"

  . "  </p>"

  . "  <p> "

  . "    <input type=\"Submit\" name=\"submit\" value=\"Enter
information\">"

  . "  </p>"

  . "</form>"

  . "

 ."";

 

}

 else {

      // no records to display

 

      echo "Sorry, no records were found!";        

    }

  

?>

 

I am still getting "Parse error: parse error, unexpected T_STRING in
/home/wwwfulc/public_html/st/races.php on line 38"

 

This is line 38

 

echo"<form name=\"letter\" method=\"post\" action=\"races.php\">"

 

 

Thanks for your help!

 

Yours in Service,

Jason Britton

Scar's <http://st.fulco.net/>  Legion

scar@st.fulco.net

 

Vincit imitationem veritas.

 


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux