Skip to content

Commit

Permalink
img
Browse files Browse the repository at this point in the history
  • Loading branch information
cws13003 committed Dec 3, 2017
2 parents 32973aa + f2345dc commit bee5db6
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 29 deletions.
23 changes: 12 additions & 11 deletions db/lamp_2017-12-01.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# Host: 127.0.0.1 (MySQL 5.7.20)
# Database: lamp
# Generation Time: 2017-12-01 19:30:46 +0000
# Generation Time: 2017-12-01 20:43:00 +0000
# ************************************************************


Expand All @@ -27,19 +27,23 @@ DROP TABLE IF EXISTS `Tweets`;

CREATE TABLE `Tweets` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`tweet_id` bigint(11) DEFAULT NULL,
`tweet_id` int(11) DEFAULT NULL,
`tweet` char(140) DEFAULT NULL,
`date_time` datetime DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

LOCK TABLES `Tweets` WRITE;
/*!40000 ALTER TABLE `Tweets` DISABLE KEYS */;

INSERT INTO `Tweets` (`id`, `tweet_id`, `tweet`, `date_time`)
INSERT INTO `Tweets` (`id`, `tweet_id`, `tweet`, `date_time`, `user_id`)
VALUES
(1,123,'testing tweet! one two three','1000-01-01 00:00:00'),
(2,456,'testing tweet again! four five six','1000-01-01 00:00:00');
(1,1,'testing tweet! one two three','1000-01-01 00:00:00',1),
(2,2,'hiiii this is my second tweet','1000-01-01 00:00:00',1),
(3,3,'first twitter tweet omg so kewl','1000-01-01 00:00:00',2),
(4,4,'3rd tweet now so pro','1000-01-01 00:00:00',1),
(5,5,'tweet tweet tweet cant stop me now','1000-01-01 00:00:00',2);

/*!40000 ALTER TABLE `Tweets` ENABLE KEYS */;
UNLOCK TABLES;
Expand All @@ -57,21 +61,18 @@ CREATE TABLE `Users` (
`username` char(20) DEFAULT '',
`password` text,
`email` text,
`picture` text,
`bio` char(140) DEFAULT '',
`url` text,
`location` text,
`date_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

LOCK TABLES `Users` WRITE;
/*!40000 ALTER TABLE `Users` DISABLE KEYS */;

INSERT INTO `Users` (`id`, `first_name`, `last_name`, `username`, `password`, `email`, `picture`, `bio`, `url`, `location`, `date_time`)
INSERT INTO `Users` (`id`, `first_name`, `last_name`, `username`, `password`, `email`, `url`, `location`)
VALUES
(1,'shemona','singh','mona','pass','shemona.singh@uconn.edu',NULL,'',NULL,'milford','1000-01-01 00:00:00'),
(2,'chris','stumper','chris','pass2','chris.stumper@uconn.edu',NULL,'',NULL,'simsbury','1000-01-01 00:00:00');
(1,'shemona','singh','mona','pass','shemona.singh@uconn.edu',NULL,'milford'),
(2,'christopher','stumper','chris','pass2','chris.stumper@uconn.edu',NULL,'simsbury');

/*!40000 ALTER TABLE `Users` ENABLE KEYS */;
UNLOCK TABLES;
Expand Down
2 changes: 1 addition & 1 deletion www/application/controllers/All_Tweets.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function __Construct(){
parent::__Construct ();
$this->load->database(); // load database
$this->load->model('All_Tweets_Model'); // load model
$this->output->enable_profiler(TRUE);
$this->output->disable_profiler(TRUE);
}

public function index() {
Expand Down
6 changes: 4 additions & 2 deletions www/application/models/All_Tweets_Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
class All_Tweets_Model extends CI_Model {

function getPosts(){
$this->db->select("first_name,last_name,username");
$this->db->from('Users');
$this->db->select("first_name, last_name, username, tweet, date_time");
$this->db->from('Users, Tweets');
$this->db->where('Users.id = Tweets.user_id');
$this->db->order_by('date_time', 'DESC');
$query = $this->db->get();
return $query->result_array();
}
Expand Down
31 changes: 16 additions & 15 deletions www/application/views/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@
</head>
<body>

<h4>Output Data</h4>
<table>
<tr>
<td><strong>Post Id</strong></td>
<td><strong>Post Title</strong></td>
</tr>
<?php foreach($posts as $post){?>
<tr>
<td><?php echo $post['first_name'];?></td>
<td><?php echo $post['last_name'];?></td>
</tr>
<?php }?>
</table>

</div>
<h1>Tweets Feed</h1>
<div class="container">
<div class="row">
<?php foreach($posts as $post){?>
<div class="col-md-4">
<?php echo $post['first_name'];?>
<?php echo $post['last_name'];?>
<?php echo $post['username'];?>
</div>
<div class="col-md-8">
<?php echo $post['tweet'];?>
<?php echo $post['date_time'];?>
</div>
<?php }?>
</div>
</div>

</body>
</html>
5 changes: 5 additions & 0 deletions www/application/views/templates/footer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<em>&copy; 2017</em>
<<<<<<< HEAD
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
=======
<script type="text/javascript" src="assets/js/bootstrap.js"></script>
<script type="text/javascript" src="assets/js/jQuery-1.10.2.js"></script>
>>>>>>> f2345dcf3248c7cb7988340a999f238e7dfcfda7
</body>
</html>
Binary file added www/img/twitter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bee5db6

Please sign in to comment.