Jump to content

Multiple Query


DrTrans

Recommended Posts

Can someone help me figure out this query...

 

I have it generating basically a list of whats in the database.  One of the fields is numeric in database that i want it to read another table to get the correct variables. ( i hope i explain this right.. u might be able to see what i mean in the code). its fuxd.

 

        $connect = mysql_connect("localhost","root","");
        mysql_select_db("magic");
        $query = "SELECT * FROM props WHERE ownerid = '$ownerid' ORDER BY name ASC ";
        $result = mysql_query($query);
        while($row = mysql_fetch_assoc($result))
	{
		$propertyid     = $row['propid'];
		$propertyname   = $row['name'];
		$propertydesc = $row['description'];
		$propertycity   = $row['city'];
		$propertystate  = $row['state'];
		$propertyzip    = $row['zip'];
		$tenantid = $row['tenantid'];
		$active = $row['active'];
		$lease = $row['lease'];
		$leaseamt = $row['leaseamt'];

		if($active == "1"){

		$propertystatus = "Active";
         $query2 = "SELECT * FROM tenant WHERE propid = '$propid' ";
             $result2 = mysql_query($query2);
              while($row = mysql_fetch_assoc($result2))
	{
		$tenantfname   = $row['fname'];
		$tenantlname   = $row['lname'];
		}
		} else {
		$propertystatus = "Unknown";
		}



print"<tr  onMouseOver=\"this.bgColor = '#CEE3F6'\" onMouseOut =\"this.bgColor = '#FFFFFF'\">
<td align=\"left\" width=\"25%\" onclick=\"window.open('viewpropdetail.php?prop=$propertyid','mywindow','width=1200,height=600,scrollbars=1')\">$propertyname</td><td>$tenantfname $tenantlname</td><td>$propertystatus</td><td>$$leaseamt</td>

";

  }

Link to comment
https://forums.phpfreaks.com/topic/250844-multiple-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.