j05hr Posted November 23, 2009 Share Posted November 23, 2009 Just thought I'd start with the new forums looking really nice . Ok basically I've made this site www.sampleestateagent.com and the CMS and search function is all done for the buying part of the site. I now need to repeat this whole process for the renting section of the site. It's basically got an edit subject, new subject, delete subject, new page, edit page, delete page. How would this work with repeating yourself and using the same code twice? Or is that what's needed? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/182631-changing-files-over/ Share on other sites More sharing options...
trq Posted November 23, 2009 Share Posted November 23, 2009 You basically just need to add a type column to your existing tables, then adjust your queries to search for ... WHERE type = 'buying' or ... WHERE type = 'renting'. Quote Link to comment https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-963894 Share on other sites More sharing options...
j05hr Posted November 23, 2009 Author Share Posted November 23, 2009 So is this what you mean, I got a table called buying, so literally use that and change it to renting and then just Edit this... $query = "UPDATE buying SET menu_name = '{$menu_name}', position = {$position}, visible = {$visible}, content = '{$content}', house_price = '{$house_price}', bedrooms = '{$bedrooms}', propType = '{$propType}' WHERE id = {$id}"; To this... $query = "UPDATE renting SET menu_name = '{$menu_name}', position = {$position}, visible = {$visible}, content = '{$content}', house_price = '{$house_price}', bedrooms = '{$bedrooms}', propType = '{$propType}' WHERE id = {$id}"; Quote Link to comment https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-963902 Share on other sites More sharing options...
trq Posted November 23, 2009 Share Posted November 23, 2009 Not at all. You would use the same table for both types and just have another column defining whether or not the property is for rent or sale. Quote Link to comment https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-963907 Share on other sites More sharing options...
j05hr Posted November 23, 2009 Author Share Posted November 23, 2009 That sounds rather easy to do, but how would it be so say for example you add a new property. What would stop it submitting to the buying page and only going to the renting page to search for it if it is a rented property? Quote Link to comment https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-963911 Share on other sites More sharing options...
trq Posted November 23, 2009 Share Posted November 23, 2009 You would make sure to insert it using the correct type. Quote Link to comment https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-964278 Share on other sites More sharing options...
j05hr Posted November 24, 2009 Author Share Posted November 24, 2009 Sorry I was busy validating and finalising the look of the buying page. I'm now ready to move onto the renting section, could you explain a bit more about using the correct type as I'm not sure what you mean. Thanks, Josh Quote Link to comment https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-964752 Share on other sites More sharing options...
trq Posted November 24, 2009 Share Posted November 24, 2009 If you where to insert a rental: $query = "INSERT INTO properties SET menu_name = '{$menu_name}', position = {$position}, visible = {$visible}, content = '{$content}', house_price = '{$house_price}', bedrooms = '{$bedrooms}', propType = '{$propType}' type = 'rental'; A 'for sale' $query = "INSERT INTO properties SET menu_name = '{$menu_name}', position = {$position}, visible = {$visible}, content = '{$content}', house_price = '{$house_price}', bedrooms = '{$bedrooms}', propType = '{$propType}' type = 'sale'; Quote Link to comment https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-964972 Share on other sites More sharing options...
j05hr Posted November 24, 2009 Author Share Posted November 24, 2009 And then you get the renting page to find rental and buying to find sale? What sort of code would you need for this? If I'm not very good at PHP would it be better to pay someone to do it or is it simple enough? Quote Link to comment https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-964975 Share on other sites More sharing options...
mikesta707 Posted November 24, 2009 Share Posted November 24, 2009 with your select query for buying just select where type='sale' or for renting, select where type='rent' obviously you could add more parameters based on what the query is doing (showing all, doing a search, etc.) but thats the basic idea Quote Link to comment https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-964981 Share on other sites More sharing options...
j05hr Posted November 24, 2009 Author Share Posted November 24, 2009 So for example this is my select query I have now function get_all_subjects() { global $connection; $query = "SELECT * FROM subjects ORDER BY position ASC"; $subject_set = mysql_query($query, $connection); confirm_query($subject_set); return $subject_set; Make a new row in the table whether it's buying or renting and get it to select whether it's buying or renting? Quote Link to comment https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-964985 Share on other sites More sharing options...
trq Posted November 24, 2009 Share Posted November 24, 2009 If I'm not very good at PHP would it be better to pay someone to do it or is it simple enough? If youv'e already done the buying side of things you shouldn't have too much trouble. The logic is quite simply when you think about it. Quote Link to comment https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-964987 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.