I don't know why, but I can't insert data to database. Please take a look at the function to insert data below:
Code: Select all
public static function insertNewAddressData($addressID, $typeID, $userID, $streetAddress, $state, $city, $postalCode, $country, $defaultAddress) {
$query = "INSERT INTO tbladdress (addressID, typeID, userID, streetAddress, state, city, postalCode, country, defaultAddress, addedOn, lastUpdatedOn) VALUES (null, $typeID, $userID, $streetAddress, $state, $city, $postalCode, $country, $defaultAddress, NOW(), NULL)";
$result = mysqli_query(MySQLConnection::connectToMySQL(), $query);
if (!($result)) {
die ("Failed inserting address data into database.");
}
echo mysqli_affected_rows($result). ' address(es) have been added to the database.';
mysqli_close(MySQLConnection::connectToMySQL());
}Thank you,
Chris