Advertisement
Guest User

Untitled

a guest
May 7th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. <?
  2. // error_reporting(E_ALL);
  3.  
  4. $db_pass='yFYMZ5JGW8S657GQ';
  5. $db_host='localhost';
  6. $db_user='buh';
  7. $db_name='balance';
  8.  
  9. print '<html><head>';
  10. print '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
  11. print '<title>Таблица расчета проёба денег</title>';
  12. print '</head><body>';
  13.  
  14. $query = 'SELECT * FROM balance.balance';
  15. $conn = mysql_connect($db_host, $db_user, $db_pass)
  16. or die("Couldn't connect");
  17. $query_res = mysql_query($query)
  18. or die ("Shit happens - " . $mysql_error());
  19.  
  20. print '<table align="center" border=2>';
  21. print '<tr><td>Id</td><td>Дата</td><td>Доход/Расход</td><td>Сумма</td><td>Коммент</td></tr>';
  22. while ($array = mysql_fetch_row($query_res))
  23. {
  24. print '<tr>';
  25. foreach($array as $val => $key)
  26. {
  27. print'<td>'.$key.'</td>';
  28. }
  29. print '</tr>';
  30. }
  31.  
  32. print '</table>';
  33. print '<br>';
  34. print '<align="center">';
  35. print '<form action="new_act.php">';
  36. print 'Введи сумму: <input type=text name="sum"> ';
  37. print 'Введите коммент: <input type=text name="comment"> ';
  38. print '<input type=radio name=type value=Расход checked>Расход';
  39. print '<input type=radio name=type value=Доход>Доход';
  40. print '<input type=submit value="YARRR!">';
  41. print '</form>';
  42. print '</align>';
  43.  
  44. //$new_sum = $_GET['sum'];
  45. //$new_comm = $_GET['comment'];
  46. //$type = $_GET['type'];
  47.  
  48. //$current_date = date("c");
  49. //$update_nal = 'INSERT INTO balance.balance (date,action,sum,comment) VALUES ('.$current_date.','.$type.','.$new_sum.','.$new_comm.')';
  50. //$query_res_update = mysql_query($update_nal);
  51. //or die("Shit happens - " . $mysql_error());
  52.  
  53. print '</body>';
  54. print '</html>';
  55.  
  56. mysql_free_result($query_res);
  57.  
  58. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement