simonjk Posted September 16, 2012 Share Posted September 16, 2012 Hi, I have a mysql table 'Users' of people who state which town they would like a weather forecast for. I then have a second table 'Locations' which contains town names and all the coordinates for that location. I then want to be able to send a user an email with a forecast for their selected town on running a PHO script. However, can someone help me with how I match up the 'Users' selected town, with the same town in the 'Location's table so that I can send an email of the forecast for their selected town? Seem to be going around in circles with this one. With thanks Simon Quote Link to comment https://forums.phpfreaks.com/topic/268445-sending-email-based-on-user-requirements/ Share on other sites More sharing options...
wickedXxxxlegox Posted September 16, 2012 Share Posted September 16, 2012 Well, you don't need the locations table. Just make a row in the users table and have then set their location and then check to see if this person lives in Let's say... Ssn Diego for example, it would send San Diego weather reports. Quote Link to comment https://forums.phpfreaks.com/topic/268445-sending-email-based-on-user-requirements/#findComment-1378422 Share on other sites More sharing options...
simonjk Posted September 16, 2012 Author Share Posted September 16, 2012 Thanks for that, Unfortunately I already have the locations table and it is that where the look up takes place. Does that make sense? Simon Quote Link to comment https://forums.phpfreaks.com/topic/268445-sending-email-based-on-user-requirements/#findComment-1378443 Share on other sites More sharing options...
Christian F. Posted September 16, 2012 Share Posted September 16, 2012 Please don't follow Wicked's advice. At least not the way he wrote it. You do need the locations table, but you also need a foreign key field in the users table linking these two up with each other. There are a lot of tutorials on how to accomplish this, if you're not already familiar with foreign key references. Quote Link to comment https://forums.phpfreaks.com/topic/268445-sending-email-based-on-user-requirements/#findComment-1378444 Share on other sites More sharing options...
thara Posted September 17, 2012 Share Posted September 17, 2012 show us some effort do something get stuck and lets start from where you are stuck. Quote Link to comment https://forums.phpfreaks.com/topic/268445-sending-email-based-on-user-requirements/#findComment-1378518 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.