I'm trying to display a summary list of calls with one attribute being
CallType. I have CallType and CallTypeID defined in a table name calltypes.
The problem I am having is taking the output of CallID defined in calls and
having the script match the CallTypeID to the CallType. If I run the
display_calltype_sql  query in MySQL client and set the CallID to a known
integer (set by auto_increment) then I can do what I am trying to do. I
guess the problem comes down to getting the $CallID out of the calls table
and inserting the value into the second SQL query. I thought my queries did
this, but I must be mistaken.

Any suggestions?

$display_calls_sql = "SELECT CallID,CallDateTime,CallSubject,CallStatus FROM
calls WHERE ContactID = $ContactID";

$display_calltype_sql = "SELECT CallType FROM calltypes INNER JOIN calls ON
calltypes.CallTypeID = calls.CallTypeID WHERE CallID = '$CallID'

$display_calls_result = @mysql_query($display_calls_sql,$connection) or

$display_calltype_result = @mysql_query ($display_calltype_sql, $connection)
or die (mysql_error());

while (list ($CallID, $CallDateTime, $CallSubject, $CallStatus) =
print ("<tr>\n".
"<td width=\"21\" height=\"24\">&nbsp;</td>\n".
"<td align=\"center\">$CallID</td>\n".
"<td width=\"17\">&nbsp;</td>\n".
"<td width=\"75\" valign=\"top\">$CallType</td>\n".
"<td width=\"26\">&nbsp;</td>\n".
"<td width=\"19\">&nbsp;</td>\n".
"<td width=\"25\">&nbsp;</td>\n".
"<td width=\"30\">&nbsp;</td>\n".


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to