Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/182631-changing-files-over/
Share on other sites

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}";

Link to comment
https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-963902
Share on other sites

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';

Link to comment
https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-964972
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-964981
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/182631-changing-files-over/#findComment-964985
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.