Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| en:entwickler:datenbankzugriffsklasse [2015/11/04 23:02] – thomas-rcv | en:entwickler:datenbankzugriffsklasse [2016/12/03 15:13] (current) – codestyle and typos ximex | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Database Access Class ====== | ====== Database Access Class ====== | ||
| - | |||
| Since version 2.0, there is now a class for database access. This class is similar to the table access classes of 2 parts. One general class **DB** and the respective extension, in our case **MySqlDb**. | Since version 2.0, there is now a class for database access. This class is similar to the table access classes of 2 parts. One general class **DB** and the respective extension, in our case **MySqlDb**. | ||
| Line 14: | Line 13: | ||
| In code, the change looks like this: | In code, the change looks like this: | ||
| **Previous Code** | **Previous Code** | ||
| - | <code php> | + | <code php> |
| - | $dates_result | + | $datesResult |
| - | db_error($dates_result, | + | db_error($datesResult, __FILE__, __LINE__); |
| - | while($row = mysql_fetch_array($dates_result)) | + | while ($row = mysql_fetch_array($datesResult)) |
| { | { | ||
| ... | ... | ||
| Line 24: | Line 23: | ||
| **New Code** | **New Code** | ||
| - | <code php> | + | <code php> |
| - | $dates_result | + | $datesResult |
| - | while($row = $gDb-> | + | while ($row = $gDb-> |
| { | { | ||
| ... | ... | ||
| }</ | }</ | ||
| - | DThe Connection-ID must not be handed over, as this is managed in the class. Otherwise, all handovers are remained as it was in the original MySQL functions. | + | The Connection-ID must not be handed over, as this is managed in the class. Otherwise, all handovers are remained as it was in the original MySQL functions. |
| If in the loop any additional SQL statements are executed, the resource ID(result) may not be transferred. Internally, the last will be automatically used. | If in the loop any additional SQL statements are executed, the resource ID(result) may not be transferred. Internally, the last will be automatically used. | ||