start.php Track employees, client contact information, project statuses, and timesheets Part of the Super Basic Small Business Tracker Created by Raquel Vélez ****************************************************** */ // ----- INCLUDES ------ include "globals.php"; include "buildDB.php"; // ----- BEGIN CODE ----- // Check to see if the db exists - if so, SELECT it. // If not, set up the DB AND all of its tables. BuildDBANDTables($db_name); $con = OpenServerConnection(); if (!mysql_SELECT_db($db_name, $con)) { die('Cannot connect to DB: ' . mysql_error()); } ?> <h1>Super Basic Small Business Tracker</h1> <h2>For Imaginative Company RDV</h2> <?php // **** EMPLOYEES **** $result = mysql_query("SELECT * FROM employees WHERE time_deleted is NULL"); echo "<hr/><h3>EMPLOYEES</h3>"; echo "<table border='1'>\n <tr>\n <th>Employee ID</th>\n <th>First Name</th>\n <th>Last Name</th>\n </tr>"; while ($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td> <a href='editEmployee.php?id={$row['id']}'>" . $row[id] . "</a> </td>";
<?php $dbhost = "localhost"; $dbuser = "******"; $dbpass = ""; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if (!$conn) { die('Could not connect: ' . mysql()); } $sql = 'SELECT emp_id, emp_name, emp_address, emp_salary FROM employee'; mysql_SELECT_db('test_db'); $retval = mysql_query($sql, $conn); if (!$retval) { die('Could not get data:' . mysql_error()); } while ($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "EMP ID :{$row['emp_id']} <br> " . "EMP NAME : {$row['emp_name']} <br> " . "EMP SALARY : {$row['emp_salary']} <br> " . "--------------------------------<br>"; } echo "Fetched data successfully\n"; mysql_close($conn);