Created
October 6, 2012 20:45
-
-
Save micheljp/3846055 to your computer and use it in GitHub Desktop.
Outputs stored Tweets from MySQL table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo '<head>'; | |
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; | |
echo '</head>'; | |
echo '<body>'; | |
//connect to existing db w/ stored tweets and create variable with MySQL data | |
mysql_connect("path", "user", "pass") or die(mysql_error()); | |
mysql_select_db("dbname") or die(mysql_error()); | |
$tweet_archive = mysql_query("SELECT * FROM twindicators"); | |
//print out MySQL fields in embedded html | |
while ($row = mysql_fetch_array($tweet_archive)) { | |
$decoded_text = urldecode($row["text"]); | |
echo '<p>' . $row[user] . ' | ' . $row[date] . ' | |
<br /><br /> | |
<a href="https://twitter.com/#!/' . $row[user] . '/status/' . $row[twid] . '">' . $decoded_text . ' </a></p>'; | |
echo '<hr />'; | |
} | |
echo '</body>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment