Code and query look about right -- my guess is you're another one of the
multitude of people who haven't bothered to read the docs about register
globals and how they are now off by default. If the following solves
your problem, then yes indeed, such are you.

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

//
// $student_id probably came in from $_GET or $_POST.
//
$student_id
    = isset( $_GET['student_id'] )
    ? $_GET['student_id']
    : (isset( $_POST['student_id'] )
        ? $_POST['student_id']
        : null;

if( is_null( $student_id ) )
{
    echo 'You have some other problem!'."\n";
}

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

Cheers,
Rob.

On Fri, 2003-08-22 at 14:45, Tony Pagliocco wrote:
> 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]
> 
> 
-- 
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org   |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.    |
`---------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to