My first php program

My first php program

am 16.10.2006 16:17:57 von spacerat

I am using ADODB "http://adodb.sourceforge.net/" to get $results.

i then use

foreach ($results as result) {




}

now i need to parse a $result['value1'] in a $_SESSION['value1'] that
needs to be used in another select statement.

i cant use ?>
because that just stores the last "value1" into $_SESSION.
and the same goes for

any ideas im going crazy here :(

Re: My first php program

am 16.10.2006 16:55:29 von Captain Paralytic

spacerat wrote:
> I am using ADODB "http://adodb.sourceforge.net/" to get $results.
>
> i then use
>
> foreach ($results as result) {
>
>
>
>
> }
>
> now i need to parse a $result['value1'] in a $_SESSION['value1'] that
> needs to be used in another select statement.
>
> i cant use > ?>
> because that just stores the last "value1" into $_SESSION.
> and the same goes for
>
> any ideas im going crazy here :(

You're not making a great deal of sense here.

First of all the "foreach ($results as result) {" would not work as it
should be "foreach ($results as $result) {"

Next the code would not output "" or "" as these are within
part of the php parsing (assuming that the foreach is part of it).
Leading on from that the "" shouldn't be there,
as it is already being executed by php.

Finally you say " i cant use $result['value1']; ?> because that just stores the last "value1"
into $_SESSION."
But you only said that you wanted to store "a" $result['value1'] and
the last one is as much a $result['value1'] as any other one. You then
go on to say that it is the same for $result[0]['value1']. The only way
that this can be true is if there is only one result row.

So how about thinking about this and telling us precisely what you want
to achieve?

Re: My first php program

am 16.10.2006 17:12:17 von spacerat

forgive me for my ambuguity

by actual code is as follows


======START=====

require_once ('./includes/site_globals.inc.php');

$subject = $_SESSION['Subject'];
$year = $_SESSION['Year'];
$semester = $_SESSION['Semester'];

//Get all classes for a given subject , in an occurance of a
year/semester

$results = $db->GetAll("SELECT *
FROM classcode c
WHERE subject = '$subject' AND year = '$year' AND semester =
'$semester'");


?>


















method="post">












ClassCode Class





======END=====


this dumps it into "allocation_update_form.php"

which the main query is.

$results = $db->GetAll("SELECT *
FROM classlist c
WHERE c.subject = '$subject' AND c.year = '$year' AND c.semester =
'autumn'
AND classcode = '$classcode'");

its dumping the data ok but the problem i am is that $classcode is
always the same number. when i click on the 'submit' button.

Re: My first php program

am 16.10.2006 17:31:29 von spacerat

umm sorry.

somehow i managed to fix the bugger.