Jump to content

Changing files over


j05hr

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

Archived

This topic is now archived and is closed to further replies.

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