Jump to content

Php or JQuery


DrTrans

Recommended Posts

Im wondering if i should use jQuery or Php. and how about i would go about doing this.

 


<?php
    print "<table border=\"0\" cellpadding=\"0\" width=\"100%\" height=\"100\"cellspacing=\"0\" style=\"border-collapse:collapse\"bordercolor=\"grey\" bgcolor=\"white\" valign=\"top\">
<td align=\"left\" width=\"100%\" onclick=\"I3.location.href='getuserdetail.php?prop=$ownerid'\"><b>Property Name</b></td><td><b>Tenant</b></td><td><b>Property Status</b></td><td>Rent Amount</td>";	
        $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'];
		$active = $row['active'];
		$lease = $row['lease'];
		$leaseamt = $row['leaseamt'];

		if($active == "1"){
		$propertystatus = "Active";
		} else {
		$propertystatys = "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>$ownerfirstname $ownerlastname</td><td>$propertystatus</td><td>$$leaseamt</td>

";
  }


print"</td></table>";
                                                           
                                                           ?>

 

Basically i have a link under that is add property. it pops up a box. with a form you fill it out, and it inserts the record into database.

 

What I'm trying to do. is get it to "Refresh" the property list ( ex. code above).  so it shows the new property in the table.

 

 

 

i have never used jQuery. but was wondering if i could do that with php.  Is there a way to say if records are changed.. update?

Link to comment
Share on other sites

You could make the form submit to the property list page, have code at the top of the page to determine if a form has been submitted, then add the entry to the database, then as the page continues to process, it will pull all the entries in the database, including the newly added one, and display them on the page.

 

If you want this to happen without the page appearing to refresh, then you will need to use AJAX. Which I'm pretty sure JQuery makes very easy, just look for some tutorials on it.

 

Hope that helps somewhat..

 

Denno

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.