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
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
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
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
Share on other sites

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.

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.