| Server IP : 93.86.61.54 / Your IP : 216.73.216.60 Web Server : Apache/2.4.62 (Ubuntu) System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64 User : www-data ( 33) PHP Version : 8.4.22 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/projects/meteoca/ |
Upload File : |
<?php
/******************************
Project: MeteoCA, 2017-2020
Version: PHP-7
Author : M. Kukic
Note :
******************************/
// Primer PHP
// u databazu meteoca
// u tabeli dataext
// brise se sadrzaj i
// upisuje vrednost $ts i $te
// a zatim ponovo cita i stampa
//
// Struktura dataext
// id - int 5br.
// vreme - varchar 20 ch
//
$host_name = '127.0.0.1';
$user_name = 'misko';
$pass_word = 'skomi32';
$database_name = 'meteoca';
$dbh = mysqli_connect($host_name, $user_name, $pass_word, $database_name) or die ('I cannot connect to the database because: ' . mysqli_error());
mysqli_select_db($database_name);
$ts="2019-12-18 10:00:00";
$te="2020-12-18 10:00:00";
echo $ts." # ".$te;
//
//$myfile = fopen($putanja."tste.txt", "w") or die("Unable to open file!");
// fwrite($myfile, $ts."\n");
// fwrite($myfile, $te."\n");
//fclose($myfile);
//
$sql="truncate dataext";
$result = mysqli_query($dbh, $sql) or die(mysqli_error());
//
$sql = "INSERT INTO dataext (id,vreme) VALUES ('0','$ts')";
mysqli_query($dbh, $sql) or die(mysqli_error());
$sql = "INSERT INTO dataext (id,vreme) VALUES ('0','$te')";
mysqli_query($dbh, $sql) or die(mysqli_error());
//
$sql="SELECT * FROM dataext";
$result=mysqli_query($dbh,$sql) or die(mysqli_error($con));
$row = mysqli_fetch_array($result);
$ts=$row[1];
$row = mysqli_fetch_array($result);
$te=$row[1];
echo "<br>";
echo $ts." # ".$te;
mysqli_close($dbh);
?>