DrTrans Posted November 10, 2011 Share Posted November 10, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/250837-php-or-jquery/ Share on other sites More sharing options...
xyph Posted November 10, 2011 Share Posted November 10, 2011 No, PHP acts server-side, so in order to send or get new data through PHP, the client needs to make some sort of request. You'd use a combination of JavaScript and PHP Quote Link to comment https://forums.phpfreaks.com/topic/250837-php-or-jquery/#findComment-1286933 Share on other sites More sharing options...
denno020 Posted November 10, 2011 Share Posted November 10, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/250837-php-or-jquery/#findComment-1286946 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.