I am attempting to run a query on a MySQL data base and then pass the results into an UPDATE Statement using PHP. I am having a problem because the results are stored in an array (multidimensional array I think). Any help on how to do this would be much appreciated.
<script language="php">
include("/usr/home/vet/web_data/libs/log.php3");
include("/usr/home/vet/web_data/libs/email/template_actions");
$vet_last = $_POST['name'];
$areacode = $_POST['areacode'];
$phone = $_POST['phone'];
$hospname = $_POST['hospname'];
$hospcity = $_POST['hospcity'];
$hospcontact1f = $_POST['mgr_fname'];
$hospcontact1l = $_POST['mgr_lname'];
$hospcontact2l = $_POST['own_lname'];
if(!vet_num_errors())
{
if(!template_fetch('doc_confirmed', $doc_notify_subject, $doc_notify_body))
{
vet_error("Error fetching doc_confirmed template.");
}
if($email == 'nogo@nogo.com') {
echo "<font size=\"5\" color=\"red\">
Your confirmation email has not been sent to the doctor. The email address is [email]nogo@nogo.com[/email]</font>";
} else {
if(strstr($email, '@'))
{
$doc_notify_subject = template_fill_vars($doc_notify_subject, array('id' => "$bid_id"));
$doc_notify_body = template_fill_vars($doc_notify_body, array('id' => "$bid_id", 'doc_last_name' => "$vet_last", 'areacode' => $areacode, 'phone' => "$phone", 'hosp_name' => "$hospname", 'hosp_city' => "$hospcity", 'mgr_fname' => "$hospcontact1f", 'mgr_lname' => "$hospcontact1l", 'own_lname' => "$hospcontact2l"));
$doc_sent = mail($email, $doc_notify_subject, $doc_notify_body, "Wrom: HMKHJYFMYXOEAIJJPHSCRTNH
echo "<br> <font size=\"5\" color=\"#0000dd\">
Your confirmation email has been sent to the doctor.</font>";
// First get the prid to pass to step_update
$bid_qtx = "SELECT b.login, b.job_id, b.job_date,
b.job_fee_type, b.job_fee, w.hours, w.prid, w.status
FROM jobs_bid AS b LEFT JOIN jobs_web AS w
ON b.job_id=w.id
AND b.job_date=w.DATE
WHERE b.bid_id='$bid_id'
ORDER BY b.job_date;";
if(!($bid_q = mysql_query($bid_qtx))) {
vet_error($bid_qtx);
}
for($cnt = 0; $cnt < $num_bid; $cnt++) {
list($tmp_bid_login, $tmp_bid_job_id, $bid[$cnt]['job_date'], $bid[$cnt]['fee_type'], $bid[$cnt]['fee'], $bid[$cnt]['memo'], $bid[$cnt]['hours'], $bid[$cnt]['prid'], $bid[$cnt]['status'])= mysql_fetch_row($bid_q);
// $bid_sent, $bid_job_id, $bid_login, are set., $bid is an array...
}
$step_update_qtx =
"UPDATE jobs_bid
SET step='C'
WHERE bid_id='$bid_id';";
if(!mysql_query($step_update_qtx)) {
new_error("Error saving Step: $step_update_qtx");
}
$status_update_qtx =
"UPDATE jobs_web
SET status='old'
WHERE prid='$bid[$cnt]['prid']';";
} else {
echo "<font size=\"5\" color=\"red\">
Your confirmation email has not been sent to the doctor. There is no valid email address on file.</font>";
}
}
}
</script>
<?php
echo "<a href=\"./?page=jobs&sub=bid_detail&bid_id=$bid_id\">Click to go back to detail.</a>"
?>