Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

pardon me if this is a noob question.

I am trying to call a public function delete() from a .php file in a folder.

The public function delete() is in fileA.php

I created another file: fileB.php and use it to call the public function in fileA.php.

However, the code doesn't seems to work.

This is what i have in fileB.php:

function crondel() {

    $sql_del2 = new Item;

    $oc_t_item_description="oc_t_item_description";

    $sql_del="SELECT * FROM $tbl_name WHERE UNIX_TIMESTAMP($expiry_date) < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY))"; 
    $result_del = mysql_query($sql_del);


    while($row = mysql_fetch_array($result_del)) {


             $itemid = $row['pk_i_id'];
             $secret = $row['s_secret'];
             //$sql_del2 = "DELETE FROM $oc_t_item_description WHERE 
                            //fk_i_item_id = '$criteria'";
             //$result_del2 = mysql_query($sql_del2);

           }

    $secret_new=$secret;
    $itemid_new=$itemid;

    $result_del2 = $sql_del2->delete( $secret_new, $itemid_new );


    }

The problem is the script is exceuted and no errors were reported. However, it didn't produce the expected results.

I think the problem lies with inserting the values obtained from mysql_fetch_array into the public function delete() called above.

Other than that, I can't think of anything else why it doesn't work. Appreciate any help. Thanks!!

share
1  
You need to include or require fileA.php somewhere. But you are using Objects, shouldn't ->delete() be defined in the Item class? –  Paul 3 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.