CODE
<?php $record_id= $_GET['(TEXT IN URL)']; //set variables to connect to the database $hostName = "(FILL IN HOSTNAME FOR DB)"; $userName = "(FILL IN USERNAME FOR DB)"; $password = "(FILL IN PASSWORD FOR DB)"; $dbName = "(FILL IN DB NAME)"; // make connection to database mysql_connect($hostName, $userName, $password) or die( "Unable to connect to host $hostName"); mysql_select_db($dbName) or die("Unable to select database $dbName"); // Select all the fields in all the records of the table WHERE a condtion is met (set by the "WHERE" clause) $query_display_restriction = "SELECT * from (FILL IN TABLE NAME) WHERE (DB FIELD NAME) = '(VARIABLE NAME FROM GET STATEMENT)";//the restriction is from the variable set in the "GET" statement at the top of the code. $result_display_restriction = mysql_query($query_display_restriction) /*or die(mysql_error())*/;//include the die statement to alert any errors in the query (remove /* and */ to uncomment) //set variables for the information needed from the database $variable1 = mysql_result($result_display_restriction,0, "field1"); $variable2 = mysql_result($result_display_restriction,0, "field2"); ?> <table> <tr> <td><?php echo $variable1; ?></td> </tr> <tr> <td><?php echo $variable2; ?></td> </tr> </table>DISPLAY
| Text part 1 |
| Text part 2 |
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
CODE
<?php $record_id= $_POST['(FIELD NAME FROM PREVIOUS PAGE)']; //set variables to connect to the database $hostName = "(FILL IN HOSTNAME FOR DB)"; $userName = "(FILL IN USERNAME FOR DB)"; $password = "(FILL IN PASSWORD FOR DB)"; $dbName = "(FILL IN DB NAME)"; // make connection to database mysql_connect($hostName, $userName, $password) or die( "Unable to connect to host $hostName"); mysql_select_db($dbName) or die("Unable to select database $dbName"); // Select all the fields in all the records of the table WHERE a condtion is met (set by the "WHERE" clause) $query_display_restriction = "SELECT * from (FILL IN TABLE NAME) WHERE (DB FIELD NAME) = '(VARIABLE NAME FROM POST STATEMENT)";//the restriction is from the variable set in the "POST" statemetn at the top of the code. $result_display_restriction = mysql_query($query_display_restriction) /*or die(mysql_error())*/;//include the die statement to alert any errors in the query (remove /* and */ to uncomment) //set variables for the information needed from the database $variable1 = mysql_result($result_display_restriction,0, "field1"); $variable2 = mysql_result($result_display_restriction,0, "field2"); ?> <table> <tr> <td><?php echo $variable1; ?></td> </tr> <tr> <td><?php echo $variable2; ?></td> </tr> </table>DISPLAY
| Text part 1 |
| Text part 2 |