3,035
edits
Line 134: | Line 134: | ||
} | } | ||
Here, $dbh is a static handle so if it has already been instantiated, it can be reused | Here, $dbh is a static handle so if it has already been instantiated, it can be reused for concurrent calls of the query function -- likewise with $result. db_connect() is another wrapper that connects to the database and db_error() is a wrapper to handle database errors gracefully (and silently) - we will not go into that right now, assume it works for the example. This ultimately lets us to reduce the code: | ||
$sql_result = db_query("SELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.id"); | $sql_result = db_query("SELECT * FROM table1 INNER JOIN table2 ON table1.id = table2.id"); |
edits