<?php

   	/* Grab the URL variable */
	$TID = $_GET["TID"];	


	/* Connect to database and grab the keys */
		
$servername = "localhost";
$username = "u9cwxhx7pzvxt";
$password = "Maggie@2014SG$2014%%";
$dbname = "phibase0_ActSignals";

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
////////////////////////////

	$query = "SELECT TID, Magic, SYM, Trade, Open, TP, SL, LastTimeStamp FROM ra3db";

$result = mysqli_query($conn, $query);

if (mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) 
			{
							$TID = $row["TID"];
						
							$Magic = $row["Magic"];
							$SYM= $row["SYM"];
							$Trade = $row["Trade"];
							$Open = $row["Open"];
							$TP = $row["TP"];
							$SL = $row["SL"];
							$Time = $row["LastTimeStamp"];

							$text = trim($TID) . "|" . trim($Magic) .  "|" . trim($SYM) .  "|" . trim($Trade)  .   "|"  . trim($Open) . "|" . trim($TP)  .   "|" . trim($SL) .  "|" . trim($Time)  .  "|" ;		
							
							$output = strlen($text)  . "|" . $text;
										
							echo $output;		
			}
			
					
			mysqli_free_result($result);	
			$conn->close();			
		}															
	
?>