Cannot running next process when a variable save no value

Posted by bruine on Stack Overflow See other posts from Stack Overflow or by bruine
Published on 2012-10-13T15:09:01Z Indexed on 2012/10/13 15:37 UTC
Read the original article Hit count: 145

Filed under:
|

First, I wanna compare between 2 tables tb_wrapper and tb_summary to get the data in the tb_wrapper that doesn't exist in the tb_summary then save in $link. If I don't get the same data, I want to print the result $link. When I don't get the not same data, I want it to go to another process.

Here's the code :

$q2 = mysql_query(" SELECT 
                          a.doc_url 
                    FROM
                          tb_wrapper a
                    LEFT JOIN 
                          tb_summary b
                          ON a.doc_name = b.doc_summ
                    WHERE
                          b.doc_summ IS NULL");

while ($row = mysql_fetch_array($q2)){
    $link = $row['doc_url'];
    if (!$link){ 
       include 'next_process.php';
    }
    else {
       print_r($link);
    }
}

it doesn't work. When I don't get the not same data or $link not save a value.

table :

CREATE TABLE tb1
(`id` int, `doc_name` varchar(100), `doc_url` varchar(50))
}

CREATE TABLE tb2
(`id` int, `doc_summ` varchar(100))
}

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql