Jump to content

xyz91

New Members
  • Posts

    3
  • Joined

  • Last visited

xyz91's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I do not know nothing working. Here code: <?php $dbhost="localhost"; $dbuser="root"; $dbpassword="xxxxxx"; $dbname="database1"; $conn = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname); if (!$conn) { echo "Error connection with MySQL" . PHP_EOL; echo "Errno: " . mysqli_connect_errno() . PHP_EOL; echo "Error: " . mysqli_connect_error() . PHP_EOL; exit; } $port = '80'; $result = mysqli_query($conn, "SELECT * FROM domens") or die ("Erro connection: $dbname"); print "<TABLE CELLPADDING=10 BORDER=1>"; print "<TR><TD>idt</TD><TD>Name</TD><TD>Working</TD><TD>Number of attempts</TD><TD>Time</TD></TR>\n"; while ($row = mysqli_fetch_array ($result)) { $idt = $row[0]; $naame = $row[1]; $quantity = $row[2]; $time = $row[3]; $host = $name; $numb_attemp = $quantity; $fp = @fsockopen($host, $port, $errno, $errstr, 30); if($fp){ print "<TR><TD>$idt</TD><TD>$name<TD>OK</TD><TD>0</TD><TD>$time</TD</TR>\n"; $sql = "UPDATE addresses SET quantity = 0"; } else { print "<TR><TD>$idt</TD><TD>$nazwa<TD>OK</TD><TD>$numb_attemp</TD><TD>$time</TD</TR>\n"; $sql = "UPDATE addresses SET quantity = quantity+1"; } if (mysqli_query($conn, $sql)) { echo "sql update"; } else { echo "sql no update"; } print "</TABLE>"; mysqli_close($conn); ?>
  2. Hello, I have a problem with writing a function that will display the number of attempts to communicate with the host that have not been answered, if the host starts responding again, the table should display, for example 0. The website addresses are taken from the MySQL database. The next column should display the time from which the communication with the host was lost and if it responds, it should display, e.g. OK. Please, give me some hints how to write it. Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.