当前位置: 首页>>代码示例>>PHP>>正文


PHP Tweet::insert方法代码示例

本文整理汇总了PHP中Tweet::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Tweet::insert方法的具体用法?PHP Tweet::insert怎么用?PHP Tweet::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tweet的用法示例。


在下文中一共展示了Tweet::insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * create dependent objects before running each test
  **/
 public final function setUp()
 {
     // run the default setUp() method first
     parent::setUp();
     // create and insert a Profile to own the test Tweet
     $this->profile = new Profile(null, "@phpunit", "test@phpunit.de", "+12125551212");
     $this->profile->insert($this->getPDO());
     // create the test Tweet
     $this->tweet = new Tweet(null, $this->profile->getProfileId(), "PHPUnit favorite test passing");
     $this->tweet->insert($this->getPDO());
     // calculate the date (just use the time the unit test was setup...)
     $this->VALID_FAVORITEDATE = new DateTime();
 }
开发者ID:jfindley2,项目名称:data-design,代码行数:16,代码来源:favorite-test.php

示例2: testGetAllValidTweets

 /**
  * test grabbing all Tweets
  **/
 public function testGetAllValidTweets()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("tweet");
     // create a new Tweet and insert to into mySQL
     $tweet = new Tweet(null, $this->profile->getProfileId(), $this->VALID_TWEETCONTENT, $this->VALID_TWEETDATE);
     $tweet->insert($this->getPDO());
     // grab the data from mySQL and enforce the fields match our expectations
     $results = Tweet::getAllTweets($this->getPDO());
     $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("tweet"));
     $this->assertCount(1, $results);
     $this->assertContainsOnlyInstancesOf("Tweet", $results);
     // grab the result from the array and validate it
     $pdoTweet = $results[0];
     $this->assertEquals($pdoTweet->getProfileId(), $this->profile->getProfileId());
     $this->assertEquals($pdoTweet->getTweetContent(), $this->VALID_TWEETCONTENT);
     $this->assertEquals($pdoTweet->getTweetDate(), $this->VALID_TWEETDATE);
 }
开发者ID:jfindley2,项目名称:data-design,代码行数:21,代码来源:tweet-test.php

示例3: connectToEncryptedMySQL

<?php

require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/dmartinez337.ini");
$tweet = new Tweet(null, 1, "this is from PHP");
$tweet->insert($pdo);
$tweet->setTweetContent("now I changed the message");
$tweet->update($pdo);
$tweet->delete($pdo);
开发者ID:Domkratos,项目名称:instagram,代码行数:9,代码来源:shakedown.php

示例4: explode

<?php

require_once 'includes/master.inc.php';
$db = Database::getDatabase();
$tweet_apps = $db->getRows('SELECT id, tweet_terms FROM applications');
foreach ($tweet_apps as $tweet_app) {
    $terms = explode(',', $tweet_app['tweet_terms']);
    foreach ($terms as $term) {
        $term = trim($term);
        if (strlen($term) > 0) {
            $json = geturl("http://search.twitter.com/search.json?q=" . urlencode($term));
            $data = json_decode($json);
            if (!is_object($data)) {
                continue;
            }
            foreach ($data->results as $result) {
                $t = new Tweet();
                $t->tweet_id = $result->id;
                $t->username = $result->from_user;
                $t->app_id = $tweet_app['id'];
                $t->dt = dater($result->created_at);
                $t->body = $result->text;
                $t->profile_img = $result->profile_image_url;
                $t->new = 1;
                $t->replied_to = 0;
                $t->insert();
            }
        }
    }
}
开发者ID:jschilli,项目名称:Shine,代码行数:30,代码来源:tweet-cron.php

示例5: Tweet

<?php

require 'connection.php';
require 'class_tweet.php';
set_time_limit(0);
$tweet = new Tweet();
$infomax = mysql_query("SELECT HashTag,MaxID FROM infomax WHERE Active='1'");
while ($info = mysql_fetch_array($infomax)) {
    $result_json = $tweet->get_json($info['HashTag'], $info['MaxID']);
    $obj = json_decode($result_json, TRUE);
    $maxid = mysql_real_escape_string($obj["max_id_str"]);
    $hash = mysql_real_escape_string($info['HashTag']);
    mysql_query("UPDATE infomax SET MaxID = {$maxid} WHERE HashTag='{$hash}'");
    if (isset($obj["results"])) {
        $tweet->insert($obj["results"], $hash);
    } else {
        header("HTTP/1.1 503 Service Unavailable");
    }
}
mysql_close($con);
unset($tweet);
开发者ID:nirajan-panthee,项目名称:Twitter-hash-tag,代码行数:21,代码来源:tweet.php


注:本文中的Tweet::insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。