php and databases

need help please its for a assignment that i am doing in class and i can not get it to read the database and print it to the screen it just comes back with

The Wallingford Motors CRM Customer Contacts List
ViewCustomerContacts
ContactID LastName FirstName Date NickName Type Remark “; While($RecordSetRow = odbc_fetch_array($RecordSet)) { echo”"; echo"" . $RecordSetRow[‘contactID’]. “”; echo"" . $RecordSetRow[‘LastName’]. “”; echo"" . $RecordSetRow[‘FirstName’]. “”; echo"" . $RecordSetRow[‘Date’]. “”; echo"" . $RecordSetRow[‘NickName’]. “”; echo"" . $RecordSetRow[‘Type’]. “”; echo"" . $RecordSetRow[‘Remarks’]. “”; echo""; echo"" //Close Connection odbc_close($conn); ?>

Return to Wallingford Motors Home Page

sorry that the output is messy

here is the code that i am doing and i can not seem to find where i went wrong please help me

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 4.01 Frameset//EN"
 <head>
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
         <title>CusomContacts PHP Page</title>
         <style type="text/css">
               h1 {text-align: center; color: blue}
               h2 {font-family: Ariel, sans-serif; text-align: left; color: blue}
               p.footer {text-align: center}
               table.output {font-family: Ariel, sans-serif}
         </style>
     </head>
     <body>
     <?php
         // Get connection
         $conn = odbc_connect ('WM', ' ', ' ');

        // Test connection
        if(!$Conn)
             {
                    exit ("ODBC Connection Failed: " . $Conn);
             }
         // Create SQL statement
         $SQL = "SELECT * from viewCustomerContacts";

         // Execute SQL statement

         $RecordSet = odbc_exec ($Conn,$SQL);

         // Test existence of recordset
         if (!$RecordSet)
                 {
                 exit ("SQL Statement Error: ". $SQL);
                 }
       ?>
              <!--Page Headers -->
              <h1> 
                   The Wallingford Motors CRM Customer Contacts List
              </h1>
              <hr />
              <h2>
                    ViewCustomerContacts
              </h2>
	<?php
             //Table Headers
			 echo "<table class= 'output' border='1'>
			 <tr>
					<th>ContactID</th>
					<th>LastName</th>
					<th>FirstName</th>
					<th>Date</th>
					<th>NickName</th>
					<th>Type</th>
					<th>Remark</th>
			</tr>";
		     While($RecordSetRow = odbc_fetch_array($RecordSet))
					{
					echo"<tr>";
					echo"<td>" . $RecordSetRow['contactID']. "</td>";
					echo"<td>" . $RecordSetRow['LastName']. "</td>";
					echo"<td>" . $RecordSetRow['FirstName']. "</td>";
					echo"<td>" . $RecordSetRow['Date']. "</td>";
					echo"<td>" . $RecordSetRow['NickName']. "</td>";
					echo"<td>" . $RecordSetRow['Type']. "</td>";
					echo"<td>" . $RecordSetRow['Remarks']. "</td>";
					echo"<tr>";
			echo"<table>"
					//Close Connection
					odbc_close($conn);
         ?>
              <br />
              <hr />
              <p class="footer">
                    <a href="../WM/index.html">Return to Wallingford Motors Home Page</a>
              </p>
              <hr />
        </body>
        </html>

I am using notepad ++ to edit and write this

[php]echo"

";
// } <-- closing bracket missing here…
echo"" // ; <-- missing here.
//Close Connection
odbc_close($conn);
?>
[/php]
:wink:
Sponsor our Newsletter | Privacy Policy | Terms of Service