2
Contributors
2
Replies
5
Views
6 Years
Discussion Span
Last Post by Stefano Mtangoo
0

Here is my current code...

<?php
    $myServer = "*****";
    $myUser = "*****";
    $myPass = "******";
    $myDB = "*****";
    $dbhandle = mssql_connect($myServer, $myUser, $myPass)
        or die("Couldn't connect to SQL Server on $myServer"); 
    $selected = mssql_select_db($myDB, $dbhandle)
        or die("Couldn't open database $myDB"); 
    $query = "SELECT courses.course_name, courses.length_hours, course_details.objectives 
        FROM courses, course_details
        WHERE (courses.course_code = course_details.course_code) and format = 'Online' and employees = '1'";
    $result = mssql_query($query);
    $numRows = mssql_num_rows($result); 
?>
    <table border="1" id="myTable">
        <thead>
            <tr>
                <th>Course</th>
                <th>Overview</th>
                <th>Length</th>
            </tr>
        </thead>
        <tbody>
<?php
    while($row = mssql_fetch_array($result)) {
        echo "<tr><td vailgn=\"top\">" 
            . $row["course_name"] 
            . "&nbsp;</td><td>" 
            . $row["objectives"] 
            . "&nbsp;</td><td valign=\"top\" align=\"center\">" 
            . $row["length_hours"] 
            . "&nbsp;</td></tr>\n";
    }
?>
</tbody>
</table>
<?php
    mssql_close($dbhandle);
?>

Edited by Reverend Jim: Fixed formatting

0

I need to write code to have a search box that will search a mssql database.

Dig deep and once you have your code and hit a wall come back!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.