/rawridehistory.php

https://bitbucket.org/electricsheep/wheelsharephp · PHP · 67 lines · 27 code · 9 blank · 31 comment · 0 complexity · 9625cb54020e4380438509a43008cf74 MD5 · raw file

  1. <?php
  2. mysql_connect("localhost", "electricsheep", "android") or die(mysql_error());
  3. mysql_select_db("wheelshare") or die(mysql_error());
  4. $uid = $_GET['id'];
  5. /*Order of data items in Ride.java
  6. private String id;
  7. private String owner;
  8. private String numberSeats;
  9. private String full;
  10. private String fromLocation;
  11. private String toDestination;
  12. private String rideDate;
  13. private String recurring;
  14. private String fromDate;
  15. private String toDate;
  16. private String frequency;
  17. private String costPerMile;
  18. private String startTime;
  19. */
  20. $sql2 = "select * from ridedata as r left outer join passengerdata as p on r.id = p.rideid where r.complete = 'Yes' and (r.ownerid = '$uid' or p.userid = '$uid')";
  21. /*
  22. $result1 = mysql_query($sql);
  23. while($row = mysql_fetch_array($result1)){
  24. $rideDate = $row['rideDate'];
  25. $fromLocation = $row['fromLocation'];
  26. $toDestination = $row['toDestination'];
  27. $requester = $row['requester'];
  28. $recurring = $row['recurring'];
  29. $frequency = $row['frequency'];
  30. $fromDate = $row['fromDate'];
  31. $toDate = $row['toDate'];
  32. }
  33. */
  34. //$sql2 = "select * from ridedata where fromlocation like '$fromLocation' and todestination like '$toDestination' and full <> "Yes" and fromdate='$fromdate'";
  35. //$sql2 = "select * from ridedata where fromlocation like '$fromLocation'";
  36. $result2 = mysql_query($sql2);
  37. while($row2 = mysql_fetch_array($result2)){
  38. $res_rideId = $row2['id'];
  39. $res_fromDate = $row2['fromdate'];
  40. $res_fromLocation = $row2['fromlocation'];
  41. $res_toDestination = $row2['todestination'];
  42. $res_owner = $row2['owner'];
  43. $res_ownerId = $row2['ownerid'];
  44. $res_time = $row2['starttime'];
  45. $res_cost = $row2['costpermile'];
  46. $res_seats = $row2['numberseats'];
  47. $res_toDate = $row2['todate'];
  48. $res_recurring = $row2['recurring'];
  49. $res_rideDate = $row2['fromdate'];
  50. $res_full = $row2['full'];
  51. $res_frequency = $row2['frequency'];
  52. echo $res_rideId . "," . $res_owner . "," . $res_seats . "," .
  53. $res_full . "," . $res_fromLocation . "," . $res_toDestination . "," .
  54. $res_rideDate . "," . $res_recurring . "," . $res_fromDate . "," .
  55. $res_toDate . "," . $res_frequency . "," . $res_cost . "," . $res_time . ";";
  56. }
  57. ?>