I am creating a real-estate website that displays properties. On each property listing I would like a button that says 'Express Interest', when clicked, this button should send an email to me containing the user details who expressed interest (the user will be logged in and so all their details will be taken from their account).
I have the email function working fine, HOWEVER, I also want to display the number of people who have 'Expressed Interest'. Is there a way to track how many times an email has been sent using this button and display "xx people have expressed interest in this property"
Store in the database before sending the mail and just before sending the mail include the number of people or the people who are interested, a simple query would suffice, or if you have a content management system you can include it there, in both cases you would need an intermediate table (connection between user id and real-estate id)
I would add another table to your database that stores a property_id and a user_id. If a user clicks expresses interest, you add another row to that table with the current property_id and the current user_id. To get the amount of links you simply count the rows
SELECT count(user_id) FROM interest_relation WHERE property_id = 'your property id'
This way you can also find out which user is interested in which property.
Related
I'm trying to make an Address book with different users in which they can log in with their username and password. And they can store the information like contact id, first name, last name, phone etc. I want each user to have his own address book.
Can someone please explain how I create different address book for different users.
Thanks a lot.
Create a database. take a primary id to each user or provide unique id.Then create another table fill the fields that you want(address book).Match the user who logged in and and with that another table(foreign key relationship).
When you login ..it checks with db then allows.After that you have to use insert ,update keywords for further process to put data in db.That particular unique id/primary key is used to fetch the related data(address book fields) of that user.
It is actually not a good question for StackOverflow but I will still roughly explain it to you.
You will need two different tables for this. The first one will be used for login details and the second one will record user's address book.
For example:
Table auth will have 3 columns id, username, password
Table addressBook will have contact id, first name, last name, phone etc and also have one more which will be called userID
Whenever any user eneter the data in addressBook their userID from auth table coloum id will be stored along with it. Now you can display their own data to the users.
If you have anymore question ask in comment here.
I've got a database called Members, people would register online entering their fullname, email address, phone number, etc. I made a hidden form where it would set random 4 digit unique number and register it with their data, then I send it via email. People would use these unique IDs to enter an event, only 80% came. I collected the IDs, now I have a list of IDs that belongs to the people that came to the event, I want to export all the rows of people who came using their IDs. Example: For every row that include number: 4293, 1932, 9382 = export. Is there's a way to do this in MySQL?
Following query should do the trick
select fullname from members where ID in (4293, 1932, 9382)
I am using imap_search to get a list of Emails FROM INBOX and SENT ITEMS.
I have a grid that showing the Mail headers first ,when user clicks on one row i want to show entire content,like body,attachment etc ..
to achieve this there should be a UNIQUE ID for each messages.
how can i get UNIQUE ID for messages , i know about the SE_UID option will return the UNIQUE ID'S but UNIQUE ID are only in one Mail box ,
I can see same ID'S on INBOX and SENT ITEMS.
Please help me.
Note : I am using Codeigniter with Peeker Library.
Thanks.
The completely unique ID is made up of the mailbox name (eg INBOX), the UIDVALIDITY returned when a mailbox is selected, and the message UID.
You need to select the relevant mailbox and provide the correct UID to fetch the right message. UIDs are not unique between different mailboxes.
You can use the UID of an email to do operations on any email in any mailbox such as INBOX and SENT.
You can find more information http://phpmaster.com/exploring-phps-imap-library-1/ in this article
i created a table in the database (mysql),and i write a code for inserting data in the datbase using php.values are inserted properly.here i set the status column value as deactive.when user created in that time ,we send a mail to the user to active the link ,means my site and then status column has to changed as active.
my db table contains the following columns
name,email,pwd,status,lastlogin,security qun,ans
when user is created in that time i set the status as deactive.in that time i want to sent a mail(in this mail,i want to send the link to their account) to the user to active their account ,then only user goes to the next process.after that when user open the mail & click that link,the status column has to changed as active in the database.how can i do this,anyone help me..
one way to solve the problem is:
make the field 'status' as varchar not int.
when you are inserting user information for the first time, make a random string and insert it in the status field.
say your random string you have created is 'lka342lkjasd8234kl2324ljklj2'. send the link with the string as a parameter.
when the link is clicked in the script check the verification string matches the value in your status table.
if it matches then show message that his account is verified and change the value of the field to 1 (as 1 indicates a active account)
if the string doesn't matches then show message the verification link is wrong.
in another way you can make another table for storing verification string. and make the status fiend an integer. set 0 initially and make it 1 when verified, and check the verification with the new table.
You can create column called activation_code, send an email to user with link, which will contain this activation_code. Link like this www.example.com/active.php?activation_code=AABBCCDDEEFF, when user click this link you can get activation_code, find a user at database and change status. Also you can create column activation_expires which will contain a date when activation code will expire.
So basically what I'm working with is a database full of phone numbers.
if I get one of those users from that phone database and they sign up to my website I want to automatically associate the number from the database that is already present, how would I go about linking those 2 tables together once a user signs up?
Assuming that you have phone number table and users table you need to store the primary keys of both table together
You can do it:
In a user table, but then you will be able to link only one phone number to a user (and later if you will have to add more then one phone you might end up adding fields like phone_number_1, phone_number_2, etc... which is quite horrible)
In a phone number table, but then you will be able to link only one user to a phone number (same problem may arise as in point one)
In a separate table, but then you will have to use a join every time you need to get a user or phone number
The right choice depends on the relationships between the data that you are trying to model.
So, the database would be structured using composition. Keep a phone_numbers table w/ phone_number_id, the users table w/ user_id, and then a customer_phone_numbers table that maps user_ids to phone_number_ids. Then your PHP code would do something like this:
<?php
$user->save(); // save normal user data
$phoneNumbers = array();
foreach($user->getPhoneNumbers() as $phoneNumber) {
$phoneId = getPhoneNumberId($phoneNumber); // get the phone number, or save a new record if necessary, and return that number
$phoneNumbers[] = $phoneId;
}
$user->savePhoneNumbers( $phoneNumbers ); // adds or removes phone numbers as necessary
EDIT: Based on your feedback, it doesn't sound so much like you are just looking for a way to associate the data. If I understand you correctly, the user will sign up for your website via their phone, then later register on the website. You want to combine the two registrations when this happens.
Are users creating a complete profile from their phone? Do you have a process in place to verify that the phone number provided by the user is actually theirs?
If the user is not creating a full profile via the phone, it sounds like there are two types of "profiles" being stored, a complete website profile, and a telephone profile. This way, you would have a phone profile w/ a phone_profile_id and a regular user record w/ a user_id. Then, let users verify their telephone information and associate them to a phone_profile_id using a composition table as above.
Is that a little closer?
Thanks,
Joe