Bring the table processing 'loop' into line with the recordset processing 'loop'.
=dn


----- Original Message ----- 
From: "GEORGINA ELAINE BAILEY" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 27 October 2001 15:28
Subject: [PHP-DB] PHP


> Ok, I have a HTML form, where I can select a module type and a keyword. I
> then submit this and want a table return with all the projects that fulfil
> that criteria. However, instead of returning all the projects that fulfil
> the criteria, it only returns the first one I entered. It doesn't seem to
> be bringing back any details of projects I entered via the Web site, even
> though they fill the criteria, and it is only returning those projects
> entered directly into the database using SQL.
> 
> Here's my PHP code:-
> 
> <! search1.php4>
> 
> <html>
> <head>
> <title>Project Database - Search Results</title>
> </head>
> 
> <body bgcolor="#9966FF" link="lime" vlink="yellow">
> <div align="center"><img src="compSciPageBanner.gif"/></div>
> 
> 
> 
> <?php
> 
> 
> if ($submit == "Submit")
> {
> // The submit button was clicked!
> // Get the input and use it to retrieve information from the database.
> 
> //make a connection to the database
> PutEnv("ORACLE_HOME=/usr/local/applic/oracle/816");
> $connection = OCILogon("geb97","f8s0g99","trdb");
> 
> //if a connection to the database is not made output a message
> if (!$connection)
>   {
>     echo "I couldn't make a connection!"; 
> exit;
>   }
> 
>   //formulate the query
> $query = "SELECT PROJECT.originator, PROJECT.title, PROJECT.projectID,
> PROJECT.status, PROJECT.specialSkills, PROJECT.moduleID FROM PROJECT,
> PROJKEY, KEYWORD WHERE PROJECT.projectID=PROJKEY.projectID AND
> KEYWORD.keyID=PROJKEY.keyID AND PROJECT.moduleID='$moduleID' AND
> KEYWORD.keyword='$keyword'";
> 
> 
> //parse the statement
> $qry_statement = OCIParse ($connection, $query); //or die ("Couldn't parse
> statement");
>   
> 
>   //execute the query statement
> OCIExecute($qry_statement);  //or die ("Couldn't execute query");
>  
> //a paragraph break, so the table doesn't appear right at the top of the page
> echo "<p>";
> 
> //create a table into which the results can be placed
> echo "<table align=\"center\" border=\"1\" cellpadding=\"8\"
> cellspacing=\"2\" bgcolor=\"silver\">";
> echo "<tr valign=\"center\"><th>ORIGINATOR</th><th>TITLE</th><th>PROJECT
> NUMBER</th><th>AVAILABILITY</th><th>SPECIAL SKILLS</th></tr>";
> 
>   
> //retrieve the results of the query statement and present them in the
> following way
> while (ocifetch($qry_statement))
>   {
> 
> //insert the results into the table
> echo "<tr align =\"center\">";
> 
> echo "<td>" .OCIresult($qry_statement, 'ORIGINATOR'). "</td>";
> 
> echo "<td>" .OCIresult($qry_statement, 'TITLE'). "</td>";
> 
> echo "<td>" .OCIresult($qry_statement, 'PROJECTID'). "</td>"; 
> 
> echo "<td>" .OCIresult($qry_statement, 'STATUS'). "</td>"; 
> 
> echo "<td>" .OCIresult($qry_statement, 'SPECIALSKILLS'). "</td>";
> 
> echo "</tr>";
> 
> 
> 
> //close table and close the paragraph
> echo "</table>";
> echo "</p>";
> 
> }
> 
> //commits the information added to the database
> OCICommit ($connection);
> 
> 
> //log off the database
> OCILogoff ($connection);
> 
> }//end of if statement 
>  
> //just a note
> echo "<p><b><div align=\"center\">
> If the table above appears empty, this means that no projects fulfil your
> criteria and you will need to search again
> </div></b></p>";
> 
> 
> //provide a link back to the UWA home page
> echo "<p><div align=\"center\">
> <pre>
> <a href = \"http://www.aber.ac.uk\";>Return to UWA Home Page</a>
> 
> </pre></div></p>";
> 
> //provide a link to the Computer Science Home Page
> echo "<div align=\"center\">
> <pre>
> <a href = \"http://www.aber.ac.uk/compsci\";>Return to Computer Science Home
> Page</a>
> 
> </pre></div>";
> 
> //provide a link back to the Project Database main menu
> echo "<div align=\"center\">
> <pre>
> <a href = \"mainMenu.html\">Return to Project Database Main Menu</a>
> </pre></div>";
> 
> 
> 
> ?> <! end of PHP script>
> 
> 
> </body> 
> </html> 
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to