Bin will be removed on June 1, 2014 in favor of http://gist.github.com. Please save all your pastes before then. So long, and thanks for all the fish!×
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
// \app\controllers\yahoo_match_thread_controller.php
class YahooMatchThreadController extends AppController
{
    var $name = 'YahooMatchThread';
 
    function index()
    {
        $yahoo_match_thread_paginate_options['joins'] = array
        (
            array
            (
                'table' => 'yahoo_match_info',
                'alias' => 'info',
                'type' => 'inner',
                'conditions' => array
                (
                    'YahooMatchThread.info_id = info.info_id'
                )
            ),
            array
            (
                'table' => 'yahoo_match_thread_more',
                'alias' => 'more',
                'type' => 'inner',
                'conditions' => array
                (
                    'YahooMatchThread.thread_more_id = more.thread_more_id'
                )
            )
        );
        $yahoo_match_thread_paginate_options['conditions'] = array
        (
            'YahooMatchThread.so_genmatch' => 'FM'
        );
        $yahoo_match_thread_paginate_options['recursive'] = 1;
        $yahoo_match_thread_paginate_options['limit'] = 5;
        $yahoo_match_thread_paginate_options['fields'] = array('YahooMatchThread.id', 'info.age', 'info.nickname', 'YahooMatchThread.add_time', 'more.last_visit'); //array of field names
 
 
        $this->paginate = $yahoo_match_thread_paginate_options;
        $yahoo_match_thread_paginate = $this->paginate('YahooMatchThread');
        $this->set('yahoo_match_thread', $yahoo_match_thread_paginate );
    }
}
?>
 
 
 
 
 
 
 
 
 
 
 
 
 
<?php
// \app\models\yahoo_match_thread.php
class YahooMatchThread extends AppModel
{
    var $useTable = 'yahoo_match_thread';
    var $name = 'YahooMatchThread';
 
    var $primaryKey = 'id';
    var $order = "add_time";
}
?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<?php
// \app\views\yahoo_match_thread\index.ctp
?>
<h1>Yahoo Image Thread</h1>
<table>
    <tr>
        <th><?php echo $paginator->sort('id', 'YahooMatchThread.id'); ?></th>
        <th><?php echo $paginator->sort('nickname', 'yahoo_match_info.nickname'); ?></th>
        <th><?php echo $paginator->sort('age', 'yahoo_match_info.age'); ?></th>
        <th>Created</th>
        <th>Last Visit</th>
    </tr>
 
<!-- Here's where we loop through our $posts array, printing out post info -->
 
<?php foreach ($yahoo_match_thread as $thread): ?>
    <tr>
        <td><?php echo $thread['YahooMatchThread']['id']; ?></td>
        <td>
            <?php echo $thread['info']['nickname'];?>
                </td>
                <td>
            <?php echo $thread['info']['age'];?>
        </td>
        <td><?php echo $thread['YahooMatchThread']['add_time']; ?></td>
        <td><?php echo $thread['more']['last_visit']; ?></td>
    </tr>
<?php endforeach; ?>
 
</table>
 
 
 
<!-- Shows the page numbers -->
<?php echo $paginator->numbers(); ?>
<!-- Shows the next and previous links -->
<?php
    echo $paginator->prev('« Previous ', null, null, array('class' => 'disabled'));
    echo $paginator->next(' Next »', null, null, array('class' => 'disabled'));
?>
<!-- prints X of Y, where X is current page and Y is number of pages -->
<?php echo $paginator->counter(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
// SQL
 
CREATE TABLE IF NOT EXISTS `yahoo_match_thread` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `add_time` datetime NOT NULL,
  `thread_more_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `info_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `info_id` (`info_id`),
  KEY `thread_more_id` (`thread_more_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 CHECKSUM=1 AUTO_INCREMENT=1;
 
 
 
CREATE TABLE IF NOT EXISTS `yahoo_match_info` (
  `info_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `thread_id` int(10) unsigned NOT NULL,
  `nickname` varchar(255) NOT NULL,
  `age` tinyint(3) unsigned NOT NULL,
  `gender` tinyint(4) NOT NULL,
  PRIMARY KEY (`info_id`),
  KEY `thread_id` (`thread_id`,`info_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 CHECKSUM=1 AUTO_INCREMENT=1;
 
 
CREATE TABLE IF NOT EXISTS `yahoo_match_thread_more` (
  `thread_more_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `thread_id` int(10) unsigned NOT NULL DEFAULT '0',
  `name` varchar(255) NOT NULL,
  `age` tinyint(3) unsigned NOT NULL,
  `last_visit` varchar(30) NOT NULL,
  PRIMARY KEY (`thread_more_id`),
  KEY `age` (`age`),
  KEY `name` (`name`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 CHECKSUM=1 AUTO_INCREMENT=1;