Difference between revisions of "Database upgrade"

From OpenEMR Project Wiki
Line 12: Line 12:
<code>  
<code>  
  $result2 = sqlStatement("select * from lang_languages where lang_description = ?",array($GLOBALS['language_default']));
  $result2 = sqlStatement("select * from lang_languages where lang_description = ?",array($GLOBALS['language_default']));
</code>
Change the while clause to a `foreach $x as $y`. Also remove the `sqlNumRows`
<code>
$lres = sqlStatement("SELECT * FROM list_options " .
  "WHERE list_id = 'lbfnames' AND activity = 1 ORDER BY seq, title");
if (sqlNumRows($lres)) {
  while ($lrow = sqlFetchArray($lres)) {
    $option_id = $lrow['option_id']; // should start with LBF
    $title = $lrow['title'];
    genMiscLink('RBot','cod','2',xl_form_title($title),
      "patient_file/encounter/load_form.php?formname=$option_id");
  }
}
</code>
<code>
$lres = sqlStatement("SELECT * FROM list_options " .
  "WHERE list_id = 'lbfnames' AND activity = 1 ORDER BY seq, title");
if (sqlNumRows($lres)) {
  foreach ($lres as $lrow) {
    $option_id = $lrow['option_id']; // should start with LBF
    $title = $lrow['title'];
    genMiscLink('RBot','cod','2',xl_form_title($title),
      "patient_file/encounter/load_form.php?formname=$option_id");
  }
}
</code>
</code>

Revision as of 05:52, 29 September 2016

Upgrading ADODB to PDO.

Remove all sqlFetchArray() calls.

Example

$res2 = sqlStatement("select * from lang_languages where lang_description = ?",array($GLOBALS['language_default']));
for ($iter = 0;$row = sqlFetchArray($res2);$iter++)
$result2[$iter] = $row;`

Becomes

$result2 = sqlStatement("select * from lang_languages where lang_description = ?",array($GLOBALS['language_default']));

Change the while clause to a `foreach $x as $y`. Also remove the `sqlNumRows`

$lres = sqlStatement("SELECT * FROM list_options " .
 "WHERE list_id = 'lbfnames' AND activity = 1 ORDER BY seq, title");
if (sqlNumRows($lres)) {
 while ($lrow = sqlFetchArray($lres)) {
   $option_id = $lrow['option_id']; // should start with LBF
   $title = $lrow['title'];
   genMiscLink('RBot','cod','2',xl_form_title($title),
     "patient_file/encounter/load_form.php?formname=$option_id");
 }
}

$lres = sqlStatement("SELECT * FROM list_options " .
 "WHERE list_id = 'lbfnames' AND activity = 1 ORDER BY seq, title");
if (sqlNumRows($lres)) {
 foreach ($lres as $lrow) {
   $option_id = $lrow['option_id']; // should start with LBF
   $title = $lrow['title'];
   genMiscLink('RBot','cod','2',xl_form_title($title),
     "patient_file/encounter/load_form.php?formname=$option_id");
 }
}