Hi and thanks for taking the time to read through this first and foremost. I have a bit of code that I have managed to piece together with help from other sites and what it does is connect to our local ms sql server and retrieve a few tables from our database. The info is relating to property management and it basically displays the unit address, current date and its rental status. (Occupied or Vacant)
This makes it easy for us to at a glance check the status of our rentals instead of having to log into our software and navigate through all that.. anyways, I have two issues I need help with.
First problem, in my code, is it possible to write a conditional statement that would check for a certain status in a view and then if it is there, print a simple yes or no in a table with that appropriate property.
For example, we have property 1000 name street and it is currently vacant, however the viewPendingLease shows us information regarding future bookings. I would like to be able to look through that view with the code, check property 1000 name street for any future pending leases, and if there is one, print out a "Yes" in a Future Booked column that I would create.
If any of that makes sense, I can post the print out of the tables of the viewPendingLease if it makes it easier for anyone to see the data output to understand what I am meaning.
The second issue, is it possible to change the color of the text according to a variable, say a word in a generated table with html or css? I would like to color the words vacant or occupied green and red respectively just to make it much easier to zero in on the vacant properties. Or even maybe just color every other row a background color just to help distinguish between the different properties.
Here is my code that pulls up my current tables to show Property, Street and current rented status.
<?php
//connect to a DSN "*******"
$conn = odbc_connect('*******','*****','************');
if ($conn)
{
//the SQL statement that will query the database
$query = "Select unit.PropertyUnitID, unit.Street, unit.Status, from unit";
//perform the query
$result=odbc_exec($conn, $query);
echo "<table border=\"1\"><tr>";
//print field name
$colName = odbc_num_fields($result);
for ($j=1; $j<= $colName; $j++)
{
echo "<th>";
echo odbc_field_name ($result, $j );
echo "</th>";
}
//fetch tha data from the database
while(odbc_fetch_row($result))
{
echo "<tr>";
for($i=1;$i<=odbc_num_fields($result);$i++)
{
echo "<td>";
echo odbc_result($result,$i);
echo "</td>";
}
echo "</tr>";
}
echo "</td> </tr>";
echo "</table >";
//close the connection
odbc_close ($conn);
}
else echo "odbc not connected";
?>
I currently have the viewPendingLease.Active (which shows if there is a future pending lease) taken out due to a repeating data issue I am also trying to figure out...