 |
Menu
|
|
|
|
|
|
Owner information
|
Create Listing
|
View Listings
|
|
|
My Listings
<%
if(session.getAttribute("owner_id")!=null){
try {
PreparedStatement Ps;
Class.forName("org.gjt.mm.mysql.Driver");
//Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/sstrehli1?user=sstrehli1&password=frboadmin2007");
String query = "(SELECT p.property_id, p.address, c.city, c.region_name, c.country_name, p.bedrooms, p.bathrooms, p.sqft, r.nigth, NULL as expiration_date, NULL as payment_date FROM property p LEFT JOIN cities c USING(city_id) LEFT JOIN rates r ON(p.property_id = r.property_id) WHERE p.owner_id = ? AND rate_id = 0 AND p.property_id NOT IN ( SELECT property_id FROM payment )) UNION (SELECT p.property_id, p.address, c.city, c.region_name, c.country_name, p.bedrooms, p.bathrooms, p.sqft, 0.0 as nigth, NULL as expiration_date, NULL as payment_date FROM property p LEFT JOIN cities c USING(city_id) WHERE p.owner_id = ? AND p.property_id NOT IN ( SELECT property_id FROM rates WHERE rate_id =0 ) AND p.property_id NOT IN ( SELECT property_id FROM payment ) ) ";
query += "UNION (SELECT p.property_id, p.address, c.city, c.region_name, c.country_name, p.bedrooms, p.bathrooms, p.sqft, r.nigth, pay.expiration_date, pay.payment_date FROM property p LEFT JOIN cities c USING(city_id) LEFT JOIN rates r ON(p.property_id = r.property_id) LEFT JOIN payment pay ON(pay.property_id = p.property_id) WHERE p.owner_id = ? AND rate_id = 0 HAVING MAX(pay.payment_date)) UNION (SELECT p.property_id, p.address, c.city, c.region_name, c.country_name, p.bedrooms, p.bathrooms, p.sqft, 0.0 as nigth, pay.expiration_date, pay.payment_date FROM property p LEFT JOIN cities c USING(city_id) LEFT JOIN payment pay ON(pay.property_id = p.property_id) WHERE p.owner_id = ? AND p.property_id NOT IN ( SELECT property_id FROM rates WHERE rate_id =0 ) HAVING MAX(pay.payment_date))";
Ps = con.prepareStatement(query);
Ps.setString(1, session.getAttribute("owner_id").toString());
Ps.setString(2, session.getAttribute("owner_id").toString());
Ps.setString(3, session.getAttribute("owner_id").toString());
Ps.setString(4, session.getAttribute("owner_id").toString());
ResultSet Rs = Ps.executeQuery();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("MM/dd/yyyy");
while(Rs.next()) {
%>
.jpg" width="100" height="80" alt="property picture"/> |
| Property #<%=Long.toString(Rs.getLong("property_id"))%> |
Beds: <%=Integer.toString(Rs.getInt("bedrooms"))%> Baths: <%=Integer.toString(Rs.getInt("bathrooms"))%> |
Expiration date: <%try{out.print(sdf.format(Rs.getDate("expiration_date")));}catch(Exception exp6){}%> |
| <%=Rs.getString("address")%> |
Standard rate: $<%=Double.toString(Rs.getDouble("nigth"))%>0 |
Payment date: <%try{out.print(sdf.format(Rs.getDate("payment_date")));}catch(Exception exp6){}%> |
| <%=Rs.getString("city")%>, <%=Rs.getString("region_name")%> |
" style="color:#448;">edit property |
" style="color:#448;">pay for this listing |
| <%=Rs.getString("country_name")%> |
" style="color:#448;">edit aditional info |
|
|
<%
}
Rs.close();
Ps.close();
con.close();
}catch(Exception e2){out.print(e2.toString());}
}
%>
|
|
FRBO.com - A ForLeaseByOwner.com, LLC website
|
|