1 <?php
//When called, make a request to pull a tweet from an SQL table
3 $sql_ini = fopen("settings/sql.ini", "r");
5 while(!feof($sql_ini)){
6 $line = fgets($sql_ini);
7 $key = substr($line, 0, strpos($line, ":"));
8 $value = trim(substr($line, strpos($line, ":")+
1));
9 $sql_data[$key] = $value;
12 $connection = new mysqli($sql_data["connection"], $sql_data["user"], $sql_data["pass"], $sql_data["database"]);
14 echo "Error: Unable to connect to MySQL." . PHP_EOL
;
15 echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL
;
16 echo "Debugging error: " . mysqli_connect_error() . PHP_EOL
;
21 $retrieval_query = "SELECT * FROM TweetQueue ORDER BY PostNo ASC LIMIT 1";
23 $most_recent = $connection->query($retrieval_query);
24 print_r($most_recent);
27 $data_arr = $most_recent->fetch_assoc();
31 $file_arr = explode(",", rawurldecode($data_arr["ImageLocation"]));
33 echo "Comm: " . $data_arr["Comment"] . " - ILoc: ";
39 makeTweet($data_arr["Comment"], $file_arr);
41 $delete_query = "DELETE FROM TweetQueue WHERE PostNo=" . $data_arr["PostNo"];
42 $delete_status = $connection->query($delete_query);
43 print_r($delete_status);
44 if($delete_status !== 1){
45 echo "Delete Err" . $delete_query->error
;
49 echo "<hr/></pre>Found, Added and Deleted<br/>";