|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I am setting up email alerts for people where they can select a variety of
options, and if criteria matches all the options they choose, they get an email letting them know they have a match to view. Since I use a get form for the search results page, I figured that would be a good way to store the email alerts options as well. I am able to store the URL string of parameters very nicely using $url=$_SERVER['QUERY_STRING']; echo $url; and saving that in the database. However, I'm not sure how I can extract data from that string other then using the $_get .... but I don't have an option of using the address url since it will be looping though all the email alerts data finding matches and spitting out emails. Any ideas on how to do this? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
.... and if I can loop through an entire table of stored url query strings, and
extract that data and match it against stored data that matches those email alert options, would it be better to just store each variable in individual columns as an array in the database, and then implode those arrays into a format where it can be compared against the data it needs to match? If so, how can I store arrays in the database and extract them successfully. I didn't understand serialize and how to work with that, and didnt know if there was another way. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
..oO(jsteinmann)
>I am setting up email alerts for people where they can select a variety of >options, and if criteria matches all the options they choose, they get an email >letting them know they have a match to view. > > Since I use a get form for the search results page, I figured that would be a >good way to store the email alerts options as well. I am able to store the URL >string of parameters very nicely using $url=$_SERVER['QUERY_STRING']; echo >$url; and saving that in the database. However, I'm not sure how I can extract >data from that string other then using the $_get .... Try parse_str(). But if you really want to perform a DB search on that to find matching records, you should use a better table design. Just throwing multiple pieces of informations into a single table column like in this cases already violates the first normal form of database design. Really bad thing. But how to actually structure the table(s) depends on the data you have and what you want to do with it. Proper DB designs take some time. Micha |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
ok, well I changed it so I'm capturing the search string as well as added a
column for each search variable. I'm using the implode to seperate the arrays with commas... like this... $education = ''.implode(',',$_GET['education']).''; and then insert record like this... <input name="education" type="hidden" value="<?php echo $education; ?>"> The data then will be either % for all, or will look like this: Bachelors Degree,Masters Degree,Other Where those 3 options were selected So now my question is, how do I get this back out to filter the recordset? I have this so far: if (isset($row['education']) != "") { $query .= " WHERE education LIKE '{$row_rs['education']}'"; } ... but I know that's not right because I have commas and it needs to check each answer. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
do i need to explode the data?
|
|
![]() |
| Outils de la discussion | |
|
|