Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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)
ximex codestyle and typos
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>​$sql ​   = "SELECT * FROM ". TBL_DATES;​ +<code php>​$sql ​   = 'SELECT * FROM '. TBL_DATES;​ 
-$dates_result ​= mysql_query($sql,​ $g_adm_con);​ +$datesResult ​= mysql_query($sql,​ $g_adm_con);​ 
-db_error($dates_result,​__FILE__,​__LINE__);​+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>​$sql ​   = "SELECT * FROM ". TBL_DATES;​ +<code php>​$sql ​   = 'SELECT * FROM '. TBL_DATES;​ 
-$dates_result ​= $gDb->​query($sql);​+$datesResult ​= $gDb->​query($sql);​
  
-while($row = $gDb->​fetch_array($dates_result))+while ($row = $gDb->​fetch_array($datesResult))
 { {
    ...    ...
 }</​code>​ }</​code>​
  
-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.
  • en/entwickler/datenbankzugriffsklasse.txt
  • Last modified: 2016/12/03 15:13
  • by ximex