• I’ve been trying to solve this for three days now but no success and it’s getting stressing. I hope you guy out there can help me out and explain to me what is wrong with the code.

    The code is to look for
    [DATA:<- ID OF THE DATA IN MYSQL ->] on the content page and replace it with the ID’s title.

    eg: [DATA:2] = < b >This is info for ID 2 < /b >
    Everything work perfectly until i added the codes with the Asterik ‘*’… and all I get is blank. No result, nothing… not even the [Data:2] tag.

    Please help.

    ==================================
    function scannow ($content) {
    $CODE = ‘/\[DATA\:(.*?)\]/is’;
    $VALUE = ‘$1’;

    * $result = mysql_query(“SELECT * FROM wp_datastructure WHERE option_id = ‘$VALUE'”);
    * $row = mysql_fetch_array($result);
    * $VALUE = $row[‘option_name’];

    $content = preg_replace($CODE, $VALUE, $content);
    return $content;
    }

    PS: I know this is not a php support website. Why I putting it here and ask for assistance is because, it’s for WP plugin and all WP tags and functions in query stuff are not quite familiarize by me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter andyhajime

    (@andyhajime)

    …this is the worst support forum i ever encounter. Pathetic.

    Well first off you need a little patience.

    Second, you need to preg_match before performing the sql query. $VALUE = '$1'; will literally have the value of $1.

    Thread Starter andyhajime

    (@andyhajime)

    Preg_match before query and I’ll get sql errors, preg_match after and all the post in the page goes blank.

    nvm, it’s ok…. i quit doing the plugin. Not worth wasting 2 days trying to figure what’s wrong with the code and over 2 days to get help… 4 days wasted, time is money.

    outz!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘HELP ON CODES: Writng a new plugin’ is closed to new replies.