public function initCustomer() { global $SQL_ANY_STRING; $query = "SELECT * FROM " . self::$tableName . " WHERE "; $lname_string = ""; $fname_string = ""; if ($this->lname) { $lname_string = self::$lnameStr . ' = "' . $this->lname . '"'; } else { $lname_string = self::$lnameStr . " {$SQL_ANY_STRING}"; } if ($this->fname) { $fname_string = " AND " . self::$fnameStr . " = " . '"' . $this->fname . '"'; } else { $fname_string = " AND " . self::$fnameStr . " {$SQL_ANY_STRING}"; } $query = $query . $lname_string . $fname_string; // echo "<br/>debug: $query"; $result = $this->db_conn->query($query); if ($result == true) { if ($result->num_rows > 1) { $result->free(); // more than one customer with the same name // display them in a table showSearchPanel(); showSummary($query); showVersionInfo(); } else { if ($result->num_rows == 1) { $result->data_seek(0); $row = $result->fetch_assoc(); $custId = $row[self::$custIdStr]; $result->free(); // single customer found, show the details header("Location: showdetails.php?custId=" . $custId); } else { $this->addNewCustomer(); } } // adding new user } else { exit("<h1>Unable to connect to the database!</h1>"); } }
print ' </td>'; // output the point range (1 .. 100 ) print '<td>'; print ' <select name="point">'; for ($i = 1; $i <= 100; $i++) { print '<option value="' . $i . '">' . $i . '</option>'; } print ' </select>'; print '</td>'; // output the submit button print ' <td align="left"><input type="submit" name="submit" value="Add Points"></td>'; print ' <input type="hidden" name="id" value="' . $custId . '">'; print '</form>'; // display the email receipt button if ($customer->email != "") { print '<form method="post" action="email.php">'; print ' <td align="left"><input type="submit" name="email" value="Email Receipt"></td>'; print ' <input type="hidden" name="id" value="' . $custId . '">'; print '</form>'; } // print the end of the html table print ' </tr>'; print '</table>'; // display the version information showVersionInfo(); ?> </body> </html>