Author to Book TABLE
AUTHOR TO BOOK TABLE | |||
---|---|---|---|
Author ID | Book ID | ||
17 | 3 | ||
17 | 12 | ||
17 | 26 | ||
17 | 32 | ||
25 | 23 | ||
25 | 24 | ||
25 | 25 | ||
25 | 26 | ||
2 | 7 | ||
1 | 3 | ||
1 | 4 | ||
1 | 5 | ||
30 | 33 | ||
30 | 34 | ||
24 | 18 | ||
12 | 12 | ||
31 | 35 | ||
31 | 36 | ||
31 | 37 | ||
32 | 38 | ||
32 | 39 | ||
36 | 46 | ||
36 | 47 | ||
36 | 48 | ||
37 | 49 | ||
37 | 50 | ||
37 | 51 | ||
38 | 35 | ||
38 | 37 | ||
38 | 43 | ||
20 | 3 | ||
39 | 52 | ||
39 | 53 | ||
39 | 54 | ||
40 | 55 | ||
40 | 56 | ||
40 | 57 | ||
41 | 58 | ||
41 | 59 | ||
41 | 60 | ||
42 | 61 | ||
42 | 62 | ||
42 | 63 | ||
43 | 64 | ||
43 | 65 | ||
43 | 66 | ||
44 | 67 | ||
44 | 68 | ||
44 | 69 | ||
45 | 70 | ||
45 | 71 | ||
45 | 72 | ||
46 | 73 | ||
46 | 74 | ||
46 | 75 | ||
47 | 76 | ||
47 | 77 | ||
47 | 78 |
Note: Only the ID's of the Authors and ID's of the Books are in this table. This is a simple method to track the assignments of authors to books and vise-versa. This allows the Author and Book tables to be used by way of their specific ID's but does not require each table to show their relationships.
// The following two functions should be in your code // -- OR -- be in the includes directory under "functions.php" // AND include that file in this script. // ================= functions ================= //-------------- show db errors -------------- // this function reports mysql errors with line number and script name function report($query, $line, $file) { echo($query . '' . $line . '
' . $file . '
'); } //-------------- clean data for input into db -------------- // this function cleans all text for inserting into db // in other words, this function returns SQL injection-proof strings function cleanForDB($con, $str) { $str = stripslashes($str); $str = trim($str); $str = mysqli_real_escape_string($con, $str); return $str; }