newbie problem

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-04-2003
Karzy
 
Posts: n/a
Default newbie problem

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>";
}

?>
Reply With Quote
  #2 (permalink)  
Old 10-04-2003
Geoff Berrow
 
Posts: n/a
Default Re: newbie problem

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/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:17 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0