How can I replace value in a php file?

Discussion in 'PHP' started by srobona, Mar 25, 2009.

  1. #1
    Hi,

    I want to change a value in a php file which will come from DB.

    I have two files, fun.php and cons.php. In fun.php, i have a query from which i get

    $rows_col = $rw['rows']; //it shows 20.
    PHP:
    In the cons.php, i have a line (line#23, total lines - 39)

    define("NUM_ROWS", 5);
    PHP:
    My question is, how can i replace 5 with the value of $rows_col? Any good solution please?

    Thanks
     
    srobona, Mar 25, 2009 IP
  2. Argento

    Argento Active Member

    Messages:
    69
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    53
    #2
    cons.php:

    First line of cons:

    include("rute_to_your_file/fun.php");
    define("NUM_ROWS", $rows_col);
    Code (markup):
     
    Argento, Mar 25, 2009 IP
    srobona likes this.
  3. srobona

    srobona Active Member

    Messages:
    577
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    88
    #3
    thanks, but is there any other way of doing this? Can i do it using fwrite, or str_replace?
     
    srobona, Mar 25, 2009 IP
  4. srobona

    srobona Active Member

    Messages:
    577
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    88
    #4
    ok, i have solved the problem. Thanks for your effort. :)
     
    srobona, Mar 25, 2009 IP