hello,
in the following function code, i am able to display all records which matches the formvariable comming from another script.
i want to put an error message if the record is not matching the fieldname "Invalid Identity number".
your help will be appreciated
thanx
salim
function Output_Entries($idno) {
/
Make the connection to the database. The syntax is
odbc_connect( 'SYSTEM_DSN' , 'USER', 'PASSWORD' );
$cnx will hold the
pconnect is used to establish a persistent database
connection to the Database until the procedure is completed.
/
$cnx = odbc_connect( 'final' , 'root', '' );
if (!$cnx) {
Error_handler( "Error in odbc_connect" , $cnx );
}
// send a simple odbc query . returns an odbc cursor
$cur= odbc_exec( $cnx, "SELECT * FROM Adm_Result Where Number LIKE '$idno' ");
$nbrow=0; //Local variable to count number of rows
// fetch the succesive result rows
while( odbc_fetch_row( $cur ) )
{
$nbrow++;
$AutoNumber = odbc_result( $cur, 1 ); // get the field "Autonumber"
$Number = odbc_result( $cur, 2 ); // get the field "Number"
$FrstName = odbc_result( $cur, 3 ); // get the field "First Name"
$FthrName = odbc_result( $cur, 4 ); // get the field "Father Name"
$GrndName = odbc_result( $cur, 5 ); // get the field "Grand Father Name"
$LstName = odbc_result( $cur, 6 ); // get the field "Last Name"
$Major = odbc_result( $cur, 7 ); // get the field "Major"
$Speciality = odbc_result( $cur, 8 ); // get the field "Speciality"
$Grade = odbc_result( $cur, 9 ); // get the field "Grade"
$ExtraPoint = odbc_result( $cur, 10 ); // get the field "Extra Point"
$Exam = odbc_result( $cur, 11 ); // get the field "Exam"
$FinalExam = odbc_result( $cur, 12 ); // get the field "Final Exam"
$Status = odbc_result( $cur, 13 ); // get the field "Status"
$YearGradu = odbc_result( $cur, 14 ); // get the field "Year Graduation"
if ($idno = $Number) {
echo "<table border=1><tr><th>Index</th><th>Number</th><th>First Name</th><th>Father Name </th><th>Grand Father Name</th> <th>Last Name</th> <th>Major</th><th>Speciality</th><th>Grade</th><th>Extra Point</th><th>Exam</th><th>Final Exam</th><th>Status</th><th>Year Graduated</th></tr>\n";
echo "<tr><td>$AutoNumber</td><td>$Number</td><td>$FrstName</td><td>$FthrName </td><td>$GrndName</td> <td>$LstName</td> <td>$Major</td><td>$Speciality</td><td>$Grade</td><td>$ExtraPoint</td><td>$Exam</td>
<td>$FinalExam</td><td>$Status</td><td>$YearGradu</td></tr>\n";
} // closed braces for if condition
echo "<tr><td colspan=2>$nbrow entries , $idno</td></tr></table>";
} //closed braces for while loop
// close the connection. important if persistent connection are "On"
odbc_close( $cnx);
}