Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Passing info from two tables
Old 01-09-2006, 10:28 AM Passing info from two tables
KML9870's Avatar
One Bad Mamma :-)

Posts: 5,489
Name: Kandi
Location: Western NY
Trades: 0
Okay, I'm stumped.

Background info: I'm building a website with three types of users - Physicians, EMployers, Recruiters. The relevant tables are - Physicians and Jobs

Problem lays: When a logged in physician responds to a practice opportunity I need the script to retain the physician's personal information and the displayed opportunity information. The problem is that it isn't passing the opportunity information.

Here is my script as it is now:

ShowDetails.php:

PHP Code:
 <?php
include("misc.inc");
$connection mysql_connect($host,$user,$password)
or die (
"couldn't connect to server");
$db mysql_select_db($database,$connection)
or die (
"Couldn't select database");
 
/* Select opportunities of the given Specialty */
$query_text "select * from Jobs where ID='$ID'"// 25
$query mysql_query($query_text);
$result mysql_fetch_array($query);
 
$OppSpecialty $result['Specialty'] ;
$OppState $result['State'] ;
$Oppid $result['id'] ;
$OppLocation $result['Location'] ;
$OppContact $result['Contact'] ;
$OppContactEmail $result['Contact_Email'] ;
echo 
"$Oppid$OppSpecialty$OppContact";
echo
"<a href=http://{$result['CoWebsite']} target=_blank><img border='0' src=\"{$result['CoBanner']}\" width='120' height='120'></a>
<p>
<b>Specialty:</b> 
$OppSpecialty<br>\n
<b>Location:</b> 
$OppLocation<br>\n
<b>State:</b> 
$OppState<p>\n
<b>Company:</b> 
{$result['Company']}<br>\n
<b>Company Website:</b> <a href=http://
{$result['CoWebsite']} target=_blank>{$result['CoWebsite']}</a><p>\n
<b>Contact:</b> 
$OppContact<br>\n
<b>Email:</b><a href=\"mailto:
$OppContactEmail\"> {$result['Contact_Email']}</a><br>\n
<b>Phone:</b> 
{$result['Contact_Phone']}<br>\n
<b>Fax:</b> 
{$result['Contact_Fax']}<p>\n
<b>Practice Type:</b> 
{$result['Practice_Type']}<br>\n
<b>Call:</b> 
{$result['Call']}<p>\n
<b>Description:</b> <p>
{$result['Description']}<br><p><p>
<b>Company Profile:</b> 
{$result['CoProfile']}<p>";
 
 
echo 
"<form action='Respond.php?Oppid=Oppid' method='POST'>";
 
echo 
"<input type='submit' value='Respond to this opportunity' width='10' height='8'></td></form><tr><p>\n";
 
echo 
"</table>\n";
echo 
"<center><a href='javascript:history.go(-1)'>Go back to Search Results</a><p>\n";
echo 
"<center><div align='center'>
<a href='Search.php'><b>Search for more Opportunities</b></a></div>"
?>
Respond.php:

PHP Code:
<?php
include("misc.inc");
include(
"PhysInfo.inc");
 
$connection mysql_connect($host,$user,$password)
or die (
"couldn't connect to server");
$db mysql_select_db($database,$connection)
or die (
"Couldn't select database".mysql_error());
if (
$_SESSION['loggedinuser'] = ''
)
{
header ("Location:PhyaicianLogin");
echo 
"Please login before responding to an opportunity.If you are not yet registered, please go to the <a href='PhysicianWelcome.php'>Physician Welcome page</a> to register.";}
else
 
$query_text "select * from Jobs where id='$Oppid'"// 25
$query mysql_query($query_text);
$result mysql_fetch_array($query);
 
$yourwebsite 'www.MDPracticelist.com';
$subject="MDPractice List Response-Dr. $Last_Name$OppSpecialty-$OppState$Oppid"// The subject of the mail thats being sent
$recipient_email=$OppContactEmail// the recipient
/*
The headers for the e-mail, no need to change it unless you know what you're doing
*/
$header "From: Dr. $Last_Name <$Email>\r\n";;
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: text/html; charset=iso-8859-1\r\n";
 
$content"Dear $OppContact,
 
Dr. 
$Last_Name has responded to your posting for $Specialty, MDPractice List id # $id.
 
Dr. 
$Last_Name has provided the following information to aid in your consideration for the opportunity:
 
<p><p align='center'><b><font size='3' font color='000000'>
$First_Name &nbsp; $Last_Name<br> $Street1<br>$HomeCity$HomeState &nbsp; $HomeZip<br>Home Phone: &nbsp;$HomePhone<br>Cell Phone: &nbsp;$CellPhone<br>Business Phone: &nbsp;$BusPhone<br>Pager:&nbsp;$Pager<br>Fax Number:&nbsp;$FaxNum<br>Email:&nbsp;$Email</b></p>
<p align='left'><font size='3' font color='000000'>
<b><u>Education:</b></u></p>
<p align='left'><font size='3' font color='000000'>
$MedSchoolName<br>
$MedSchoolCity, &nbsp;$MedSchoolState<br>
$MedSchoolYearStart&nbsp;-&nbsp;$MedSchoolYearEnd</p>
 
<p align='left'><font size='3' font color='000000'>
$InternName<br>
$InternCity, &nbsp;$InternState<br>
$InternYearStart&nbsp;-&nbsp;$InternYearEnd</p>
<p align='left'><font size='3' font color='000000'>
$ResName<br>
$ResCity, &nbsp;$ResState<br>
$ResYearStart&nbsp;-&nbsp;$ResYearEnd</p>
<p align='left'><font size='3' font color='000000'>
 
<p>
<p align='left'><font size='3' font color='000000'><b><u>Fellowship Program: </b></u></p>
<p align='left'><font size='2' font color='000000'> 
$FellowName<br>
$FellowCity$FellowState
$FellowYearStart&nbsp;-&nbsp$FellowYearEnd
"
;
 
 
 
 
mail('myemailfornow'$subject$content$header);
echo 
"<font color=00008B><align=center><b>Thank you $Last_Name! Your interest has been sent to: $OppContactEmail .</b><p>\n";
echo 
"<center><a href='javascript:history.go(-2)'>Go back to Search Results</a><p>\n";
 
?>
PhysInfo.inc holds the physician's previously entered info.

The email being sent has all of the physician info, but none of the opportunity info.

I've been struggling with how to get this to work....to no avail.

Your help would be greatly appreciated!!
__________________
~~Kandi~~

Please login or register to view this content. Registration is FREE


KML9870 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-09-2006, 05:19 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
PHP Code:
$result mysql_fetch_array($query);
 
//You need to read out the contents of $result here, like you do in the other file

$yourwebsite 'www.MDPracticelist.com';
$subject="MDPractice List Response-Dr. $Last_Name$OppSpecialty-$OppState$Oppid"// The subject of the mail thats being sent 
^ This section of respond.php needs to have similar code to howDetails.php, that gets the $Opp variables out of the $result array:
Something like:
PHP Code:
$OppSpecialty $result['Specialty'] ;
$OppState $result['State'] ;
$Oppid $result['id'] ;
$OppLocation $result['Location'] ;
$OppContact $result['Contact'] ;
$OppContactEmail $result['Contact_Email'] ; 
placed into respond .php where the comment above indicates should do it, otherwise $OppContact etc will not have been initialised within respond.php and will be blank.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 01-09-2006, 06:52 PM
KML9870's Avatar
One Bad Mamma :-)

Posts: 5,489
Name: Kandi
Location: Western NY
Trades: 0
Thanks Oberon - my problem was actually not defining $id as hidden text in ShowDetails.php - it wasn't passing the id to Respond.php, therefore it wasn't getting a query result. Once I echoed the id as hidden text it's working fine as is.
__________________
~~Kandi~~

Please login or register to view this content. Registration is FREE


KML9870 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Passing info from two tables
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30435 seconds with 12 queries