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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.