mercredi 16 septembre 2015

SQLite PHP echo assistance

I'm trying to get something output from a SQLite database using PHP. So far I'm able to output the field from the database but I'm only looking for a specific portion of that field to be output. Is there anyway to tailor the output before echoing the row?

Here's my code so far:

<?php
$DatabaseFile = (string)"STHS.db";
$Team = (integer)0;
$Query = (string)"";
$Title = (string)"";
$TeamName = (string)"";
if($_GET){$Team = $_GET['Team'];}
If (file_exists($DatabaseFile) == false){
$LeagueName = "Unknown League";
$LeagueOwner = "Unknown League Owner";  
$Title = "Unknown League";
$Team == 0;
$TeamName = "Database File Not Found";
}else{
$db = new SQLite3($DatabaseFile);
$LeagueName = $db->querySingle('Select Name FROM LeagueGeneral');
$LeagueOwner = $db->querySingle('Select LeagueOwner FROM LeagueGeneral');
$MainQuery = "SELECT Name FROM TeamProInfo WHERE Number = '$Team'" ;
$TeamName = $db->querySingle($MainQuery);
}
{
$TeamQuery = "SELECT * FROM TeamLog WHERE Team = '$Team'";
$TeamTrans = $db->query($TeamQuery); 
$TeamTextQuery = "SELECT * FROM TeamLog WHERE Team = '$Team' AND Text LIKE '%TRADE : FROM $TeamName%' ";
$TeamText = $db->query($TeamTextQuery); 
}
?>
<body>
<?php echo $TeamName ?>
<?php while ($row1 = $TeamText ->fetchArray()) { ?>
<?php echo $row1['Text'] ?>
<?php } ?>

Aucun commentaire:

Enregistrer un commentaire