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


PHP SQLQuery::chooseTable方法代码示例

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


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

示例1: fopen

<?php
	$filename = "songs.json";
	include('lib/config.php');
	include('lib/sqlquery.php');
	
	// get contents of a file into a string
	$handle = fopen($filename, "r");
	$contents = fread($handle, filesize($filename));
	fclose($handle);
	
	if ($contents) {
		$songs = json_decode($contents, true);
		if (array_key_exists('songs', $songs) and is_array($songs['songs'])) {
			$DB = new SQLQuery();
			$DB->chooseTable(DB_SONGS_TABLE);
			foreach($songs['songs'] as $song) {
				$dataInsert = array();
				$dataInsert['id'] = $song['id'];
				$dataInsert['title'] = $song['title'];
				$dataInsert['artist'] = $song['artist'];
				$dataInsert['album'] = $song['album'];
				$dataInsert['length'] = $song['length'];
				$dataInsert['filename'] = $song['filename'];
				$DB->addItemsArray($dataInsert);
				echo "Added " . $song['title'] . " by " . $song['artist'] . " to the database.<br />";
			}
		}
	}
?>
开发者ID:njoubert,项目名称:SXSW_Website,代码行数:29,代码来源:populate.php

示例2: TwitterOAuth

	}
	
	$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
	$access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
	$_SESSION['access_token'] = $access_token;
	unset($_SESSION['oauth_token']);
	unset($_SESSION['oauth_token_secret']);

	$authedconn = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
	$content = $authedconn->get('account/verify_credentials');
	
	if (200 == $connection->http_code && !empty($content->id)) {
		//TODO(njoubert): Here we should pass it off to an "insert into local database and set up our own session" thingy
		//if the user exists, update. if not, create.
		$DB = new SQLQuery();
		$DB->chooseTable(DB_USERS_TABLE);
		$dataInsert = array();
		$fullname = explode(" ", $content->name);
		$fname = "Britney";
		$lname = "Spears";
		if (count($fullname) > 0) { $fname = $fullname[0]; }
		if (count($fullname) > 1) { $lname = $fullname[1]; }
		$dataInsert['tw_id'] = $content->id;
		$dataInsert['fname'] = $fname;
		$dataInsert['lname'] = $lname;
		$dataInsert['tw_name'] = $content->screen_name;
		$dataInsert['avatar'] = $content->profile_image_url;
		$dataInsert['tw_oauth_token'] = $access_token['oauth_token'];
		$dataInsert['tw_oauth_token_secret'] = $access_token['oauth_token_secret'];

开发者ID:njoubert,项目名称:SXSW_Website,代码行数:29,代码来源:twitter.php

示例3: record_vote

function record_vote($user_id, $song_id) {
	$DB = new SQLQuery();
	$DB->chooseTable(DB_VOTES_TABLE);
	
	
}
开发者ID:njoubert,项目名称:SXSW_Website,代码行数:6,代码来源:include.php


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