7:00 – 3:30 ASRC PhD, NASA
- Lyrn.AI – Deep Learning Explained
- Re-learning how to code in PHP again, which is easier if you’ve been doing a lot of C++/Java and not so much if you’ve been doing Python. Anyway, I wrote a small class:
class DbIO2 { protected $connection = NULL; function connect($db_hostname, $db_username, $db_password, $db_database){ $toReturn = array(); $this->connection = new mysqli($db_hostname, $db_username, $db_password, $db_database); if($this->connection->connect_error){ $toReturn['connect_successful'] = false; $toReturn['connect_error'] = $this->connection->error; } else { $toReturn['connect_successful'] = true; } return $toReturn; } function runQuery($query) { $toReturn = array(); if($query == null){ $toReturn['query_error'] = "query is empty"; return $toReturn; } $result = $this->connection->query($query); if (!$result) { $toReturn['database_access'] = $this->connection->error; return $toReturn; } $numRows = $result->num_rows; for ($j = 0 ; $j < $numRows ; ++$j) { $result->data_seek($j); $row = $result->fetch_assoc(); $toReturn[$j] = $row; } return $toReturn; } } - And exercised it
require_once '../../phpFiles/ro_login.php'; require_once '../libs/io2.php'; $dbio = new DbIO2(); $result = $dbio->connect($db_hostname, $db_username, $db_password, $db_database); printf ("%s\n",json_encode($result)); $result = $dbio->runQuery("select * from post_view"); foreach ($result as $row) printf ("%s\n", json_encode($row)); - Which gave me some results
{"connect_successful":true} {"post_id":"4","post_time":"2018-11-27 16:00:27","topic_id":"4","topic_title":"SUBJECT: 3 Room Linear Dungeon Test 1","forum_id":"14","forum_name":"DB Test","username":"dungeon_master1","poster_ip":"71.244.249.217","post_subject":"SUBJECT: 3 Room Linear Dungeon Test 1","post_text":"POST: dungeon_master1 says that you are about to take on a 3-room linear dungeon."} {"post_id":"5","post_time":"2018-11-27 16:09:12","topic_id":"4","topic_title":"SUBJECT: 3 Room Linear Dungeon Test 1","forum_id":"14","forum_name":"DB Test","username":"dungeon_master1","poster_ip":"71.244.249.217","post_subject":"SUBJECT: dungeon_master1's introduction to room_0","post_text":"POST: dungeon_master1 says, The party now finds itself in room_0. There is a troll here."} (repeat for another 200+ lines) - So I’m well on my way to being able to show the stories (both from the phpbb and slack) on the Antibubbles “stories” page
4:00 – 5:00 Meeting with Don
