Ok , I am slightly confused at the moment, maybe someone can shed me some
light about the situation.

I have a php page that pulls a query of all students in a table that have
fit a criteria, in this case, where
the field, named "web", is set to Y

So when you open the page, all people with Y = web , are spit out into a
table.

Name - Address - Printed..

---------
Example:

Joe Smith - 5 Smith Road - Not Printed
Randy bob - 4 Joe Road - Not Printed

-------         

Now when the query outputs, I can click on the "Not Printed" link and it
should
update the persons row to change the vaule of the field named Printed from N
to Y.

Then when I referesh the page, it should look the same but instead of it
saying 
"Not Printed" it should say "Printed" next to the persons row.

So based on the above example, if we were to click on Joe Smith's "Not
Printed" link,
if we were to pull the page up later, it would now show "Printed"

We want to have a list of all students who have Y = Web but also at the same
time
monitor who we have pritned info on and who we dont, hence the reason for
the toggle.

I've included the code below to the function, my update looks correct but
when I'm coming 
back to the query page, its not changing the status of the "Not Printed" ,
so even 
if Printed is Y now in the field, it still says Not Pritned.

Any ideas? TIA everone


<?

## parameter: $student_id

include("../../application2.php");
$CFG->dbname = "ipo_students";

db_connect($CFG->dbhost, $CFG->dbname, $CFG->dbuser, $CFG->dbpass);
$qid = db_query("SELECT printed FROM outgoing_student
                 WHERE id=$student_id");
$row = mysql_fetch_array($qid);
$printed = $row['printed'];

echo "current value of printed is $printed";
if ($printed == 'n' || $printed == 'N' || empty($printed)) {
  $newvalue = "Y";
} else {
  $newvalue = "N";
}

db_query("UPDATE outgoing_student SET printed='$newvalue' WHERE
          id='$student_id'");

echo "Go to previous page and refresh";


?>



Tony Pagliocco
Systems Administrator
Arizona State University
International Programs Office
Phone: (480) 727-6279
Email: [EMAIL PROTECTED]


Reply via email to