This topic is locked

Modifications Log from phpr5 to phpr 6

9/8/2011 2:14:44 AM
PHPRunner Tips and Tricks
A
acpan author

Below are some essential changes i need to make to upgrade to phpr6 from phpr5.3

  1. Modify existing phpr6 layouts and save as a new template
    a. Edit list.ly and name it as list_pac1.ly

    b. Edit layouts.xml and change the list.ly to modified file list_pac1.ly
    <pageLayout>

    <page>list</page>

    <file>list_pac1.ly</file>

    </pageLayout>
    c. Edit pages.xml and modify as follows to point the list page with the new name

    <layout>

    <file>list_pac1.ly</file>

    <page>list</page>

    <name>list_pac1</name>

    </layout>
  2. Change of mysql query using php 5 enhanced api - mysqli
    $v_where_s_id ="" ;

    $v_where_s_id_pull_down = "";

    $strSQL1 = "select distinct s_id from s_id_table where ";

    $strSQL1 .= " (id_client =".$_SESSION["id_client"]." AND approval = 1 AND alpha = 1 ) ";
    $result = mysqli_query($conn,$strSQL1) or die(mysql_connect_error());

    // phpr5.3 method: $result = mysql_query($strSQL1,$conn) or die(mysql_error());
    $row_count1 = mysqli_num_rows($result);

    if ($row_count1 == 0)

    {

    echo 'Not found!';

    }

Sergey Kornilov admin 9/8/2011

You should not use mysql or mysqli functions directly.
Use db_query (PHPRunner wrapper for mysql_query) or DAL. This way you will make your code compatible with future versions.

A
acpan author 9/8/2011



You should not use mysql or mysqli functions directly.
Use db_query (PHPRunner wrapper for mysql_query) or DAL. This way you will make your code compatible with future versions.


Thanks. Yes, it's true, i have much work to convert those codes now.

So I tried to use db_query, db_fetch_array as far as possible, but

in some cases, i need to use mysqli_num_rows, but i don't see such function in DAL,

is there any compatible function in DAL ?