question archive Use MySQL to create a database of information about used trucks for sale, similar to the cars database used in this chapter
Subject:Computer SciencePrice:2.89 Bought3
Use MySQL to create a database of information about used trucks for sale, similar to the cars database used in this chapter. Make up equipment that characterizes trucks. Get the raw data from the ad section of your local newspaper. Instead of using the states in the cars database, divide your town into four sections and use them.
No changes to access_cars.php are required to handle UPDATE and INSERT SQL commands. The mysqli_query function takes SQL commands as its parameter, whether they are queries, updates, or inserts. For example, we could have:
$query =
"INSERT INTO Corvettes VALUES (38, ′convertible′, 17.1, 1993, 15)";
$result = mysqli_query($db, $query);
To determine the number of rows that were affected by the INSERT command, the mysqli_affected_rows function is used (with the result as its parameter).