Witam. Potrzebuje pomocy z zadaniem. Mam stworzyc tabele z danymi które sa brane z pliku getData.php który laczy sie z baza. Kryterium wyboru danych ma byc biezacy rok. Stworzylem plik browseData.php który wysla rok poprzez url tylko teraz niewiem czy sama tabele mam tworzyc w moim stowrzonym pliku laczac sie z baza na nowo czy w pliku getData.php ? Dodatkowo po kliknieciu w Browse[PHP] odnosnik na pasku adresu powinien zostac dokladnie taki sam i tylko sie odswiezac. Jaka kolwiek pomoc mile widziana. Dzieki
browseData.php
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<a href="getData.php?year=
<?php echo $year=date('Y') ?>">Browse[PHP]</a>
</body>
</html>
getData.php
<?php
$year=$_GET['year'];
$connection = mysqli_connect("localhost","root","");
mysqli_select_db($connection,"6nationsDB");
// for results
$result = mysqli_query($connection,"SELECT * FROM results WHERE year(`date`)='$year' ORDER BY rnd, date");
$i=0;
while($rs[] = mysqli_fetch_assoc($result)) {
// do nothing ;-)
}
// for team details
$result2 = mysqli_query($connection,"SELECT * FROM teams ORDER BY id");
$i=0;
while($rs2[] = mysqli_fetch_assoc($result2)) {
// do nothing ;-)
}
mysqli_close($connection);
// print("{ \"results\":" . json_encode($rs) . "}");
print("{ \"results\":" . json_encode
($rs) . " , \"teams\":" . json_encode
($rs2) . "}"); ?>
Ten post edytował RikardoPL 28.11.2017, 21:59:10