Advertisement

04.23.2008 at 01:50AM PDT, ID: 23345767
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

Error with PHP script

Asked by bejhan in PHP Scripting Language, PHP and Databases

Tags:

I am trying to write a PHP script that will access data from my MS Access database. I am pretty new to PHP so I have just been manipulating code. When I try to access my page I get an Internal Server Error with suggested cause: Programming Error.

Can someone please correct my code.

I used this page as my reference:
http://www.phpbuilder.com/columns/siddarth20000228.php3?page=5

I am running Apache with PHP installed.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
<html>
<body>
<?php
 
function Output_Entries() {
    /*
        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( 'Stats' , 'root', '' );
    if (!$cnx) {
        Error_handler( "Error in odbc_connect" , $cnx );
    }
 
    // send a simple odbc query . returns an odbc cursor
    $cur= odbc_exec( $cnx, "select #, Player, Position, [Games Played], Goals, Assists, Points, Shootout, [Penalty Minutes] from tblStats" );
    if (!$cur) {
        Error_handler( "Error in odbc_exec (no cursor returned) " , $cnx );
    }
    echo "<table width="557" border="1">
    <tr>
      <th width="12" scope="col"><div align="center" class="style5 style16">
        <div align="center">#</div>
      </div>      </th>
      <th width="102" scope="col"><div align="center" class="style5 style16">
        <div align="center">Player</div>
      </div>      </th>
      <th width="53" scope="col"><div align="center" class="style5 style16">
        <div align="center">Position</div>
      </div>      </th>
      <th width="97" scope="col"><div align="center" class="style5 style16">
        <div align="center">Games Played </div>
      </div></th>
      <th width="39" scope="col"><div align="center" class="style5 style16">
        <div align="center">Goals</div>
      </div>      </th>
      <th width="48" scope="col"><div align="center" class="style5 style16">
        <div align="center">Assists</div>
      </div>      </th>
      <th width="41" scope="col"><div align="center" class="style5 style16">
        <div align="center">Points</div>
      </div>      </th>
      <th width="60" scope="col"><div align="center" class="style5 style16">
        <div align="center">Shootout</div>
      </div>      </th>
      <th width="113" scope="col"><div align="center" class="style5 style16">
        <div align="center">Penalty Minutes</div>
      </div>     </th>
    </tr>";
 
    $nbrow=0;   //Local variable to count number of rows
 
    // fetch the succesive result rows
    while( odbc_fetch_row( $cur ) ) {
        $nbrow++;
        $# = odbc_result( $cur, 1 );
        $Player = odbc_result( $cur, 2 );
        $Position = odbc_result( $cur, 3 );
        $GP = odbc_result( $cur, 4 );
        $Goals = odbc_result( $cur, 5 );
        $Assists = odbc_result( $cur, 6 );
        $Points = odbc_result( $cur, 7 );
        $Shootout = odbc_result( $cur, 8 );
		$PM = odbc_result( $cur, 9 );
 
        echo "<tr height="17">
      <td height="17"><div align="center">$#</div></td>
      <td><div align="center">$Player</div></td>
      <td><div align="center">$Position</div></td>
      <td><div align="center">$GP</div></td>
      <td><div align="center">$Goals</div></td>
      <td><div align="center">$Assists</div></td>
      <td><div align="center">$Points</div></td>
      <td><div align="center">$Shootout</div></td>
      <td><div align="center">$PM</div></td>
    </tr>";
    }
 
    echo "</table>";
 
    // close the connection. important if persistent connection are "On"
    odbc_close( $cnx);
}
 
function Error_Handler( $msg, $cnx ) {
    echo "$msg \n";
    odbc_close( $cnx);
    exit();
}
 
Output_Entries();
 
?>
</body>
</html>
[+][-]04.23.2008 at 01:57AM PDT, ID: 21418663

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 10:56AM PDT, ID: 21423434

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 11:11AM PDT, ID: 21423599

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 09:48PM PDT, ID: 21427819

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 10:32PM PDT, ID: 21427958

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, PHP and Databases
Tags: PHP
Sign Up Now!
Solution Provided By: bejhan
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628