This is a discussion on newbie problem within the PHP Language forums, part of the PHP Programming Forums category; Been trying to solve a problem for over a week now and have thrown in the towel. I need some ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Been trying to solve a problem for over a week now and have thrown in
the towel. I need some help from people that actually know what they're doing :) Any help would be GREATLY appreciated!! My goal: Display all recruits and their info who have not been contacted in the past 14 days. Specifics: I need info from three (3) tables and there are quite a few WHERE conditions. What I've tried to do: Get the MAX(cont_date) and bring it into another sql statement. From there I've tried to acertain the info. I need the MAX (I think) because without they most all come back true since they have had at least one contact at least two weeks old. The Code: (It's a mess as I've tried what seems like a thousand different things) <dbase connection stuff> $today = date("Y-m-d") $sql= "SELECT MAX(cont_date) AS max_date FROM player_contact"; $result = @mysql_query($sql, $connection) or die(mysql_error()); WHILE ($row = mysql_fetch_array($result)) { $max_date = $row['max_date']; } $sql = "SELECT players.player_id, printable_table.player_id, player_contact.player_id, f_name, l_name, school, state, eval_rank, contact_coach, cont_type, '$max_date' FROM players, printable_table, player_contact WHERE '$max_date' <= '$today' - 14 day AND players.player_id = printable_table.player_id AND players.player_id = player_contact.player_id AND printable_table.player_id = player_contact.player_id AND contact_coach = 'MK' AND cont_type = 'Phone' AND eval_rank NOT IN ('4', '8', '9') GROUP BY l_name"; $result = @mysql_query($sql, $connection) or die(mysql_error()); $contact_list = "<ul>"; while ($row = mysql_fetch_array($result)) { $player_id = $row['player_id']; $f_name = $row['f_name']; $l_name = $row['l_name']; $school = $row['school']; $state = $row['state']; $contact_list .= "<li><a href=\"view_player_contact.php?player_id= $player_id\">$l_name, $f_name - $school, ($state)</a></li>"; } ?> |
|
|||
|
I noticed that Message-ID:
<MPG.19e8152d39d09f399896c6@netnews.mchsi.com> from Karzy contained the following: >My goal: Display all recruits and their info who have not been contacted >in the past 14 days. You should be able to do this with SQL http://www.1keydata.com/sql/sqlbetween.html -- Geoff Berrow It's only Usenet, no one dies. My opinions, not the committee's, mine. Simple RFDs http://www.ckdog.co.uk/rfdmaker/ |