Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <!--
- To change this license header, choose License Headers in Project Properties.
- To change this template file, choose Tools | Templates
- and open the template in the editor.
- -->
- <html>
- <head>
- <meta charset="UTF-8">
- <title></title>
- </head>
- <body>
- <?php
- if(isset($_POST['check'])){
- $dbhost = '127.0.0.1';
- $dbuser = 'root';
- $dbpass= '';
- $db = 'dbvehiculos';
- $conn = mysqli_connect($dbhost, $dbuser, $dbpass);
- if(! $conn){
- die ("Fallo en conexión: " . mysqli_error());
- }
- $db_select = mysqli_select_db($conn, $db);
- if(! $db_select){
- die ("Fallo en conexión a base de datos: " .
- mysqli_error());
- }
- $ID = $_POST['v_ID'];
- $sql = "SELECT * FROM `test` WHERE id=$ID";
- //$sql = "INSER INTO test "
- //. "(IDVeh, Marca, Modelo, Fecha)"
- // . "(monthlyAmount, intRate)"
- // . "VALUES ('$ID', '$MAR')";
- $qry = mysqli_query($conn, $sql) or
- die ('Consulta fallida');
- if(! $qry){
- die(mysqli_error());
- }
- $result = mysqli_query($conn, $sql);
- while ($row = mysqli_fetch_object($result)) {
- echo 'Amount Owed: ' .$row->monthlyAmount;
- echo '<br>';
- echo 'Interest Rate: ' .$row->intRate;
- echo '<br>';
- echo 'Daily interest: ' .$row->intRate/30;
- echo '<br>';
- echo 'Days past due: ' .$row->pastDue;
- }
- mysqli_close($conn);
- }
- else{
- ?>
- <form method = "post" action = "<?php $_PHP_SELF ?>">
- <table width = "400" border = "0" cellspacing = "1"
- cellpadding = "2">
- <tr>
- <td width = "100">ID NUMBER</td>
- <td><input name = "v_ID" type = "text"
- id = "veh_ID"></td>
- </tr>
- <tr>
- <td width = "100"> </td>
- <td>
- <input name = "check" type = "submit" id = "check"
- value = "CHECK">
- </td>
- </tr>
- </table>
- </form>
- <?php
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement