<?php
$link=mysqli_connect('147.32.164.26','test','a1234,'test')
or die('Error: '.mysqli_error($link));
$s='select id from userst where login="'.$_POST["name"].'" and pwd="'.$_POST["pwd"].'";';
if ($result=mysqli_query($link,$s) )
{
$row=mysqli_fetch_assoc($result);
$id_u = $row["id"];
echo "User ".$_POST["name"].", #".$id_u." logged in.\n";
}
else {
echo 'Error: '.mysqli_error($link);
exit();
}
$s='select * from carst where (id not in (select id_c from orderst where o_to is null))'.
'or (id not in (select id_c from orderst));';
if ($result=mysqli_query($link,$s) )
{
echo "<table border=1>\n<tr><th>type<th>tax<th>rent it!";
while ($row=mysqli_fetch_assoc($result)) {
echo "<tr>";
echo "<td>".$row["type"]."<td>".$row["priceperday"]."<td>";
echo '<Form action="rentit.php" method="post">';
echo '<input type="submit" name="submit" value= "rent it">';
echo '<input type="hidden" name="id_u" value="'.$id_u.'">';
echo '<input type="hidden" name="id_c" value="'.$row["id"].'">';
echo "\n</Form>\n";
}
echo "</table>";
}
mysqli_close($link);
?>