php code only work in local host but doesn't work when I upload to my server

I uploaded the php to my server and I am able to connect to it.
I got error message:
Fatal error: Call to a member function query() on a non-object in E:\kunden\homepages\10\d296577483\www\index.php on line 9

Here is my php code
[php]<?php
require_once(‘database.php’);

// Get all categories

$query = 'SELECT * FROM simpleemployee
          ORDER BY Giftcert';
$employees = $db->query($query);

?>

Service Tracking System
<div id="header">
   <h1>Service Tracking System</h1>
    </div>

<div id="main">

    

    <div id="content">
        <!-- display a table of Gift Certificate and balance -->
        <h2><Gift Certificate Balance></h2>
        <table>
            <tr>
            <th>Date/Time</th>

                <th>Service/Order Number</th>
                <th>Status</th>
				<th>Note</th>
	              <th></th>
            </tr>
            
	<?php foreach ($employees as $employee) : ?>
            <tr>
                <td><?php echo $employee['datetime']; ?></td>
	    <td><?php echo $employee['Giftcert']; ?></td>
		<td><?php echo $employee['Name']; ?></td>
                <td><?php echo $employee['Balance']; ?></td>

               
                
	    <td><form action="delete_employee.php" method="post"
                          id="delete_employee_form">
                   <input type="hidden" name="Giftcert"
                          value="<?php echo $employee['Giftcert']; ?>" />
						  <input type="submit" value="Delete" />
                </form></td>
            </tr>
            <?php endforeach; ?>
        </table>
        <p><a href="add_employee_form.php">Update Service/Order Status</a></p>
        <p><a href="search_form.php">Obtain Service Status</a></p>

    </div>
</div>

<div id="footer">
    <p>&copy; <?php echo date("Y"); ?> PC-Zone, Inc.</p>
</div>

</div><!-- end page -->
[/php]

How does you database.php look? (remember to change login credentials)

Especially wondering if you have any form of error handling on the db connection as $db isn’t an object when trying to run the query.

Sponsor our Newsletter | Privacy Policy | Terms of Service