YES.

23 Jun 2010 08:59 pm
kaigou: life would be easier if I had the source code. (3 source code)
[personal profile] kaigou
$result = mysql_query("SELECT `termid` FROM connected_texts");
while ($row = mysql_fetch_array($result, MYSQL_BOTH)) {
    $orig_term_tax_id = $row['termid'];
    $result2 = mysql_query("SELECT * FROM term_relationships WHERE `term_taxonomy_id` = '$orig_term_tax_id'");
    while ($row2 = mysql_fetch_array($result2, MYSQL_BOTH)) {
        $objectid_textid = $row2[0];
        if (!$bookpart) {
            $result3= mysql_query("SELECT `bookpart` FROM `texts` WHERE `textid`='$objectid_textid'");
            while ($row3 = mysql_fetch_array($result3, MYSQL_BOTH)) {
                $bookpart = $row3['bookpart'];
                if ($bookpart == '1') {
                $bookno = $objectid_textid;
                $result4= mysql_query("UPDATE connected_texts SET `textid` = '$bookno' WHERE `termid` = '$orig_term_tax_id'");
                }
            }
        }
        $result3= mysql_query("SELECT `bookpart` FROM `texts` WHERE `textid`='$objectid_textid'");
        while ($row3 = mysql_fetch_array($result3, MYSQL_BOTH)) {
            $result4= mysql_query("UPDATE texts SET `book` = '$bookno' WHERE `textid` = '$objectid_textid'");
        }
    }
    $bookpart = '';
}


It's amazing what your brain can do when it's not got two tons of unhappy perched on top.

Date: 24 Jun 2010 03:20 am (UTC)
From: [personal profile] leorising
Erm...I'll take your word for it?

Date: 24 Jun 2010 01:57 pm (UTC)
obsession_inc: (Default)
From: [personal profile] obsession_inc
I love seeing SQL on my reading page, even if I'm missing the context to make it entirely make sense. (Bookpart! TextID! I am intrigued. SQL and books; what's not to love?) Haven't played in MySQL at all; how is it?

Date: 24 Jun 2010 05:02 pm (UTC)
branchandroot: oak against sky (Default)
From: [personal profile] branchandroot
*thumbs up* For linking things together in a series/arc/thing?

whois

kaigou: this is what I do, darling (Default)
锴 angry fishtrap 狗

to remember

"When you make the finding yourself— even if you're the last person on Earth to see the light— you'll never forget it." —Carl Sagan

October 2016

S M T W T F S
      1
2345678
91011 12131415
16171819202122
23242526272829
3031     

expand

No cut tags